Skip to content

Commit 5dbf061

Browse files
committed
chore: re-use upgradeEndResponse struct
1 parent 73c183f commit 5dbf061

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

lib/clusters/ota.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ const IMAGE_BLOCK_RESPONSE = {
109109
},
110110
};
111111

112+
const UPGRADE_END_RESPONSE = {
113+
id: 0x0007,
114+
args: {
115+
manufacturerCode: ZCLDataTypes.uint16,
116+
imageType: ZCLDataTypes.uint16,
117+
fileVersion: ZCLDataTypes.uint32,
118+
currentTime: ZCLDataTypes.uint32,
119+
upgradeTime: ZCLDataTypes.uint32,
120+
},
121+
};
122+
112123
// ============================================================================
113124
// Commands
114125
// ============================================================================
@@ -210,7 +221,11 @@ const COMMANDS = {
210221
response: IMAGE_BLOCK_RESPONSE,
211222
},
212223

213-
imageBlockResponse: IMAGE_BLOCK_RESPONSE,
224+
imageBlockResponse: { // Mandatory
225+
...IMAGE_BLOCK_RESPONSE,
226+
direction: Cluster.DIRECTION_SERVER_TO_CLIENT,
227+
frameControl: ['directionToClient', 'clusterSpecific', 'disableDefaultResponse'],
228+
},
214229

215230
// Sent by the client when it has completed downloading an image. The status
216231
// value SHALL be SUCCESS, INVALID_IMAGE, REQUIRE_MORE_IMAGE, or ABORT.
@@ -222,32 +237,17 @@ const COMMANDS = {
222237
imageType: ZCLDataTypes.uint16,
223238
fileVersion: ZCLDataTypes.uint32,
224239
},
225-
response: {
226-
id: 0x0007,
227-
args: {
228-
manufacturerCode: ZCLDataTypes.uint16,
229-
imageType: ZCLDataTypes.uint16,
230-
fileVersion: ZCLDataTypes.uint32,
231-
currentTime: ZCLDataTypes.uint32,
232-
upgradeTime: ZCLDataTypes.uint32,
233-
},
234-
},
240+
response: UPGRADE_END_RESPONSE,
235241
},
236242

237243
// --- Server to Client Commands ---
238244

239245
// Response to the Upgrade End Request, indicating when the client should upgrade
240246
// to the new image.
241247
upgradeEndResponse: { // Mandatory
242-
id: 0x0007,
248+
...UPGRADE_END_RESPONSE,
243249
direction: Cluster.DIRECTION_SERVER_TO_CLIENT,
244-
args: {
245-
manufacturerCode: ZCLDataTypes.uint16,
246-
imageType: ZCLDataTypes.uint16,
247-
fileVersion: ZCLDataTypes.uint32,
248-
currentTime: ZCLDataTypes.uint32,
249-
upgradeTime: ZCLDataTypes.uint32,
250-
},
250+
frameControl: ['directionToClient', 'clusterSpecific', 'disableDefaultResponse'],
251251
},
252252

253253
// Client requests a device specific file such as security credential,

0 commit comments

Comments
 (0)