Detailed Description
Referring to fig. 3, an embodiment of the present invention provides a method for upgrading a Zigbee device, where the method includes:
301. and receiving a firmware downloading instruction sent by the equipment management server by using a remote equipment management protocol, and acquiring the firmware according to the firmware downloading instruction.
The step can directly acquire the firmware from the firmware downloading instruction, or the step can download the firmware according to the downloading address of the firmware if the firmware downloading instruction carries the downloading address of the firmware.
302. And receiving equipment range indication information and firmware issuing and upgrading indication information which are sent by an equipment management server and are applicable to the firmware by using a remote equipment management protocol.
It should be noted that step 301 and step 302 do not have a chronological order.
An execution subject in the embodiment of the present invention may be a gateway, an equipment management server in the embodiment of the present invention may be an M2M service platform, and a Zigbee device may be an M2M device.
The remote device management protocol in the embodiments of the present invention may be a DM protocol or a TR069 protocol. Specifically, the device management server may configure, by using a DM protocol, device range indication information (i.e., device range description information in the subsequent embodiment) applicable to the firmware on a corresponding node of a management tree in the gateway, or may extend a firmware file by using a TR069 protocol, add a Zigbee device range command applicable to the firmware in the firmware file, where the Zigbee device range command includes the Zigbee device range indication information applicable to the firmware, and then issue the extended firmware file to the gateway, which is specifically described in detail in the subsequent embodiment.
The device range indication information to which the firmware is applicable includes: at least one of an identifier of the Zigbee device to which the firmware is applicable, an identifier of a Zigbee device manufacturer to which the firmware is applicable, an identifier of a Zigbee device category to which the firmware is applicable, and firmware version range indication information currently used by the Zigbee device that can be upgraded to the obtained firmware.
Specifically, the device management server may send an instruction for triggering the gateway to execute firmware delivery and upgrade by using a DM protocol, so as to trigger an executable command stored on a node of a management tree in the gateway and indicating firmware delivery and upgrade; or, a firmware file may be extended through a TR069 protocol, and a firmware upgrade mode command is added to the firmware file, where the firmware upgrade mode command is a command indicating that the Zigbee device immediately upgrades the distributed firmware, or a command indicating that the Zigbee device synchronously executes firmware upgrade after the firmware is successfully downloaded, or a command indicating that the Zigbee device upgrades the distributed firmware at a predetermined upgrade time, and then sends the extended firmware file to the gateway, which is specifically described in detail in the following embodiments.
The firmware issuing and upgrading indication information comprises: the firmware issues indication information and upgrading indication information; before receiving the upgrade indication information sent by the remote device management server by using the remote device management protocol, the method further includes: sending a firmware downloading result of the Zigbee equipment suitable for the firmware to an equipment management server; the receiving of the upgrade indication information sent by the remote device management server by using the remote device management protocol specifically includes: after sending a firmware download result of the Zigbee device to which the firmware is applicable to an equipment management server, receiving upgrade indication information sent by the equipment management server, where the upgrade indication information is sent when the equipment management server determines that the upgrade indication information needs to be sent according to the firmware download result of the Zigbee device to which the firmware is applicable. The upgrade indication information may indicate a specific upgrade manner, which is described in the following embodiments.
303. And issuing the acquired firmware to the Zigbee equipment applicable to the firmware by using a Zigbee equipment firmware upgrade management protocol according to the firmware issuing and upgrade indication information and the equipment range indication information applicable to the firmware, and controlling the Zigbee equipment applicable to the firmware to execute firmware upgrade operation.
Specific issuing firmware includes, but is not limited to, the following two ways:
the first mode is as follows: determining the Zigbee device to which the firmware is applicable according to the device range indication information to which the firmware is applicable, and sending a notification message to the Zigbee device to which the firmware is applicable in a unicast manner to Notify the Zigbee device to which the firmware is applicable to download the firmware, where the notification message may be an Image Notify message.
The second mode is as follows: issuing a notification message to all Zigbee devices managed by the gateway in a broadcast manner, where the notification message carries information of a Zigbee device to which the firmware is applicable, where the information of the Zigbee device to which the firmware is applicable includes: the notification message may be an Image Notify message, and the Zigbee device includes at least one of a manufacturer identifier and a category identifier of the Zigbee device to which the firmware is applicable.
Specifically, the firmware issuing and upgrading indication information indicates that each Zigbee device to which the firmware is applicable successfully downloads the firmware and then immediately executes firmware upgrading operation, and the gateway indicates, by using a Zigbee device firmware upgrading management protocol, that the Zigbee device to which the firmware is applicable downloads the firmware from the gateway, and respectively sends indication information of immediate upgrading to each Zigbee device that is successfully downloaded; or the firmware issuing and upgrading indication information indicates that firmware upgrading operation is executed immediately after all Zigbee devices to which the firmware is applicable successfully download the firmware, the gateway indicates the Zigbee devices to which the firmware is applicable to download the firmware from the gateway by using a Zigbee device firmware upgrading management protocol, and after all the Zigbee devices to which the firmware is applicable successfully download the firmware, the gateway sends indication information for immediate upgrading to all the Zigbee devices to which the firmware is applicable, or the gateway indicates the Zigbee devices to which the firmware is applicable to download the firmware from the gateway by using a Zigbee device firmware upgrading management protocol, and after all the Zigbee devices to which the firmware is applicable are successfully downloaded, when some Zigbee devices to which the firmware is applicable are currently in a dormant state, a time point at which all the Zigbee devices to which the firmware is applicable are in an active state is selected, respectively sending indication information indicating that firmware upgrading is carried out at the selected time point to all Zigbee equipment applicable to the firmware; or the firmware issuing and upgrading indication information indicates that each Zigbee device to which the firmware is applicable successfully downloads the firmware and then executes firmware upgrading operation at a predetermined upgrading time, the gateway indicates the Zigbee device to which the firmware is applicable to download the firmware from the gateway by using a Zigbee device firmware upgrading management protocol, and the indication information indicating that firmware upgrading is performed at the predetermined upgrading time is respectively sent to all Zigbee devices to which the firmware is applicable.
Further, in order to make the device management server know the upgrade result, the method further includes: and inquiring an upgrading result from the Zigbee equipment executing the firmware upgrading operation by utilizing a Zigbee equipment firmware upgrading management protocol.
Further, in order to be able to provide the upgrade result to the device management server, the method further includes: and receiving an upgrade result request message sent by the equipment management server by using a remote equipment management protocol, and sending a response message to the equipment management server according to a query result.
Further, in order not to affect the normal operation of the Zigbee network after the firmware upgrade operation is performed when the Zigbee device fails to be upgraded, the method further includes: when the query result indicates that at least one Zigbee device fails to be upgraded, a firmware recovery command is sent to the Zigbee device failed to be upgraded by using a Zigbee device firmware upgrade management protocol, wherein the firmware recovery command is used for indicating the Zigbee device failed to be upgraded to recover and use the firmware before upgrading; or when the query result indicates that at least one Zigbee device fails to be upgraded, sending a firmware recovery command to all Zigbee devices performing the firmware upgrade operation by using the Zigbee device firmware upgrade management protocol, where the firmware recovery command is used to instruct to resume using the firmware before the upgrade.
Optionally, before sending the firmware recovery command to the Zigbee device, the remote device management protocol is used to send the upgrade result of the Zigbee device to which the firmware is applicable to the device management server, and receive a firmware recovery instruction sent by the device management server, where the firmware recovery instruction indicates that the Zigbee device that fails to be upgraded needs to perform the recovery operation, or all Zigbee devices that perform the firmware upgrade operation need to perform the recovery operation.
In the embodiment of the invention, the gateway determines the Zigbee equipment applicable to the firmware according to the equipment range indication information applicable to the firmware sent by the equipment management server, sends the firmware to the Zigbee equipment applicable to the firmware according to the firmware sending and upgrading indication information sent by the equipment management server, and controls the Zigbee equipment to execute the firmware upgrading operation, so that the equipment management server can control the Zigbee equipment to upgrade the firmware without supporting an SNMP protocol, and the Zigbee equipment is slightly changed.
It should be noted that, for convenience of description, in the following embodiments of the present invention, the firmware issued by the gateway to the Zigbee device is referred to as new firmware.
The invention improves through the gateway, so that the gateway itself serves as a DM/TR069 management client when facing a device management Server (such as a DM/TR069 Server) in an M2M service platform, and serves as an Upgrade Server (Zigbee OTA Upgrade Server) of Zigbee firmware when facing a managed Zigbee device in a Zigbee network. To implement the above functions, a tree Management Object (MO) structure model for Zigbee device firmware upgrade in a gateway is introduced as follows, as shown in fig. 4, where "/" is a root node of a Management tree in the gateway, each block represents an MO node or a child node thereof in the Management tree, and characters in the blocks are node names. Some node boxes are labeled with different symbols after the node name "? ", this means that there may be zero or one instance for the node; the symbol "", indicates that the node may have zero or more instances; no symbol indicates that a node may have and only has one instance; the symbol "+" indicates that the node may have one or more instances. The node name is named as "< x >" to indicate that the node name can be arbitrarily specified, but the node name needs to be ensured not to be repeated among a plurality of instances. It should be noted that fig. 4 does not show all nodes in the management tree, but only lists some node information related to the present invention.
The meaning of each MO node is introduced as follows:
1) the child nodes under the DevInfo node record the basic information of the gateway, wherein the DevId, Man and Mod record the equipment identifier, manufacturer identifier and model identifier of the gateway respectively;
2) the sub-nodes under the DevDetail node record the device details of the gateway itself, wherein devtype and FwV record the type of the gateway (such as the gateway in the Zigbee network) and the firmware version number, respectively;
3) sub-nodes under the GW node record some specific information of the gateway device, wherein one sub-node is a/DevList node, the node is used to record all Zigbee device information connected to the gateway, each Zigbee device information is represented by a < x > node, the < x > node includes DevInfo and DevDetail node, and the two nodes are used to record basic information and detailed information of each Zigbee device respectively. The remote equipment management server can know the basic information and the detailed information of all Zigbee equipment under the gateway by checking the-/GW/DevList node so as to judge whether the Zigbee equipment needs to be upgraded and how to upgrade the firmware of the Zigbee equipment under the gateway when the Zigbee equipment needs to be upgraded;
4) the sub-nodes under the zigbee Fw node are used for recording all firmware-related MO information required by firmware upgrade through the gateway, the MO information of each firmware is represented by an < x > node, and each < x > node comprises the following sub-nodes:
■ PkgName: the name of the firmware is recorded;
■ PkgVersion: the version number of the firmware is recorded;
■ ApplyTo: the method includes the steps of recording a range of Zigbee equipment suitable for firmware upgrading, describing filter conditions in the range by using a < x > child node, wherein each filter condition also comprises a plurality of child filter conditions, the < x > child node comprises a plurality of child nodes, each child node records a filter condition, and the filter conditions are in a phase-and operation relationship, and the specific filter conditions include:
● DevId: recording the type identification of the Zigbee equipment suitable for firmware upgrading;
● Man: recording manufacturer identification of the Zigbee equipment suitable for firmware upgrading;
● Mod: recording the model of the Zigbee equipment suitable for firmware upgrading;
● Max Version: recording the maximum version number of the current old firmware of the Zigbee equipment capable of being upgraded;
● Min Version: recording the minimum version number of the current old firmware of the Zigbee equipment capable of being upgraded; (ii) a
● Ext: the representation can also expand other filtering conditions, such as limiting that the upgraded Zigbee device needs to meet values of other parameters or attributes, and the like;
■ the child nodes under the Download node are used to record the firmware upgrade execution mode after downloading the firmware by indirect mode, and the child nodes under the Download node are respectively:
● PkgURL: recording an indirect download address of the firmware package;
● Operations: recording the firmware upgrading mode required to be executed after downloading the firmware, wherein the child nodes under the node comprise:
-Download: the node stores an executable command, and the command is to download the firmware package to the gateway according to the PkgURL, and the firmware distribution and upgrade are not executed for the moment;
-download distribution: the node stores an executable command, the command is distributed to Zigbee equipment meeting the filtering condition in the AplyTo node after downloading the firmware package to the gateway according to the PkgURL, and the firmware upgrade is not executed for the time;
-downloadupdate: the node stores an executable command, the command is distributed to Zigbee equipment which is recorded in an AplyTo node and meets the filtering condition after downloading the firmware package to the gateway according to the PkgURL, and a common upgrading process is immediately executed;
-downloadupscalesync: the node stores an executable command, the command is distributed to Zigbee equipment which is recorded in an AplyTo node and meets the filtering condition after downloading the firmware package to the gateway according to the PkgURL, and a synchronous upgrading process is executed;
-downloadupgradedsched: the node stores an executable command, the command is distributed to Zigbee equipment which is recorded in an AplyTo node and meets the filtering condition after downloading the firmware package to the gateway according to the PkgURL, and a timed upgrading process is executed;
and (2) Ext: indicating that other firmware upgrade implementations may also be extended;
■ child nodes under the deleted node are used to record the firmware upgrade execution mode after downloading the firmware by the direct mode, and include the following child nodes:
● PkgData: the system is used for storing firmware to be upgraded;
● Operations: recording the firmware upgrading mode required to be executed, wherein the node comprises the following child nodes:
-Distribute: the node stores an executable command, wherein the command is to distribute the downloaded firmware to Zigbee equipment which is recorded in the AplyTo node and meets the filtering condition, and the firmware upgrading is not executed temporarily;
-Upgrade: the node stores an executable command, wherein the command is to distribute the downloaded firmware package to Zigbee equipment which is recorded in the AplyTo node and meets the filtering condition, and immediately execute a common upgrading process;
-UpgradeSync: the node stores an executable command, wherein the command is to distribute the downloaded firmware package to Zigbee equipment which is recorded in the Applyto node and meets the filtering condition, and execute a synchronous upgrading process;
-UpgradeSched: the node stores an executable command, wherein the command is to distribute the downloaded firmware package to Zigbee equipment which is recorded in the Applyto node and meets the filtering condition, and execute a timed upgrading process;
-Ext: indicating that other firmware upgrade implementations may also be extended;
■ State node is used to record the result of firmware upgrade, including the following child nodes:
● Value: the firmware upgrading method is used for recording the firmware upgrading state, such as complete upgrading success, partial upgrading success, complete upgrading failure, and the like, and can also record the firmware downloading and distributing state;
● success ful Ljst: for recording all the distributed and successfully upgraded Zigbee device information,
each child node < x > corresponds to a distributed and successfully upgraded Zigbee device, and the child node < x > includes: a DevId child node for recording a unique identifier of the Zigbee device;
● FailedList: the method is used for recording all Zigbee equipment information failed in distribution or upgrade, each child node < x > of the Zigbee equipment failed in distribution or upgrade corresponds to one Zigbee equipment failed in distribution or upgrade, and the child node < x > comprises the following steps: a DevId child node for recording a unique identifier of the Zigbee device;
■ nodes below the Recover node are used to record how firmware version recovery should occur when a device firmware upgrade fails. The recovery node itself may be defined as an executable node to receive a firmware recovery operation instruction of the device management server, and the recovery node includes the following child nodes:
● Policy: the specific strategy for recording firmware version recovery at least comprises one of the following possible values:
-All: if the firmware of one device fails to be upgraded, all Zigbee devices (namely Zigbee devices which are recorded in the AplyTo node and meet the filtering condition) related to the firmware upgrade are restored to the firmware version before the firmware upgrade;
-Failed: if the firmware of the equipment fails to be upgraded, only the Zigbee equipment which fails to be upgraded is restored to the firmware version before being upgraded;
-None: any firmware version reply operation is not performed, and the subsequent operation instruction of the device management server is reported.
It should be noted that the above management tree model for Zigbee device firmware upgrade is only a typical example, where a specific node may change its relative position or name in the management tree in actual deployment (e.g., DevList may be directly connected below the root node./without going through the./GW node, and nodes for storing respective firmware information may also be directly connected below the root node./or other nodes). In addition, for a plurality of executable nodes which represent a plurality of upgrading modes and are defined under the nodes of < x >/Download/operation and < x >/deleted/operation, a single executable node can be matched with a plurality of related attribute node descriptions to distinguish different execution modes (similar to the design principle of the nodes of < x >/recovery).
Referring to fig. 5, an embodiment of the present invention provides a method for implementing remote upgrading of a Zigbee device, where a DM protocol is used between a device management server and a gateway, and the method specifically includes:
501. the Zigbee device determines the gateway in the local network that manages it.
Specifically, there may be two ways:
the first mode is as follows: the Zigbee device is configured with IEEE addresses of gateways in advance (each IEEE address uniquely identifies one gateway), the Zigbee device determines that the gateway identified by the IEEE address is a gateway for managing itself, and the Zigbee device may also send a Zigbee device object network address request ZDO Nwk _ addr _ req according to the IEEE address, and acquire a network address of the gateway from a received response message, so as to perform management information interaction with the gateway later using the network address.
The second mode is as follows: if the IEEE address of the gateway is not preconfigured in the Zigbee device, an object matching description request ZDO Match _ Desc _ req request is broadcast to the local network, where the object matching description request ZDO Match _ Desc _ req request carries a firmware upgrade Cluster identifier OTA Cluster ID, where the identifier indicates that a gateway supporting a Zigbee firmware upgrade function is searched, and after receiving the request, the gateway in the local network sends an object matching description response ZDO Match _ Desc _ rsp message to the Zigbee device, where the object matching description response ZDO Match _ Desc _ rsp message carries a network address of the gateway.
502. The gateway obtains detailed information of Zigbee devices using Zigbee device management commands in order to configure information on/GW./DevList nodes in the management tree as shown in fig. 4.
Specifically, the gateway sends a device information query request message to the Zigbee device, for example, a Zigbee device object Node description request ZDO Node _ Desc _ req, a Zigbee device object Simple description request ZDO Simple _ Desc _ req message, and the like, for requesting to acquire detailed information of the Zigbee device; the Zigbee device sends a response message to the gateway, where the response message carries device description information such as a manufacturer identifier, a device type, and the like of the Zigbee device. The gateway sends a Zigbee cluster library attribute reading ZCL Read _ Attributes request message to the Zigbee equipment, wherein the message carries a Current firmware version parameter to request to query the firmware version of the Zigbee equipment; the Zigbee device sends a response message to the gateway, where the response message carries the firmware version information of the Zigbee device.
503. The gateway configures the detailed information of the Zigbee devices into relevant nodes of the management tree, specifically, into DevList nodes under GW as in the MO management tree shown in fig. 4.
504. The gateway establishes a device management session with a device management server using a remote device management protocol.
Specifically, the gateway receives a device management notification message from a device management server, then establishes a device management session with the device management server, and provides basic information (/ information recorded in a devlnfo node) of the gateway itself to the device management server by replacing a Relplace command; the device management server obtains the detailed information of the gateway (./information recorded in a DevDetail node) and the information of all Zigbee devices connected to the gateway (./information recorded in a GW/DevList/node) by obtaining a Get command.
505. The device management server configures basic information of the new firmware and range description information of the Zigbee device to which the new firmware is applicable in a relevant node of the gateway management tree through a Replace command.
Specifically, a new firmware name is configured in the PkgName node, a version is configured in the pkversion node, and Zigbee device range description information to which the new firmware is applicable is configured in the ApplyTo.
506. And the equipment management server performs remote firmware upgrading operation on the Zigbee equipment through the gateway by using the established equipment management session.
Please refer to the detailed description of the following embodiments.
It should be noted that, since the remote device management protocol (DM/TR069) and the Zigbee protocol are not completely compatible in parameter naming and data type, in step 503, when the gateway configures the detailed information of the Zigbee device to the relevant node of the management tree, it needs to perform a conversion operation of parameter Name and data type, and table 1 lists a conversion mapping relationship of parameters that need to be supported by firmware upgrade, where a Uniform Resource Name (URN) is a specific string type with a specially defined format.
TABLE 1
Fig. 6 shows a manner in which the device management server implements remote upgrading of Zigbee devices through a gateway, that is, a common upgrading manner, where the common upgrading manner is that each Zigbee device is upgraded immediately after obtaining a new firmware, and is unrelated to the upgrading time of other Zigbee devices suitable for the new firmware, and specifically includes:
601. the equipment management server controls the gateway to download the new firmware and triggers the gateway to execute an executable command which represents that the firmware is distributed on the nodes in the management tree and the Zigbee equipment is immediately upgraded after the distribution.
In steps 501 to 504 in the above embodiment, the gateway configures information of Zigbee devices managed by the gateway, and the device management server establishes a management session for remote firmware upgrade of Zigbee devices through the gateway, and configures basic information of a new firmware and a Zigbee device range to which the new firmware upgrade is applicable in the gateway. In this step, the device management server may determine to remotely upgrade the Zigbee device in a normal upgrade manner according to the Zigbee device information under the gateway and the influence of the new firmware on the current Zigbee network and application.
The steps specifically comprise the following implementation modes:
the first mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in a direct downloading mode. The device management server directly writes the new firmware into a Zigbee Fw/< x >/deleted/PkgData node of the gateway through a Replace command, and triggers the gateway to execute an executable command on the Zigbee Fw/< x >/deleted/Operations/Updrade node.
The second mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in an indirect downloading mode. The equipment management server directly writes the Download address of the new firmware into a ZigbeFw/< x >/Download/PkgURL node of the gateway management tree through a Replace command; the device management server instructs the gateway to Download the new firmware from the Download address by triggering the gateway to execute an executable command on the Zigbee fw/< x >/Download/Operations/Download update node, and then immediately executes a firmware upgrade operation on the Zigbee device to which the new firmware is applicable, wherein the gateway may Download the new firmware from the Download address on the Zigbee fw/< x >/Download/PkgURL node by using a file transfer protocol or other Download protocols.
The third mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in an indirect downloading mode. The equipment management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway through a Replace command; the equipment management server instructs the gateway to Download the new firmware by triggering the gateway to execute an executable command on a Zigbee Fw/< x >/Download/Operations/Download node; the gateway downloads the new firmware from a Download address on a Zigbee Fw/x/Download/PkgURL node by adopting a file transfer protocol or other Download protocols, and reports the success of downloading the new firmware to the equipment management server; the device management server instructs the gateway to immediately execute firmware upgrading operation on the Zigbee device suitable for the new firmware by triggering the gateway to execute the executable command on the Zigbee Fw/< x >/deleted/Operations/Updide node.
602. The gateway executes an executable command which indicates that the firmware is distributed on the nodes in the management tree and immediately upgrades the Zigbee equipment after the firmware is distributed, and distributes the new firmware to the Zigbee equipment which is suitable for the new firmware by adopting the existing Zigbee firmware downloading technology according to the Zigbee equipment range description information which is recorded by the nodes in the management tree and is suitable for upgrading the new firmware and the information of each Zigbee equipment managed by the gateway.
Specifically, the gateway may send an Image notification Image Notify message to all Zigbee devices by using a broadcast message, where the Image notification message carries application range description information of the new firmware, and the method specifically includes: and at least one of an applicable Zigbee device model and a device manufacturer identifier of the new firmware. If the equipment management server writes the type identifier of the Zigbee equipment suitable for firmware upgrade, the maximum version number of the current old firmware of the Zigbee equipment capable of upgrading, or the minimum version number of the current old firmware of the Zigbee equipment capable of upgrading, because the Image Notify message itself cannot carry the above information, the gateway determines the Zigbee equipment suitable for new firmware according to the information of each Zigbee equipment stored on the management tree node, and sends the Image Notify message to the determined Zigbee equipment in a unicast manner, where the Image Notify message is used to Notify the Zigbee equipment to download new firmware. In this step, when sending the Image Notify message to the Zigbee device by using a broadcast message or a unicast message, the conversion operation of the parameter name and the data type needs to be performed with reference to table 1, which is not described herein again.
After receiving the Image Notify message, the Zigbee device determines whether the Zigbee device needs to perform firmware upgrade according to whether the Zigbee device is a unicast message or not and according to the application range description information of the new firmware carried in the Image Notify message when the Zigbee device is not a unicast message, and if the Zigbee device is not a unicast message, sends a Query Next Image Request to the gateway to Request to acquire the new firmware, where the message carries information such as the device model of the Zigbee device (i.e., information stored on the mod node in the management tree), the device manufacturer identifier (i.e., information stored on the man node in the management tree), and the current firmware version number. The gateway sends the size of the new firmware and the size of the downloaded blocks to the Zigbee equipment, and the Zigbee equipment downloads the new firmware from the gateway according to the size of the new firmware and the size of the downloaded blocks.
603. The gateway instructs the Zigbee device to immediately perform a firmware upgrade.
Specifically, the gateway sends an Upgrade End Response message to each Zigbee device that has successfully downloaded the new firmware, where the Upgrade End Response message carries a parameter indicating that the Zigbee device immediately upgrades the new firmware.
Fig. 7 shows a manner in which the device management server implements remote upgrading of Zigbee devices through a gateway, that is, a manner of controlling synchronous upgrading of Zigbee devices, specifically including:
701. the equipment management server controls the gateway to download the new firmware and triggers the gateway to execute an executable command which represents the distribution of the firmware on the nodes in the management tree and synchronously updates the Zigbee equipment after the distribution.
The executable command is an indication indicating that firmware distribution and synchronous firmware upgrade are performed after all Zigbee devices successfully download new firmware.
In this step, the device management server determines, according to the Zigbee device information under the gateway and the influence of the new firmware on the current Zigbee network and application, that the firmware upgrade process of each Zigbee device may affect each other on communication or application of the Zigbee local network, so that each Zigbee device needs to perform upgrade at the same time, and thus it is determined that the Zigbee device under the gateway is remotely upgraded in a synchronous upgrade manner.
The steps specifically comprise the following implementation modes:
the first mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in a direct downloading mode. The equipment management server directly writes the new firmware into a Zigbee Fw/< x >/Delivered/PkgData node of the gateway through a Replace command, triggers the gateway to execute an executable command on the Zigbee Fw/< x >/Delivered/Operations/UpdegraSync node, and instructs the gateway to control the Zigbee equipment suitable for the new firmware to synchronously execute firmware upgrading operation.
The second mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in an indirect downloading mode. The equipment management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway through a Replace command; the device management server instructs the gateway to Download the new firmware from the Download address by triggering the gateway to execute the executable command on the Zigbee Fw/< x >/Download/Operations/Download upgrade Sync node, and then immediately controls the Zigbee device to which the new firmware is applicable to execute the synchronous upgrade operation. The gateway may Download the new firmware from a Download address on the zigbee fw/< x >/Download/pkggurl node using a file transfer protocol or other Download protocols.
The third mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in an indirect downloading mode. The equipment management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway MO through a Replace command; the equipment management server instructs the gateway to Download the new firmware by triggering the gateway to execute an executable command on a Zigbee Fw/< x >/Download/Operations/Download node; the gateway downloads the new firmware from a Download address on a Zigbee Fw/x/Download/PkgURL node by adopting a file transfer protocol or other Download protocols, and reports the success of downloading the new firmware to the equipment management server; the device management server instructs the gateway to control the Zigbee device to which the new firmware is applicable to synchronously execute firmware upgrading operation by triggering the gateway to execute the executable command on the Zigbee Fw/< x >/deleted/Operations/Updegrasync node.
702. The gateway executes an executable command which represents that the firmware is distributed on the nodes in the management tree and synchronously upgrades the Zigbee equipment after the distribution, and distributes the new firmware to the Zigbee equipment which is suitable for the new firmware by adopting the existing Zigbee firmware downloading technology according to the Zigbee equipment range description information which is recorded by the nodes in the management tree and is suitable for upgrading the new firmware and the information of each Zigbee equipment managed by the gateway.
703. The gateway instructs the Zigbee device to perform a synchronous firmware upgrade.
Specifically, the gateway sends an Upgrade End Response message to each Zigbee device that is suitable for the new firmware, where the Upgrade message carries information indicating that the Zigbee device does not perform the firmware Upgrade operation temporarily; the gateway sends a ZCL Read _ Attributes message to each Zigbee device which is suitable for new firmware so as to obtain a new firmware downloading state of each Zigbee device, and after determining that all Zigbee devices successfully download the new firmware, the gateway simultaneously sends a Run Updide Request message to each Zigbee device, wherein the RunUpdide Request message carries a parameter indicating that the Zigbee devices are immediately upgraded to the new firmware.
Currently, a certain Zigbee device suitable for new firmware is in a dormant state, and cannot receive and execute a related Upgrade command, so in this step, the gateway selects a time when all Zigbee devices suitable for new firmware are in an active state according to locally recorded information of each Zigbee device suitable for new firmware, and sends Run update Request messages to the Zigbee devices in the active state, where the time carries indication information indicating that firmware Upgrade is performed at the selected time point; or, the gateway selects a time point, and sends, to the Zigbee device when the Zigbee device is in the active state, indication information indicating that firmware upgrade is performed at the selected time point, and if the Zigbee device is in the dormant state at the selected time point, the Zigbee device adjusts the dormant time to ensure that the Zigbee device is in the active state at the time point, and a subsequent execution process is the same as step 803 in the embodiment shown in fig. 8.
Fig. 8 shows a manner in which the device management server implements remote upgrading of a Zigbee device through a gateway, that is, a manner of controlling a Zigbee device to be upgraded at a fixed time specifically includes:
801. the equipment management server controls the gateway to download the new firmware and triggers the gateway to execute an executable command which represents that the firmware is distributed on a node in the management tree and the Zigbee equipment is upgraded at a preset upgrading time after the firmware is distributed.
The steps specifically comprise the following implementation modes:
the first mode is as follows: the method is suitable for directly downloading new firmware to a gateway by an equipment management server, the equipment management server directly writes the new firmware into a Zigbee Fw/< x >/Delivered/PkgData node in a management tree of the gateway through a Replace command, writes preset upgrading time into a Zigbee Fw/< x >/Delivered/Operations/updated/UTCTime node, or writes a relative current time offset into the Zigbee Fw/< x >/Delivered/Operations/updated/offset time node, and the equipment management server triggers the gateway to execute an executable command on the Zigbee Fw/< x >/Delivered/Operations/updated node.
The second mode is as follows: the method is suitable for the device management server to indirectly download the new firmware to the gateway. The device management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway through a Replace command, writes the preset upgrade time into a Zigbee Fw/< x >/Download/Operations/Download Updgraschded/UTCTime node, or writes an executable command on the Zigbee Fw/< x >/Download/Operations/Download Updgraschded/Offsetime node relative to the current time offset, instructs the gateway to adopt a file transfer protocol or other Download protocols by triggering the gateway to execute the executable command on the Zigbee Fw/< x >/Download/Operations/Download Updgraschded node, downloads the new firmware from the Download address on the Zigbee Fw/x >/delete/PkgURL node, and then controls the specific upgrade operation of the new firmware to be executed at the applicable time.
The third mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in an indirect downloading mode. The equipment management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway through a Replace command, and writes the preset upgrade time into a Zigbee Fw/< x >/deleted/Operations/updated/UTCTime node, or writes the time offset relative to the current into the Zigbee Fw/< x >/deleted/Operations/updated/offset time node; the equipment management server instructs the gateway to Download the new firmware by triggering the gateway to execute an executable command on a Zigbee Fw/< x >/Download/Operations/Download node; the gateway downloads the new firmware from the Download address on the zigbee fw/< x >/Download/pkggurl node by adopting a file transfer protocol or other Download protocols, and reports the success of downloading the new firmware to the device management server. The device management server triggers the gateway to execute the executable command on the Zigbee fw/< x >/deleted/Operations/upgrade scheduled node, so that the gateway controls the Zigbee device suitable for the new firmware to execute the firmware upgrade operation at the specific upgrade time.
802. And the gateway executes an executable command which indicates that the firmware is distributed on the nodes in the management tree and the Zigbee equipment is upgraded in the preset upgrading time after the firmware is distributed, and distributes the new firmware to the Zigbee equipment suitable for the new firmware by adopting the existing Zigbee firmware downloading technology according to the Zigbee equipment range description information which is recorded by the nodes in the management tree and suitable for upgrading of the new firmware and the information of each Zigbee equipment managed by the gateway.
803. The gateway instructs the Zigbee device to perform firmware upgrade at a predetermined upgrade time.
The steps are concretely realized in the following ways:
the first mode is as follows: the gateway sends an Upgrade EndResponse message to each Zigbee device suitable for the new firmware, wherein the Upgrade time parameter carries an Upgrade time parameter, and the Upgrade time parameter indicates the specific time of the Zigbee device for firmware Upgrade, which can be an absolute time value or a relative current time value, and does not influence the implementation of the invention.
The second mode is as follows: the gateway sends an Upgrade EndResponse message to each Zigbee device applicable to the new firmware, wherein the Upgrade message carries information indicating that the Zigbee device does not execute the firmware upgrading operation temporarily; the gateway sends a Zigbee cluster library attribute reading ZCLRead _ Attributes message to each Zigbee device needing to be upgraded so as to obtain a new firmware downloading state of each Zigbee device, and after all the Zigbee devices needing to be upgraded are determined to successfully download new firmware, a Run Updide Request message is sent to all the Zigbee devices needing to be upgraded, wherein the update time parameter is carried.
Fig. 9 illustrates a manner in which the device management server implements remote upgrading of Zigbee devices through a gateway, where the manner is to distribute new firmware to the Zigbee devices first, and then trigger the Zigbee devices to control each Zigbee device to perform firmware upgrading in a normal upgrading manner, a synchronous upgrading manner, or a timing upgrading manner, and the method specifically includes:
901. the device management server downloads the new firmware to the gateway and triggers an executable command on the gateway indicating the distribution of the new firmware.
The steps are concretely realized in the following ways:
the first mode is as follows: the method is suitable for the device management server to download the new firmware to the gateway in a direct downloading mode. The device management server directly writes the new firmware into a Zigbee Fw/< x >/deleted/PkgData node of the MO of the gateway through a Replace command, triggers the gateway to execute an executable command on the Zigbee Fw/< x >/deleted/Operations/distribution node, and instructs the gateway to execute firmware distribution operation on the Zigbee device suitable for the new firmware.
The second mode is as follows: the device management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway management tree through a Replace command, instructs the gateway to Download the new firmware from the Download address by triggering the gateway to execute an executable command on the Zigbee Fw/< x >/Download/Operations/Download distribution node, and immediately distributes the new firmware to Zigbee devices which are applicable to the new firmware.
The third mode is as follows: the equipment management server directly writes the Download address of the new firmware into a Zigbee Fw/< x >/Download/PkgURL node of the gateway through a Replace command, and instructs the gateway to Download the new firmware by triggering the gateway to execute an executable command on the Zigbee Fw/< x >/Download/operation/Download node; the gateway downloads the new firmware from a Download address on a Zigbee Fw/x/Download/PkgURL node by adopting a file transfer protocol or other Download protocols, and reports the success of downloading the new firmware to the equipment management server; the device management server instructs the gateway to Distribute the new firmware to the Zigbee device applying the new firmware by triggering the gateway to execute the executable command on the Zigbee fw/< x >/deleted/Operations/distribution node.
902. The gateway executes an executable command which indicates that the new firmware is distributed on the node in the management tree, and distributes the new firmware to the Zigbee equipment which is suitable for the new firmware by adopting the existing Zigbee firmware downloading technology according to the Zigbee equipment range description information which is suitable for upgrading and is recorded by the node in the management tree and the information of each Zigbee equipment managed by the gateway.
903. The gateway sends a message indicating that the firmware upgrade operation is not executed for a while to each Zigbee device to which the new firmware is applicable.
Specifically, the gateway sends an Upgrade End Response message to each Zigbee device that is suitable for new firmware, where the Upgrade message carries information indicating that the Zigbee device does not perform firmware Upgrade operation temporarily.
904. The gateway queries each Zigbee device that is suitable for the new firmware download status.
Specifically, the gateway sends a ZCL Read _ Attributes message to each Zigbee device that is suitable for new firmware, and requests to obtain a new firmware download state of each Zigbee device.
905. The gateway reports the distribution condition of the new firmware, that is, the firmware download result of the Zigbee device to which the new firmware is applicable, to the device management server according to the new firmware download state of each Zigbee device.
Specifically, the distribution of the new firmware is reported to the device management server by sending an Alert command.
906. And the equipment management server determines a firmware upgrading mode of the Zigbee equipment according to the distribution condition of the new firmware and the influence of the new firmware on the Zigbee equipment and the network, and triggers the gateway to execute an executable command of the determined firmware upgrading mode on the node in the management tree.
The equipment management server determines whether the Zigbee equipment needs to be upgraded according to the distribution condition of the new firmware, and then determines the specific firmware upgrading mode of the Zigbee equipment according to the distribution condition of the new firmware and the influence of the new firmware on the Zigbee equipment and the network.
The firmware upgrading mode of the Zigbee device determined in this step may be a common upgrading mode, and at this time, the device management server triggers an executable command on the gateway indicating that the Zigbee device is upgraded immediately after the firmware is distributed; the determined firmware upgrading mode of the Zigbee equipment can be a synchronous upgrading mode, and at the moment, the equipment management server triggers an executable command which represents synchronous upgrading of the Zigbee equipment after firmware is distributed on the gateway; the determined firmware upgrading mode of the Zigbee device may be a timing upgrading mode, and at this time, the device management server triggers an executable command on the gateway indicating that the Zigbee device upgrades at a predetermined upgrading time after the firmware is distributed.
Optionally, the device management server may re-determine a range of the Zigbee device to which the new firmware is applicable according to a distribution condition of the new firmware and an influence of the new firmware on the Zigbee device and the network, and re-notify the gateway, and the subsequent gateway executes the executable command under the trigger of the device management server, and sends a message indicating upgrading to the re-determined Zigbee device to which the new component is applicable.
It should be noted that, in step 505 of the foregoing embodiment, the device management server may further configure, through a Replace command, a firmware recovery Policy when the Zigbee device fails to be upgraded on a < x >/recovery/Policy node of the management tree, specifically, may be configured as "All" or "Failed", or may be configured as "None", where when configured as "None", it indicates that a specific firmware recovery Policy is not currently configured, and it is necessary for the gateway to send upgrade result information to the device management server, and the device management server reconfigures the specific firmware recovery Policy according to the upgrade result information, and after the Zigbee device that is applicable to the new firmware performs the upgrade operation, the method further includes:
1001. the gateway acquires an upgrading result of the Zigbee equipment.
Specifically, the gateway may send a Zigbee cluster library attribute read ZCLRead _ Attributes request message to the Zigbee device, where the Zigbee cluster library attribute read ZCLRead _ Attributes request message carries a currentfirmware version parameter indicating that the gateway requests to acquire a latest firmware version number of the Zigbee device, and the Zigbee device sends a response message carrying the latest firmware version number of the Zigbee device to the gateway, and the gateway may determine whether the Zigbee device is successfully upgraded according to the latest firmware version number, and record Zigbee fw/< x >/State/successful list and/or Zigbee fw/< x >/State/fault list according to a determination result, or immediately update Zigbee device version information under GW/DevList/node.
1002. When the Policy node is None, it indicates that there is no firmware recovery Policy currently, and the gateway reports an upgrade result of the Zigbee device to the device management server through an Alert command, where the upgrade result status information is carried, and the upgrade result status information may indicate that all/part of the Zigbee device succeeds, all/part of the Zigbee device fails, and the like. When the Policy node is configured as "All" or "Failed", step 1006 is performed.
1003. The device management server obtains the detailed upgrade status information under the zigbee fw/< x >/State node (for example, obtains the information recorded on the zigbee fw/< x >/State/Value, and/or < x >/State/FailedList, and/or zigbee fw/< x >/State/success list node) from the gateway management tree through the Get command.
Optionally, if the gateway updates the firmware version information of the Zigbee device under the te/GW/DevList/node in time, the device management server may also obtain the update result by reading the firmware version information under the te/GW/DevList/node.
1004. The equipment management server reconfigures the firmware recovery strategy to be All or Failed according to the acquired detailed upgrading state information through the Replace command at the < x >/Recover/Policy node in the gateway management tree.
Specifically, the firmware recovery policy may be reconfigured to be All or Failed according to the acquired detailed upgrade status information and a policy preset by the device management server, or may be reconfigured to be All or Failed according to an operation instruction of an administrator.
1005. The device management server triggers an executable command on the < x >/recovery node in the gateway.
1006. The gateway executes an executable command on the < x >/recovery node, when a firmware recovery Policy on the < x >/recovery/Policy node is All, a firmware recovery command is sent to All Zigbee equipment suitable for the new firmware, and when the firmware recovery Policy is Failed, a firmware recovery command is sent to Zigbee equipment Failed in upgrade, wherein the firmware recovery command is used for indicating the Zigbee equipment to Recover and use the firmware before upgrade.
1007. The gateway queries the current version number of the Zigbee device receiving the firmware recovery command, and determines whether the Zigbee device has recovered to the version before the upgrade.
Specifically, the process of querying a current version number of the Zigbee device that receives the firmware recovery command includes: the gateway may send a ZCL Read _ Attributes request message to the Zigbee device, where the ZCL Read _ Attributes request message carries a currentfirmware version parameter, where the parameter indicates that the gateway requests to acquire the latest firmware version number of the Zigbee device, and the Zigbee device sends a response message carrying the latest firmware version number of the Zigbee device to the gateway.
1008. The gateway sends a firmware recovery result to the device management server through the Alert command, where the firmware recovery result may be that each Zigbee device is successfully recovered, or that a Zigbee device that fails to be upgraded has been successfully recovered.
1009. And the equipment management server sends an equipment management termination command Final to the gateway and ends the equipment management session.
The above embodiments are described with the DM protocol used between the device management server and the gateway, and the TR069 protocol may also be used between the device management server and the gateway. The TR069 protocol and the DM protocol have great similarities in the interaction mechanism between the device management server and the gateway and the design of the data structure of the management tree, and implement the function of remote device management by establishing a remote device management session between the device management server and the gateway and operating the data of the nodes in the gateway management tree in the session, and the main differences are as follows: nodes in the TR069 protocol have no executable property, that is, the gateway cannot be instructed to execute corresponding Operations by triggering an executable command on a certain node (such as zigbee fw/< x >/Download/Operations/Download). In order to instruct the gateway to perform corresponding operations, the TR069 protocol carries a series of dedicated device management commands (e.g., Download, rebot.) in the device management message or encapsulates them in a new firmware file downloaded by the gateway. Fig. 11 is a structure of a downloaded file supported by the TR069 protocol, where when the file is used to encapsulate a new firmware to be upgraded, a device management command list related to the file may carry a series of descriptions and commands related to device firmware upgrade, where the descriptions and commands include file usage, firmware version information, an applicable device version range, and the like, and the new firmware file may be expanded to further include a Zigbee device range command applicable to the new firmware, a new firmware upgrade mode command, and the like.
Referring to fig. 12, an embodiment of the present invention provides a method for implementing remote upgrading of a Zigbee device, in the method, a TR069 protocol is used between a device management server and a gateway, and the method specifically includes:
1201-1203 are the same as 501-503.
1204. The gateway establishes a device management session with the device management server using the TR069 protocol.
Specifically, the device management server sends a device management notification message ConnectionRequest to the gateway, the gateway establishes a device management session with the device management server according to the message, and provides basic device information of the gateway through a DeviceId parameter in an Inform command, wherein the basic device information specifically includes information such as a Manufacturer identifier (Manufacturer), a device identifier (SerialNumber), a device model (ProductClass), and the like; the device management server may further obtain detailed device information of the gateway (./information on DevDetail node) and information on all Zigbee device managed by the gateway (./information on GW/DevList node) through a get parameter value GetParameterValues command.
Optionally, the gateway may also actively provide the device management server with the basic device information and the detailed device information of the gateway itself.
1205. The device management server configures new firmware information on the zigbee fw/< x > node in the gateway by setting the parameter value SetParameterValues command.
If a zigbee fw/< x > node has not been created in the gateway, the device management server may create the node by adding an object AddObject command.
1206. The method comprises the steps that a device management server downloads a new firmware file to a gateway by adopting a TR069 protocol, the new firmware file carries a Zigbee device firmware upgrading management command, and the Zigbee device firmware upgrading management command is written in by the device management server in advance.
Specifically, the method comprises the following steps: the device management server instructs the gateway to Download the new firmware file from a specified address (URL) by a Download command; the gateway downloads a new firmware file from the specified address, the new firmware file comprising: the Zigbee equipment firmware upgrading management command comprises a new firmware upgrading mode command, a Zigbee equipment range command applicable to the new firmware, a firmware recovery strategy command when upgrading fails and the like, wherein the new firmware upgrading mode command is a command for indicating that the Zigbee equipment is immediately upgraded after firmware is distributed and distributed, or a command for indicating that the firmware is distributed and all Zigbee equipment successfully downloads the new firmware and then synchronously executes firmware upgrading, or a command for indicating that the Zigbee equipment is upgraded at a preset upgrading time after the firmware is distributed and distributed.
1207. And the gateway downloads the new firmware to each Zigbee device suitable for the new firmware by using a Zigbee device firmware upgrading management command, and indicates each Zigbee device suitable for the new firmware to upgrade the firmware.
Wherein, a common upgrading mode, a synchronous upgrading mode and a timing upgrading mode can be adopted.
1208. The gateway acquires an upgrading result of the Zigbee equipment.
1209. When the firmware recovery policy command carried in the new firmware file indicates "None", the gateway reports the upgrade result of the Zigbee device to the device management server, where the upgrade result status information is carried, and the upgrade result status information may indicate that all/part of the Zigbee device succeeds, all/part of the Zigbee device fails, and the like. When the firmware recovery policy carried in the new firmware file indicates "All" or "Failed", step 1212 is executed.
1210. The device management server obtains the detailed upgrade status information under the zigbee fw/< x >/State node (for example, obtains the information recorded on the zigbee fw/< x >/State/Value, and/or < x >/State/FailedList, and/or zigbee fw/< x >/State/success list node) from the gateway management tree through the Get Parameter Value command.
1211. And the equipment management server sends a recovery command to the gateway according to the acquired detailed upgrade state information, wherein the command carries a firmware recovery strategy instruction, and the firmware recovery strategy instruction in the command is 'All' or 'Failed'.
1212. And the gateway sends a firmware recovery command to all Zigbee equipment applicable to the new firmware or Zigbee equipment failed in upgrading according to the firmware recovery strategy indication.
1213. The gateway inquires the current version number of the Zigbee equipment receiving the firmware recovery command, determines whether the version is recovered to the version before upgrading, and updates the information on the Zigbee Fw/< x >/State/Value node according to the determination result.
The specific implementation manner is the same as step 1007, and is not described herein again.
1214. The gateway sends a firmware recovery result to the device management server through a transport complete command, where the firmware recovery result may be that each Zigbee device is successfully recovered, or that a Zigbee device that fails to be upgraded has been successfully recovered.
1215. The device management server sends a device management termination command to the gateway, and ends the device management session.
In the embodiment, the device management command is extended in the new firmware file downloaded by the gateway, or the gateway can be notified by adopting a special device management command without extending the new firmware file, so that the implementation of the invention is not influenced.
Referring to fig. 13, an embodiment of the present invention provides a gateway, which includes:
a remote management information interaction unit 10, configured to receive, by using a remote device management protocol, a firmware download instruction sent by a device management server, device range indication information applicable to the firmware, and firmware issuing and upgrading indication information;
the device range indication information to which the firmware is applicable includes: at least one of an identifier of the Zigbee device to which the firmware is applicable, an identifier of a Zigbee device manufacturer to which the firmware is applicable, an identifier of a Zigbee device category to which the firmware is applicable, and firmware version range indication information currently used by the Zigbee device that can be upgraded to the obtained firmware.
A firmware obtaining unit 20, configured to obtain a firmware according to the firmware downloading instruction; specifically, if the firmware downloading instruction may carry the firmware, the firmware obtaining unit 20 directly obtains the firmware from the firmware downloading instruction, or if the firmware downloading instruction carries the downloading address of the firmware, the firmware obtaining unit 20 downloads the firmware according to the downloading address of the firmware.
An upgrading unit 30, configured to issue the acquired firmware to a Zigbee device to which the firmware is applicable by using a Zigbee device firmware upgrade management protocol according to the firmware issuing and upgrading indication information and the device range indication information to which the firmware is applicable, and control the Zigbee device to which the firmware is applicable to execute a firmware upgrade operation.
Further, in order to make the device management server know the upgrade result, the gateway further includes:
the query unit 40 is configured to query an upgrade result to a Zigbee device that performs a firmware upgrade operation.
Further, in order to provide the upgrade result to the device management server, the remote management information interaction unit 20 is further configured to receive an upgrade result request message sent by the device management server, and send a response message to the device management server according to the query result.
Further, in order not to affect the normal operation of the Zigbee network after the firmware upgrade operation is performed when the Zigbee device fails to be upgraded, the method further includes: a restoring unit 50, configured to, when the query result indicates that at least one Zigbee device fails to be upgraded, send a firmware restoring command to the Zigbee device that fails to be upgraded using the Zigbee device firmware upgrade management protocol, or send a firmware restoring command to all Zigbee devices that perform the firmware upgrade operation, where the firmware restoring command is used to instruct to restore to use the firmware before upgrading.
Optionally, the remote management information interaction unit 20 is further configured to receive, by using a remote device management protocol, a firmware recovery instruction sent by the device management server, where the firmware recovery instruction is sent by the device management server when it determines that the upgrade of at least one Zigbee device fails according to the received upgrade result; the firmware recovery indication indicates that the Zigbee device that fails to perform the upgrade needs to perform the recovery operation or indicates that all Zigbee devices that perform the firmware upgrade need to perform the recovery operation.
The firmware issuing and upgrading indication information indicates that each Zigbee device suitable for the firmware successfully downloads the firmware and immediately executes firmware upgrading operation; at this time, the upgrade unit 30 includes: a firmware issuing unit 301, configured to instruct, by using a Zigbee device firmware upgrade management protocol, a Zigbee device to which the firmware is applicable to download the acquired firmware; a determining unit 302, configured to determine whether the Zigbee device to which the firmware is applicable has successfully downloaded the firmware; a first upgrade instruction sending unit 303, configured to send instruction information of immediate upgrade to a Zigbee device that has been successfully downloaded. The firmware issuing and upgrading indication information is an indication for triggering an executable command which is used for indicating that the Zigbee equipment is upgraded immediately after firmware distribution and distribution on the execution gateway; or the firmware issuing and upgrading indication information includes an indication for triggering an executable command for indicating firmware distribution on the execution gateway, and an indication for triggering an executable command for indicating that the Zigbee device is upgraded immediately after firmware distribution on the execution gateway, which is received after reporting the firmware downloading state of the Zigbee device to which the firmware is applicable to the device management server; or, the firmware issuing and upgrading instruction information is a command for acquiring a firmware file sent from the device management server to instruct the Zigbee device to immediately upgrade after the firmware is distributed.
Or the firmware issuing and upgrading indication information indicates that the firmware upgrading operation is synchronously executed after all Zigbee equipment applicable to the firmware successfully downloads the firmware; at this time, the upgrade unit 30 includes: a firmware issuing unit 301, configured to instruct, by using a Zigbee device firmware upgrade management protocol, a Zigbee device to which the firmware is applicable to download the acquired firmware; a download result determining unit 304, configured to determine whether each Zigbee device to which the firmware is applicable has successfully downloaded the firmware; a second upgrade instruction sending unit 306, configured to send instruction information for immediate upgrade to all Zigbee devices to which the firmware is applicable when the determination result of the download result determining unit is yes; or, selecting a time point, and respectively sending indication information indicating that firmware upgrade is performed at the selected time point to all Zigbee devices to which the firmware is applicable; further, the upgrade unit 30 may further include: a device status determining unit 305, configured to determine whether each Zigbee device to which the firmware is applicable is in an active state; the second upgrade instruction sending unit 306 is specifically configured to send instruction information for immediate upgrade to all Zigbee devices to which the firmware is applicable when the determination result of the download result determining unit is yes and the device state determining unit is yes; and when the judgment result of the download result judgment unit is yes and the equipment state judgment unit is no, selecting a time point at which all Zigbee equipment applicable to the firmware is in an activated state, and respectively sending indication information indicating that firmware upgrading is performed at the selected time point to all Zigbee equipment applicable to the firmware. The firmware issuing and upgrading indication information is an indication of an executable command which triggers the execution gateway to represent firmware distribution and immediately execute firmware upgrading after all Zigbee equipment successfully downloads the firmware; or the firmware issuing and upgrading indication information includes an indication for triggering an executable command for indicating firmware distribution on the execution gateway, and an indication for triggering an executable command for indicating that all Zigbee devices download the firmware successfully and immediately execute firmware upgrading on the execution gateway, which is received after reporting the firmware downloading state of the Zigbee devices suitable for the firmware to the device management server; or, the firmware issuing and upgrading instruction information is a command for acquiring, from a firmware file sent by the device management server, an instruction for instructing firmware distribution and immediately executing firmware upgrading after all Zigbee devices successfully download the firmware.
Or, the firmware issuing and upgrading indication information indicates that each Zigbee device to which the firmware is applicable successfully downloads the firmware and then executes firmware upgrading operation at a predetermined upgrading time; at this time, the upgrade unit includes: a firmware issuing unit 301, configured to instruct, by using a Zigbee device firmware upgrade management protocol, a Zigbee device to which the firmware is applicable to download the acquired firmware; a third upgrade instruction sending unit 307, configured to send instruction information instructing to perform firmware upgrade at the predetermined upgrade time to all Zigbee devices to which the firmware is applicable. The firmware issuing and upgrading indication information comprises: the time parameter represents the preset upgrading time, and the instruction is used for triggering an executable command which represents that the Zigbee equipment carries out upgrading in the preset upgrading time and is arranged on the execution gateway; or, the firmware issuing and upgrading indication information includes: triggering an instruction for executing an executable command which indicates that the firmware is distributed on the gateway, reporting a time parameter which indicates the preset upgrading time and is received after a firmware downloading state of the Zigbee equipment which is suitable for the firmware is reported to the equipment management server, and triggering an instruction for executing an executable command which indicates that the Zigbee equipment is upgraded at the preset upgrading time after the firmware is distributed on the gateway; or, the firmware issuing and upgrading indication information includes: and acquiring a command for indicating firmware distribution and upgrading the distributed Zigbee equipment at a preset upgrading time from a firmware file sent by the equipment management server.
Referring to fig. 14A, the firmware issuing unit 301 specifically includes:
an application range determining unit 3011, configured to determine, according to the device range indication information to which the firmware is applicable and the acquired information of each Zigbee device, a Zigbee device to which the firmware is applicable; and a first notification message issuing unit 3012, configured to send, by using a Zigbee device firmware upgrade management protocol, a notification message to a Zigbee device to which the firmware is applicable in a unicast manner, so as to notify the Zigbee device to which the firmware is applicable to download the firmware; and a downloading unit 3013, configured to download the firmware to a Zigbee device that receives the notification message;
alternatively, referring to fig. 14B, the firmware issuing unit 301 specifically includes: a second notification message issuing unit 3014, configured to issue a notification message to each Zigbee device in a broadcast manner according to the acquired information of each Zigbee device and by using a Zigbee device firmware upgrade management protocol, where the notification message carries information of a Zigbee device to which the firmware is applicable, where the information of the Zigbee device to which the firmware is applicable includes: at least one of a manufacturer identifier and a category identifier of the Zigbee device to which the firmware is applicable; and a downloading unit 3013, configured to download the firmware to a Zigbee device requesting the firmware, where the Zigbee device requesting the firmware determines that it can apply the firmware according to the notification message.
In order to obtain information of each Zigbee device managed by the gateway, the gateway further includes: a Zigbee device information obtaining unit 60 is configured to obtain information of a corresponding Zigbee device from each Zigbee device managed by the Zigbee device firmware upgrade management protocol.
The firmware issuing and upgrading indication information comprises: the firmware issues indication information and upgrading indication information; the remote management information interaction unit 10 is specifically configured to send a firmware download result of the Zigbee device to which the firmware is applicable to an equipment management server, and receive upgrade indication information sent by the equipment management server, where the upgrade indication information is sent when the equipment management server determines that the upgrade indication information needs to be sent according to the firmware download result of the Zigbee device to which the firmware is applicable.
In the embodiment of the invention, the gateway determines the Zigbee equipment applicable to the new firmware according to the equipment range indication information applicable to the new firmware sent by the equipment management server, sends the new firmware to the Zigbee equipment applicable to the new firmware according to the firmware sending and upgrading indication information sent by the equipment management server, and controls the Zigbee equipment to execute the firmware upgrading operation, so that the equipment management server can control the Zigbee equipment to upgrade the firmware without the Zigbee equipment supporting an SNMP protocol, and the Zigbee equipment is slightly changed.
Referring to fig. 15, an embodiment of the present invention provides a network system, including a gateway and a device management server, where functions of the gateway and the device management server are described in detail in the above method and apparatus embodiments, and are not described herein again.
In the embodiment of the invention, the gateway determines the Zigbee equipment applicable to the new firmware according to the equipment range indication information applicable to the new firmware sent by the equipment management server, sends the new firmware to the Zigbee equipment applicable to the new firmware according to the firmware sending and upgrading indication information sent by the equipment management server, and controls the Zigbee equipment to execute the firmware upgrading operation, so that the equipment management server can control the Zigbee equipment to upgrade the firmware without the Zigbee equipment supporting an SNMP protocol, and the Zigbee equipment is slightly changed.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by hardware that is instructed to implement by a program, and the program may be stored in a computer-readable storage medium, such as a read-only memory, a magnetic or optical disk, and the like.
The method, the apparatus, and the network system for implementing remote upgrading of Zigbee devices provided in the embodiments of the present invention are described in detail above, and a specific example is applied in the description to explain the principle and the implementation manner of the present invention, and the description of the embodiments above is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.