WO2019201258A1 - 一种设备状态同步的方法及公共能力组件 - Google Patents
一种设备状态同步的方法及公共能力组件 Download PDFInfo
- Publication number
- WO2019201258A1 WO2019201258A1 PCT/CN2019/082957 CN2019082957W WO2019201258A1 WO 2019201258 A1 WO2019201258 A1 WO 2019201258A1 CN 2019082957 W CN2019082957 W CN 2019082957W WO 2019201258 A1 WO2019201258 A1 WO 2019201258A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- state
- characterization
- resource
- time
- instance resource
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000012545 processing Methods 0.000 claims abstract description 34
- 238000012512 characterization method Methods 0.000 claims description 381
- 230000008859 change Effects 0.000 claims description 10
- 238000010586 diagram Methods 0.000 description 36
- 230000004044 response Effects 0.000 description 24
- 230000008569 process Effects 0.000 description 14
- 230000001360 synchronised effect Effects 0.000 description 10
- 238000004891 communication Methods 0.000 description 8
- 238000004590 computer program Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 238000001816 cooling Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000000903 blocking effect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 239000007788 liquid Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
- H04L41/082—Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W24/00—Supervisory, monitoring or testing arrangements
- H04W24/02—Arrangements for optimising operational condition
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/70—Services for machine-to-machine communication [M2M] or machine type communication [MTC]
Definitions
- the present application relates to the field of communications, and in particular, to a method for synchronizing device states and a common capability component.
- the Internet of Things (IoT) system can be composed of a platform, a gateway, a device, and an application. As shown in FIG. 1 , FIG. 1 is a schematic diagram of an interaction process between an application, a common service entity (CSE), and a device. Among them, CSE is a common capability component defined by the Internet of Things system.
- CSE is a common capability component defined by the Internet of Things system.
- the resource update request is first sent to the CSE to update the representation status of the device, and after the CSE updates the resource status, the update success response is returned to the application.
- the device listens for changes in resources by polling or subscribing.
- the method of subscription notification is adopted, that is, the change of the device subscription resource. If the resource changes, the CSE will send a notification to the device, and the notification includes the latest state after the resource change.
- the device receives the notification and detects the resource change, it first returns a response to the notification to the CSE, and updates the actual state of the device through the local hardware driver or interface.
- the CSE can only allow one application to update resources at a time, and when the CSE receives a resource update request sent by the application, it will lock the resource, reject other requests, and reduce the availability of the system.
- the embodiment of the present application provides a method for device state synchronization, which is used by a common capability component to complete synchronization of a device representation state and an actual state, and improve processing efficiency.
- the first aspect of the embodiments of the present application provides a method for device state synchronization, which may include: a common capability component receiving a first characterization state instance resource creation request sent by an application, where the first characterization state instance resource creation request may be The device status attribute is included; it can be understood that the first representation status instance resource creation request can also be referred to as an update representation status resource request.
- the common capability component creates a first characterization state instance resource based on the first characterization state instance resource creation request and the created second characterization state instance resource; that is, the public capability component maintains more than one characterization state instance resource.
- the common capability component sends a device status update request to the device, where the device status update request includes the device status attribute; the common capability component receives an actual status instance resource creation request sent by the device; the common capability component is based on the actual status instance resource Create a request to create an actual state instance resource; the common capability component sends an indication to the application that the actual state resource was successfully created.
- the common capability component can maintain a plurality of characterization state instance resources, and the common capability component saves the characterization state resource and the actual state resource of the device, and is responsible for synchronization with the actual state of the device, thereby improving processing efficiency.
- the first characterization state instance resource and the second characterization state instance resource are sub-resources that represent the state resource;
- the characterization state resource may include: an update mode and a time mode;
- the update mode may include: a sequence state or a latest state;
- the time mode includes: a time mode, a duration mode, or a mixed mode, wherein the hybrid mode adds the duration mode to the time mode.
- the common capability component can pass the application request for characterizing the state resource to the device one by one, and each request cannot be ignored, and the order between the requests is also consistent.
- the common capability component When the update mode is the latest state, it indicates that the common capability component can delete the request sent by the application to the characterization state resource.
- the public capability component finds that the connection state of the device is unreachable, the common capability component only needs to keep the latest characterization state. Instance resources, the remaining old characterization state instance resources can be discarded. After the device resumes connection or the device address is configured, the common capability component only needs to send the latest device state in the stateful instance instance resource to the device.
- the time mode When the time mode is the time mode, it indicates that the request needs to be executed on the device side at the specified time, that is, the device needs to change the device state at a specified time, for example, the switch is turned on or off at the specified time.
- the time mode is the duration mode, it indicates that the request requires the device to maintain the state after the execution request reaches the length of the duration.
- the time mode is the time + duration mode, it indicates that the device needs to change its state at a specific point in time and maintain the state for a certain length of time.
- the first characterization state instance resource creation request includes: the identifier of the characterization state resource, and at least one of the first state time and the first state duration.
- the identifier of the characterization state resource may indicate that the first characterization state instance resource creation request is a creation request of a sub-resource that represents the state resource.
- the common capability component creates the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource, and may include: The common capability component creates the first characterization state instance resource according to at least one of the first state instant and the first state duration, and the second characterization state instance resource.
- the public capability component when the first capability state instance resource is created, may be configured according to at least one of the first state time and the first state duration, and the second representation state instance resource. Create the first characterization state instance resource.
- a feasible solution is provided for creating a first representation state instance resource.
- the first characterization state instance resource creation request may include a first state time and a first state duration;
- the public capability component sending the device state update request to the device may include:
- the common capability component sends the device status update request to the device at the time indicated by the first state time, and indicates that the device keeps the device state unchanged for the length of time indicated by the first state duration.
- the common capability component may further determine, according to the first state moment, a time point of sending the device state update request to the device, and indicating that the device keeps the device state within a length of time indicated by the first state duration constant.
- the characterization state resource includes a connection state attribute indicating a time period [t1, t2] of the common capability component connected to the device; the characterization state resource update The mode is the sequence state, and the time mode is the time mode; the first characterization state instance resource creation request includes the first state time.
- the creating, by the common capability component, the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource may include: if the common capability component determines that the first state moment falls During the time period [t1, t2], and the first state time is different from the second state time of the created second characterization state instance resource, the common capability component creates the first characterization state instance resource.
- the update mode of the state resource is the sequence state and the time mode is the time mode
- the specific implementation scheme of the common capability component to create the first characterization state instance resource is provided, and the feasibility of the technical solution is increased.
- the characterization state resource includes a connection state attribute indicating a time period [t1, t2] of the common capability component connected to the device; the characterization state resource update The mode is the sequence state, and the time mode is the hybrid mode; the first characterization state instance resource creation request includes the first state time and the first state duration.
- the public capability component creates the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource, which may include:
- the common capability component creates the first characterization state instance resource, where the first time period includes: the first state time is a starting time, and the time length is the first state duration; or
- the update mode of the state resource is the sequence state and the time mode is the hybrid mode
- the specific implementation scheme of the common capability component to create the first characterization state instance resource is provided, and the feasibility of the technical solution is increased.
- the characterization state resource includes a connection state attribute indicating a time period [t1, t2] of the common capability component connected to the device; the characterization state resource update The mode is the sequence state, and the time mode is the duration mode; the first characterization state instance resource creation request includes the first state duration.
- the public capability component creates the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource, and may include: if the common capability component determines that the first state duration falls During the time period [t1, t2], any idle time period other than the second time period of the created second characterization state instance resource is removed, and the common capability component creates the first characterization state instance resource.
- the update mode of the state resource is the sequence state and the time mode is the time mode
- the specific implementation scheme of the common capability component to create the first characterization state instance resource is provided, and the feasibility of the technical solution is increased.
- the characterization state resource includes a connection state attribute indicating a time period [t1, t2] of the common capability component connected to the device; the characterization state resource update The mode is the latest state, and the time mode is the time mode; the first characterization state instance resource creation request includes the first state time.
- the creating, by the common capability component, the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource may include: if the common capability component determines that the first state moment falls During the time period [t1, t2], and the first state time is different from the second state time of the created second characterization state instance resource, the common capability component deletes the second characterization state instance resource, creating The first characterizes the state instance resource.
- the update mode of the state resource is the latest state and the time mode is the time mode
- the specific implementation scheme of the common capability component to create the first characterization state instance resource is provided, and the feasibility of the technical solution is increased.
- the characterization state resource includes a connection state attribute indicating a time period [t1, t2] of the common capability component connected to the device; the characterization state resource update The mode is the latest state, and the time mode is the hybrid mode; the first characterization state instance resource creation request includes the first state time and the first state duration.
- the public capability component creates the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource, which may include:
- the common capability component determines that the first time period is between the time periods [t1, t2], and the first time period coincides with the second time period of the created second characterization state instance resource, then the The public capability component deletes the second characterization state instance resource, and creates the first characterization state instance resource, where the first time period includes: the first state time is a starting time, and the time length is the first state duration; or,
- the common capability component determines that the first state falls between the time segments [t1, t2], and the first state duration and the third time segment obtained by the t1 and the created second representation state If the second time period of the instance resource is not coincident, the common capability component deletes the second characterization state instance resource, and creates the first characterization state instance resource.
- the update mode of the state resource is the latest state and the time mode is the hybrid mode
- a specific implementation scheme for the common capability component to create the first characterization state instance resource is provided, and the feasibility of the technical solution is increased.
- the characterization state resource includes a connection state attribute indicating a time period [t1, t2] of the common capability component connected to the device; the characterization state resource update The mode is the latest state, and the time mode is the duration mode; the first characterization state instance resource creation request includes the first state duration.
- the public capability component creates the first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource, and may include: if the common capability component determines that the first state duration falls During the time period [t1, t2], and the first state duration and the third time period obtained by the t1 coincide with the second time period of the created second characterization state instance resource, the common capability component deletes the The second characterizing the state instance resource creates the first characterization state instance resource.
- the update mode of the state resource is the latest state and the time mode is the duration mode
- the specific implementation scheme of the common capability component to create the first characterization state instance resource is provided, and the feasibility of the technical solution is increased.
- the method may further include: the common capability component receiving the characterization state resource creation request; the public The capability component creates a representation state resource according to the representation state resource creation request; the public capability component receives an actual state resource creation request; the public capability component creates an actual state resource according to the actual state resource creation request.
- the second aspect of the embodiment of the present application provides a common capability component, which has the function that the common capability component completes synchronization of the device representation state and the actual state, and improves processing efficiency.
- This function can be implemented in hardware or in hardware by executing the corresponding software.
- the hardware or software includes one or more modules corresponding to the functions described above.
- a further aspect of the embodiments of the present application provides a common capability component, which may include: a transceiver for communicating with devices other than the common capability component; a memory for storing computer execution instructions; and one or more processors Connecting to the memory and the transceiver via a bus, the processor executing computer executed instructions stored in the memory; and one or more computer programs, wherein the one or more computer programs are stored In the memory, the one or more computer programs include instructions that, when executed by the common capability component, cause the common capability component to perform any of the alternative aspects or aspects described above The method described.
- a further aspect of the embodiments of the present application provides a wireless communication apparatus, which may include:
- At least one processor a memory, a transceiver circuit and a bus system, the processor, the memory, the transceiver circuit coupled by the bus system, the wireless communication device communicating with a server via the transceiver circuit, a memory for storing program instructions, the at least one processor for executing the program instructions stored in the memory, such that the wireless communication device performs the terminal operations in the method of the above aspects of the embodiments of the present application part.
- the wireless communication device may be a common capability component or a chip that is applied to perform functions in a platform, a gateway, or a device.
- a further aspect of the embodiments of the present application provides a storage medium.
- the technical solution of the present application or the part that contributes to the prior art or all or part of the technical solution may be in the form of a software product.
- the computer software product is stored in a storage medium for storing computer software instructions for the terminal, which comprises a program designed to execute the above aspects for the terminal, or for storage for the server.
- Computer software instructions comprising programs for performing the above aspects for the server.
- the storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes.
- Yet another aspect of an embodiment of the present application provides a computer program product comprising instructions that, when run on a computer, cause the computer to perform the method as described in any of the alternative aspects or aspects above.
- FIG. 1 is a schematic diagram of an interaction process of an application, a common capability component, and a device in the prior art
- FIG. 2 is an architectural diagram of an IoT system defined by an international standardization organization in the field of Internet of Things in the embodiment of the present application;
- FIG. 3 is a schematic flow chart of a blocking scheme
- FIG. 4 is a schematic flow chart of a ThingShadow scheme
- FIG. 5 is a structural diagram of a system applied to an embodiment of the present application.
- FIG. 6 is a schematic diagram of characterizing a state resource in an embodiment of the present application.
- FIG. 7 is a schematic diagram of a resource for characterizing a state instance in an embodiment of the present application.
- FIG. 8 is a schematic diagram of actual state resources in an embodiment of the present application.
- FIG. 9 is a schematic diagram of an embodiment of a method for device state synchronization in an embodiment of the present application.
- FIG. 10 is a schematic diagram of an embodiment of a common capability component creating a representation state instance resource according to an embodiment of the present application.
- FIG. 11 is a schematic diagram of a common capability component creating a representation state instance resource according to an embodiment of the present application.
- FIG. 12 is another schematic diagram of a common capability component creating a representation state instance resource according to an embodiment of the present application.
- FIG. 13 is another schematic diagram of creating a characterization state instance resource by a common capability component in an embodiment of the present application.
- FIG. 14 is another schematic diagram of a common capability component creating a representation state instance resource according to an embodiment of the present application.
- 15 is another schematic diagram of creating a characterization state instance resource by a common capability component in an embodiment of the present application.
- FIG. 16 is another schematic diagram of a common capability component creating a representation state instance resource according to an embodiment of the present application.
- FIG. 17 is another schematic diagram of creating a characterization state instance resource by a common capability component in an embodiment of the present application.
- FIG. 18 is another schematic diagram of a common capability component creating a representation state instance resource according to an embodiment of the present application.
- FIG. 19 is a schematic diagram of an embodiment based on the oneM2M standard in the embodiment of the present application.
- 20 is a schematic diagram of an embodiment of a common capability component in an embodiment of the present application.
- FIG. 21 is a schematic diagram of another embodiment of a common capability component in an embodiment of the present application.
- the embodiment of the present application provides a method for device state synchronization, which is used by a common capability component to complete synchronization of a device representation state and an actual state, and improve processing efficiency.
- platforms, gateways, and devices play different roles in the entire IoT architecture.
- the platform is responsible for providing applications with application program interface (API) interfaces that call various capabilities.
- API application program interface
- the gateway needs to collect and send data from the device. On the one hand, it needs to report the data to the platform or receive various instructions from the platform.
- Equipment is the collector and executor of information and is widely used at the end of various IoT systems, such as temperature sensors, servo motors, car machines, machine tools, and so on.
- FIG. 2 is an architectural diagram of an IoT system defined by the oneM2M standard of the International Organization for Standardization in the field of Internet of Things.
- the infrastructure node (IN) is the platform
- the middle node (MN) is the gateway
- the device is divided into application dedicated nodes (ADN) and application services.
- ADN application dedicated nodes
- IN, MN, ASN, and ADN are all device types defined by oneM2M and conform to the specifications of oneM2M.
- NoDN non-one M2M device node
- Such devices comply with other IoT specifications such as Z-Wave, ZigBee, Bluetooth, and the like. They access the oneM2M system through Interworking, so they can also access their services through the interface defined by oneM2M.
- CSE common service entity
- I infrastructure node
- MN intermediate node
- application application service node
- ADN application dedicated node
- the CSE is a common capability component defined by oneM2M and can include common capabilities for different industries, such as device registration, device management, data delivery and reporting, and event subscription.
- the CSE open interface facilitates the application to call these common capabilities.
- CSE provides external interfaces of these public capabilities through resources.
- Resources can be understood as a piece of information held by CSE. This piece of information may be a document or a database record.
- the resource records the context in which the CSE provides a certain service and the content of the service itself.
- the ability of CSE to open device registration and data reporting and delivery is achieved through access to resources.
- Resources can be created, updated, retrieved, and deleted. Thus represents the interface provided by the entire life cycle of a public capability provided by a CSE. Create a registration and generation that represents the public capability.
- the update can be used to update all or part of the capability, to obtain a state that can be used to monitor public capabilities, and to delete and deregister the public capability.
- the device's services need to be synchronized with the IoT system in a digital form to implement software-defined network interface calls to device services. Specifically, it is the reporting and delivery of data.
- the reporting of the data may be after the sensor collects the data and reports the data to the platform.
- the application registered to the platform can then read the value through the platform.
- the application registered to the platform can also issue a control command to the platform through the capability, and the controller reads the specific content of the control command from the platform, and then performs the corresponding operation.
- the application may be an application registered to the platform, which may be understood as an infrastructure node application entity (IN-AE).
- a resource representing the state of the device (such as a characterization state resource of the device) is stored on the CSE.
- a device may be specifically referred to as an application dedicated node application entity (ADN-AE), that is, an application on a device, and an application on the device is used to synchronize the actual state of the device and the resource state in the CSE.
- ADN-AE application dedicated node application entity
- the CSE-to-device notification is not successfully sent in time, but the resources on the CSE have been updated, which will cause the device's characterization status and actual status to be inconsistent. If the device fails to be sent due to a hardware failure or an unexpected failure, the CSE to ADN-AE notification is successfully sent, but the actual state of the device is not switched, and the status of the representation is inconsistent with the actual status.
- FIG. 3 is a schematic flowchart of a blocking scheme.
- the CSE receives the resource update request from the application, the CSE does not immediately update the resource, but locks the resource and further sends a notification to the device.
- the device will send a successful response to the CSE only after the device has actually updated the device status.
- the CSE will only perform the resource update action after receiving the successful response, and return the update success response to the IN-AE.
- the CSE will reject any other requests, resulting in reduced system availability. If the device cannot respond immediately for various reasons, it will cause the resources on the CSE to enter the long-term lock state, causing the entire system to stop.
- ThingShadow is a device state synchronization scheme in Amazon web service (AWS) IoT.
- the IoT platform maintains two states for one device, one desired and one reported. Desired is used to indicate the state of the device desired by the application, and reported is used to indicate the actual state of the device.
- Desired is used to indicate the state of the device desired by the application, and reported is used to indicate the actual state of the device.
- the application wants to obtain the actual state of the device, it sends an acquisition request to the IoT platform to access the reported resource.
- the application wants to modify the state of the device, it sends an update request to the IoT platform to access the visited resource.
- the AWS platform gradually synchronizes the desired state and the reported state according to other environments.
- FIG. 4 is a schematic flowchart of a ThingShadow scheme.
- report OFF.
- the device subscribes to the desired to track the update request of the application entity to the switch.
- the device receives the update request of the desired state, the device updates the actual state of the device. If the update is successful, the device updates the report to ON.
- the application is subscribed, when the reported status changes to ON, the IN-AE receives a notification that the actual status of the device has been synchronized with desired.
- the technical problem to be solved by the present application is that in the case where the device state is hosted on a platform, a gateway or other server, there is a synchronization problem between the characterization state and the actual state. That is, you need to solve the problem of how to synchronize, when to synchronize, and so on.
- FIG. 5 is a system architecture diagram of an application according to an embodiment of the present application.
- the present application simultaneously maintains two state resources of the device, one state resource, and one actual state resource in the common capability component of the IoT platform, the gateway, or the device.
- the characterization resource common capability component may be an independent physical device or may be deployed on an IoT platform, a gateway, or a device.
- the characterization state resource includes a characterization state instance resource, and the characterization state instance resource is a sub-resource that characterizes the state resource.
- the actual state resource contains the actual state instance resource, and the actual state instance resource is the child resource of the actual state resource. Both the characterization state resource and the actual state resource can have multiple sub-resources.
- the child resource's life cycle depends on its parent resource. If the parent resource is deleted, all child resources it belongs to will be deleted. Characterizing a state resource can be understood as information that applies a state in which a device switch is desired; an actual state resource can be understood as information on the actual state of the device.
- the characterization state resource maintained in the common capability component receives the request sent by the application, requests to create a characterization state instance resource, and the characterization state instance resource includes the device state of the application update.
- the device listens to the creation of the state instance resource. When the device discovers that the new state instance resource is created, the device sends a request to the public capability component according to the state of the device that is corresponding to the device state in the state instance resource. Maintain the actual state resources to create actual state instance resources and ensure that the latest actual state instance resources and device state are synchronized. If you want to obtain the current actual state of the device, you need to obtain the latest actual state instance resource under the actual state resource.
- the device monitoring indicates that the state instance resource is created, and the device may passively receive the indication information indicating that the state instance resource creation request is successfully sent by the public capability component, or the device may actively send a request to the public capability component to request the representation state. Indicates whether the instance resource is created successfully.
- the characterization state resource is set by the application of the device or the device, and corresponding attributes are set in the characterization state resource according to the characteristics of the device, so as to standardize the application creation request for the characterization state resource and the policy that the common capability component delivers the update request to the device. For example, for an AGV car, any update request for its characterization status resource will be delivered to the device in time; instead, for the pressure controller device, the update request for its characterization status resource may be cached by the common capability component, and the public capability component will only be up to date. An update request is sent to the device. As shown in FIG. 6, FIG. 6 is a schematic diagram of characterizing state resources in an embodiment of the present application.
- the actual state resource is set by the device or device application, including the device state and metadata of the device state. For example: the current state of the device, and how long the device's current state needs to remain, and so on. It is convenient to determine when the request can be sent by the application on the platform.
- the characterization status resource of the device includes various attributes, such as an update mode, a time mode, a device address, a connection state, and a determined delay.
- Characterizing state resources includes characterizing state instance resources.
- the update mode can be a sequence state or a latest state.
- the time mode can be time, duration or time + duration.
- the device address represents the device reachable address, and the public capability component can send a request to the device through the device address.
- connection status indicates the time schedule of the device online, that is, during which time periods the device is online and which time periods are dormant or not online, the public capability component can determine whether the request can be sent to the device according to the connection status.
- Determining the delay is the time required from the public capability component to send a message to the device to successfully execute the message in the time deterministic network.
- the time consists of two parts, one is the network transmission time, that is, the network delay of the public capability component sending the message to the device; the other is the program delay of the device from the receipt of the message to the actual change of the device state.
- Determine the value of the delay equal to the sum of the network delay and the program delay.
- the program delay device can be determined according to its own software environment, generally a fixed value. The value of the network delay is measured based on the communication time of the public capability component after the device is online.
- the update mode when the update mode is a sequence state, it indicates that the common capability component can pass the application request for characterizing the state resource to the device one by one, and each request cannot be ignored, and the order between the requests must also be consistent.
- the common capability component When the update mode is the latest state, it indicates that the common capability component can delete the request sent by the application to the characterization state resource.
- the public capability component finds that the connection state of the device is unreachable, the common capability component only needs to keep the latest characterization state. Instance resources, the remaining old characterization state instance resources can be discarded. After the device resumes connection or the device address is configured, the common capability component only needs to send the latest device state in the stateful instance instance resource to the device.
- the time mode When the time mode is time, it indicates that the request needs to be executed on the device side at the specified time, that is, the device needs to change the device state at a specified time, for example, the switch is turned on or off at the specified time.
- the time mode is the duration, it indicates that the request requires the device to maintain the state after the execution request reaches the length of the duration.
- time mode is time + duration, it indicates that the device needs to change its state at a specific point in time, and keeps the state for a certain length of time.
- the characterization state instance resource represents an instance of a device state, and the characterization state instance resource is composed of the following attributes: device state, state time, and state duration.
- FIG. 7 is a schematic diagram of a resource for characterizing a state instance in the embodiment of the present application.
- the device status indicates the state in which the application wants to switch the device. For example, turning on the switch switches the device state to ON, and turning the switch off switches the device state to OFF.
- the status time indicates that the device switches to a specific state at a specified time.
- the state time is equal to 20171228T122000.000, which means that the switch state is switched to ON or OFF at this time.
- the duration of the state indicates the amount of time that the device needs to maintain after switching to a particular state.
- the state duration equal to 60s means that the switch must be kept for at least 60 seconds after switching to ON.
- the deployment status indicates whether the characterization state instance resource has been forwarded to the device and executed by the device. If the device has been forwarded to the device and executed, the attribute value is "Deployed”; if it is still in the standby state, the attribute value is "Not Deployed”; if the device is in the process of execution, the attribute value is "Under Deployment”.
- the actual state resource contains the actual state instance resource.
- the actual state resource may contain multiple actual state instance resources.
- the latest actual state instance resource indicates the actual state of the current device, and the state is saved in the device state attribute.
- FIG. 8 is a schematic diagram of actual state resources in the embodiment of the present application.
- FIG. 9 is a schematic diagram of an embodiment of a method for synchronizing devices in an embodiment of the present application. That is, the public capability component receives the request sent by the application, and the process of synchronizing the state of the device is as follows:
- the application and the device respectively register with the public capability component.
- the application and the device respectively register with the public capability component, and the registration may include a process of assigning a security key to the authentication and the like.
- the application and the device can invoke the common capability provided by the common capability component, that is, the device state synchronization method provided by the common capability can be used to synchronize the device state.
- the common capability component receives the representation state resource configuration request.
- the common capability component receives a representation state resource configuration request sent by the application or device.
- the characterization state resource configuration request may carry a device characterization state resource.
- the characterization state resource configuration request may come from the device itself, that is, the device actively initiates a characterization state resource creation request to the public capability component after the registration is completed according to its own characteristics to open its own service interface to the application.
- the common capability component creates a characterization state resource according to the characterization state configuration request.
- the common capability component can create a representation state resource based on the representation state resource creation request. After the device characterization status resource is successfully created, the application can control the status of the device by accessing the resource.
- the common capability component receives the actual state resource configuration request.
- the public capability component receives the actual state resource configuration request sent by the application or device.
- the actual state resource configuration request may carry the actual state resource of the device.
- the actual state resource configuration request can also be understood as an actual state resource creation request. Probably from the device itself, the device creates an actual state resource to update its actual state so that the application can access the actual state of the device.
- the public capability component creates an actual state resource according to the actual state resource configuration request.
- the public capability component can create a real state resource based on the actual state resource creation request. It should be noted that the timing of steps 902 and 904 is not limited.
- the public capability component receives an update representation status resource request sent by the application.
- the updating the characterization state resource request includes characterization of the state resource identifier.
- the updating of the characterization state resource request may specifically be a characterization state instance resource creation request, and the characterization state instance resource is a sub-resource representing the state resource.
- the common capability component creates a representation state instance resource according to the update representation status resource request.
- the Common Capabilities component determines whether the characterization state instance resource can be successfully created. If the characterization state instance resource is successfully created, based on the information in the characterization state instance resource, the device status update request is sent to the device when the preset condition is reached.
- the public capability component sends a device status update request to the device.
- the device updates the device status according to the content in the device status update request.
- the device sends an actual state instance resource creation request to the public capability component.
- the device sends an update actual status resource request to the common capability component.
- the update actual state resource request can be an actual state instance resource creation request.
- the public capability component creates an actual state instance resource according to the actual state instance resource creation request.
- the public capability component sends an actual status resource update notification to the application.
- the application can know that the actual state of the device has changed.
- the common capability component receives a first characterization state instance resource creation request sent by the application, where the first characterization state instance resource creation request includes a device state attribute, and the common capability component is configured according to the first characterization state An instance resource creation request and a second representation state instance resource that has been created to create the first representation state instance resource; the common capability component sends a device status update request to the device, where the device status update request includes the a device status attribute; the common capability component receives an actual state instance resource creation request sent by the device; the common capability component creates an actual state instance resource according to the actual state instance resource creation request; and the public capability component applies to the application Send actual status resource update notifications.
- the common capability component can maintain multiple representation state instance resources, complete synchronization of device representation state and actual state, and improve processing efficiency.
- FIG. 10 is a schematic diagram of an embodiment of the present invention, in which the public capability component receives an update representation state resource request sent by the application; and the public capability component creates a representation state instance resource according to the update representation state resource request, as follows: Show:
- the common capability component receives a representation state instance resource creation request sent by the application.
- the characterization state instance resource creation request includes a device state attribute, and may also include attributes such as a state time and a state duration. It can be understood that the device status represents a new status that the application wants the device to switch to.
- the status time indicates that the application plans to have the device switch state at that time.
- the duration of the state indicates that the application plan keeps the device in that state for a certain length of time.
- the characterization state instance resource creation request may further include the identifier of the characterization state resource, and the characterization state instance resource creation request may include the state time and the state duration, or may include only any one of them.
- the common capability component determines that the update mode in the representation state resource is a sequence state or a latest state.
- step 1054 is performed.
- step 1055 is performed; if the time mode is time duration, step 1056 is performed; if the time mode is time + time length, step 1057 is performed.
- step 10510 is performed; if the time mode is time duration, step 10511 is performed; if the time mode is time + time length, step 10512 is performed.
- the Common Capabilities component determines if the required device state can be synchronized to the device at the specified time. Specifically, the public capability component may determine whether the connection state of the device is reachable at a specified time; and determine whether the device state can be switched at the specified time according to the connection state and the determined delay.
- FIG. 11 is a schematic diagram of a common capability component creating a representation state instance resource. Determine the delay as the length of time represented by the shaded portion.
- the characterization state instance resource creation request received by the public capability component includes the state time texe and the device state, indicating that the public capability component needs to ensure that the device can switch the device state according to the device state attribute at the time of texe.
- texe is between t1 and t2.
- the common capability component needs to send a device status update request to the device at tsend time to ensure that the device can switch the device state after determining the delay.
- the common capability component successfully creates the representation state instance resource and returns a create success response 1059.
- the common capability component also needs to determine whether the representation in the state instance resource creation request exists and represents in the representation state instance resource that has been successfully created but the deployment state is still False.
- the state instance resource of the state instant resource conflict of the state instance resource If a conflict is found, a create failure response 1058 is returned.
- the public capability component needs to return a creation failure response 1058, because the time mode is the time, and the device cannot accept the time mode of the specified duration.
- the representation state instance resource creation request includes a state time attribute, a state duration attribute, and a device state attribute, indicating that the public capability component needs to switch the device to the device state at the state time, and maintain The time of the state.
- FIG. 12 is another schematic diagram of a common capability component creating a representation state instance resource.
- Texe0 indicates the state time and state duration of the characterization state instance resource to be created in the state instance resource creation request. As shown in Figure 12. Because the update mode is the sequence state, the common capability component needs to determine the relationship between texe0 and the existing state time as texe1, texe2, texe3, the state instance resource and its state duration, to determine whether the characterization state instance resource to be created can be Created successfully.
- texe0 is in the space between texe1 and texe2, and texe0 does not exceed texe2 after the state duration, then the characterization state instance resource can be successfully created, and the common capability component creates the characterization state instance resource and returns a create success response 1059. If texe0 is between texe2 and texe3 or elsewhere, because texe0 plus state duration has caused a conflict with other characterization state instance resources that have been successfully created, the creation fails and the common capability component returns a create failure response 1058.
- the representation state instance resource creation request only carries one of the state time or the state duration. Then, it is necessary to comprehensively determine the relationship between the state instant of the characterization state instance resource and the existing characterization state instance resource and the state duration to determine whether the creation success is successful.
- FIG. 13 is another schematic diagram of a common capability component creating a representation state instance resource.
- the state instant resource 1 state moment is texe1, the state duration is as shown in Figure 13;
- the characterization state instance resource 2 has no set state time, the state duration is as shown in Figure 13;
- the state instance resource 3 is represented.
- the status time is texe3, and the status time is not set.
- Case3 When the characterization state instance resource is to be created, only the state duration is set. Because there is no constraint state moment, the public capability component determines whether the current immediate execution can be successfully created. If it is determined that the current device is online and the current device is not within a state duration that characterizes the state instance resource, then the resource is successfully created and a successful response 1059 is returned.
- the characterization state instance resource to be created may be created between the characterization state instance resource 1 and the characterization state instance resource 2.
- the public capability component After the creation is successful, the public capability component needs to allocate a state time attribute to the newly created representation state instance resource, which is a time when the public capability component allocates a specific switching device state according to a specific situation. And the public capability component needs to carry the assigned state time attribute in the creation success response to notify the application device of the state switching time. If the time at which the characterization state instance resource to be created can be created is not found within the known device online time, a create failure response 1058 is returned.
- the representation state instance resource creation request includes a state duration property.
- FIG. 14 is another schematic diagram of the common capability component creating a characterization state instance resource.
- the public capability component determines the first other time period outside the time period that has been reserved by other characterization state instance resources during the time period in which the known device is online, and returns a create success response 1059 after the creation is successful. As described in case 3 in step 1057, no further details are provided here.
- the common capability component determines whether the characterization state instance resource can be created according to the current device state, and immediately after the creation, notifies the device to perform the device state update request, and switches the device state.
- the public capability component determines that the current device is online, and determines that the current device is not in a request that needs to maintain a specific state duration, creates the characterization state instance resource, and returns a create success response 10515. Otherwise return a create failure response.
- the characterization state instance resource When the characterization state instance resource is created, if the characterization state instance resource creation request includes a state time attribute, and at the state time, other characterization state instance resources already exist, only the latest characterization state instance resource needs to be synchronized to the device, and the old characterization The state instance resource is replaced.
- the common capability component receives a representation state instance resource creation request, and the representation state instance resource creation request includes a state time attribute.
- FIG. 15 is another schematic diagram of the common capability component creating a representation state instance resource.
- the public capability component creates another schematic representation of the state instance resource:
- the public capability component receives the representation state instance resource creation request, and the created representation state resource already contains three representation state instance resources. In different situations, the processing is different:
- Case1 When the characterization state instance resource to be created contains both the state duration and the state moment, if texe01 is larger than texe1 and is within the state duration of the characterization state instance resource 1, or texe01 is smaller than texe1 and texe1 is in the characterization state instance resource to be created. Within the state duration, either the state duration to be created to represent the state instance resource overlaps with the state duration of the representation state instance resource 2, or texe3 falls within the state duration of the state instance resource to be created. The characterization state instance resource is successfully created, and correspondingly, the conflicting characterization state instance resource 1, 2 or 3 is replaced and deleted, and a success response 10513 is returned.
- Case3 When the characterization state instance resource to be created only contains the state duration, the common capability component determines the time that the first device is reachable, for example, t1 in Figure 16 above, successfully creating and replacing other characterization state instance resources with conflicts, and returning to create Successfully responded to 10513. If there are other characterization state instance resources within the required state duration, such as characterization state instance resource 1 in Figure 16, the resource is replaced.
- the public capability component creates a representation state instance resource, it needs to assign a specific value to the state time according to the situation, indicating that the device will switch state at that moment. And carry the state moment in the successful response.
- FIG. 17 is another schematic diagram of the common capability component creating a representation state instance resource.
- the common capability component has executed the characterization state instance resource 1, and the deployment state has changed from "not deployed” to "deployed". For case 1 and case 2, if the time of texe01 or texe02 conflicts with the state duration of the state instance resource 1, it is necessary to reject the request to create a state instance resource. For case 3, the time that the public capability component finds the first device reachable should be performed from the characterization state instance resource 1, and the search state is switched to "deployed" to start the search.
- FIG. 18 is a common capability component creation. Another schematic representation of a state instance resource. Perform the following steps.
- the public capability component creates the characterization state instance resource within the first available time period that the device is reachable, such as t1 in Figure 18 above. If there is a conflict with other characterization state instance resources, such as characterization state instance resource 1 in Figure 18, the replacement characterization state instance resource 1 is replaced.
- the public capability component also needs to allocate a state time for the created state instance resource according to the situation, and carries the state time in the response to notify the application device state of the actual switching time.
- FIG. 19 is a schematic diagram of an embodiment based on the oneM2M standard of the present application.
- the MN-CSE is an intermediate node common capability middleware.
- the Mca interface defined by oneM2M is connected to the switch of the lamp, and the switch is equivalent to the device.
- the AE is also connected to the MN-CSE common capability component as an application.
- OneM2M uses a container resource to characterize the state of the device.
- a switch device uses a container resource to characterize its ON or OFF state.
- the container contains one or more instance (contentInstance) sub-resources, and each contentInstance sub-resource represents a history of switch states.
- Each contentInstance sub-resource contains attributes such as creation time (creationTime) and content (content). Where creationTime is the creation time of this contentInstance, and content is the value of ON or OFF. There may be multiple contentInstances under the container resource, and the latest one of creationTime is the current state of the switch.
- the container resource is the characterization state resource and the actual state resource in this application.
- the container resource is the characterization state resource and the actual state resource in this application.
- two container resources are created to represent the characterization state resource and the actual state resource for the switch.
- the contentInstance under the container is a representation of the state instance resource and the actual state instance resource.
- A101: MN-AE and AE are registered with MN-CSE, respectively.
- the specific performance is that the Create Application AE (Create AE) request is sent to the MN-CSE respectively.
- the AE resources corresponding to the MN-AE and the AE are respectively created under the CSEBase resources of the MN-CSE.
- the AE resource created by the AE is a sub-resource of CSEBase.
- the AE resource contains the attribute access point (pointOfAccess) which is the access address of the switch device.
- MN-CSE can access AE through this address; schedule is the connection status of AE, indicating the reachable time of AE; determineDelay is to send request to AE and be successfully AE
- the round trip time of execution which is determined by the AE based on its local environment (eg, program execution time, network delay between MN-CSE, etc.).
- A102 The AE sends a create container request to the MN-CSE requesting access to the address of the AE resource.
- the container sub-resource includes the following attributes: the stateType is desired, indicating that the container resource is a characterization state resource; the update mode (updateMode) is a sequence state, indicating that the MN-CSE is synchronizing the container resource.
- the state is the sequence state when the state is to AE; the time mode (timeMode) indicates the time mode of synchronization.
- the ID of the container resource is container-desired
- A103 The AE sends a create container request to the MN-CSE requesting access to the address of the AE resource.
- the container sub-resource is created under the AE, and the attribute state type (stateType) of the container sub-resource is actual, indicating that the container resource is an actual state resource.
- stateType attribute state type
- the ID of the container resource is container-actual.
- A104 MN-AE sends create contentInstance to container-desired.
- the contentInstance ID is contentInstance-0, and the contentInstance-0 contains a content attribute indicating that the device status is ON to indicate that the switch is turned on; the stateTime attribute indicating the state time indicates that the switch is turned on at a specific time; and the stateDuration indicating the state duration is the duration.
- MN-CSE first determines all contentInstance resources under container-desired that are isDeployed to false. These resource states have not been synchronized to AE.
- contentInstance-1 Suppose it is contentInstance-1, contentInstance-2, contentInstance-3.
- contentInstance-2 Based on the contentInstance-0 and contentInstance-1, 2, 3 resources and the schedule attribute, determineDelay attribute and timeMode of the AE resource, it is determined whether contentInstance-0 can be created. It is divided into the following cases: (time represents the stateTime attribute, duration represents the stateDuration attribute)
- the schedule attribute of the AE is one hour from 20180130T000000:000 to 20180130T006000:000, and is simply written as 00-60 for the expression.
- the number of stateTime for each contentInstance represents the number of minutes since 00.
- stateDuration represents the number of minutes that last.
- the time determineDelay from the time the message is sent from the MN-CSE to the actual switching state of the switch is 1 s.
- timeMode is TIME indicating that the time mode is the time, MIXED indicates the time + duration, and DURATION indicates the duration.
- Case6 The stateTime of contentInstance-0 happens to be idle time between contentInstance-1 and contentInstance-2, so the creation is successful.
- Case8 The duration of contentInstance-0 is 15, and the first eligible time period determined by the MN-CSE within the reachable time of the AE is 15 ⁇ 30 after the end of contentInstance-1, so the creation is successful, and the contentInstance-0 is set. stateTime is 15.
- the MN-CSE sends the standby status update request to the AE at the time when the first status time of the plurality of contentInstance sub-resources of the container-desired is subtracted from the determineDelay, and the content update content request carries the content attribute content in the contentInstance.
- A107 The AE switches the device status according to the device status update request received from the MN-CSE.
- A108 After the AE updates the device status, it sends a Create contentInstance request to the MN-CSE, requesting access to the container-actual, indicating that the device has successfully switched the state.
- the Create contentInstance request carries the current actual state of the device.
- A109 The MN-CSE creates a contentInstance resource after receiving the request.
- the MN-CSE sends a notification to the MN-AE, indicating that the device status has been successfully switched.
- the difference is that the update mode of the container-desired is the latest state (Latest), indicating that only the last request needs to be responded at the same time.
- B101 MN-AE and AE are registered with MN-CSE, respectively. Same as A101.
- the AE sends a Create Container request to the MN-CSE requesting access to the address of the AE resource.
- the container sub-resource includes the following attributes: stateType is desired, indicating that the container resource is a characterization state resource; updateMode is latest, indicating that MN-CSE is in the latest state when synchronizing the container resource state to AE. ; timeMode indicates the time mode of synchronization.
- the ID of the container resource is container-desired.
- B103 The AE sends a create container request to the MN-CSE requesting access to the address of the AE resource. Same as A103.
- B104 MN-AE sends create contentInstance to container-desired. Same as A104.
- B105 MN-CSE first determines all contentInstance resources under container-desired that are isDeployed to false. These resource states have not been synchronized to AE, such as contentInstance-1, contentInstance-2, contentInstance-3. Based on the contentInstance-0 and contentInstance-1, 2, 3 resources and the schedule attribute, determineDelay attribute and timeMode of the AE resource, it is determined whether contentInstance-0 can be created. It is divided into the following cases: (time represents the stateTime attribute, duration represents the stateDuration attribute)
- the schedule attribute of AE is one hour from 20180130T000000:000 to 20180130T006000:000, which is simply written as 00-60 for the expression.
- the number of stateTime for each contentInstance represents the number of minutes since 00.
- stateDuration represents the number of minutes that last.
- the time determineDelay from the time the message is sent from the MN-CSE to the actual switching state of the switch is 1 s.
- timeMode is TIME indicating that the time mode is the time, MIXED indicates the time + duration, and DURATION indicates the duration.
- Case1 contentInstance-0 and contentInstance-1 conflict, the creation is successful, and contentInstance-1 is replaced.
- Case2 contentInstance-0 and contentInstance-2 conflict, the creation is successful, and contentInstance-2 is replaced.
- Case3 contentInstance-0 conflicts with contentInstance-1, the creation is successful, and contentInstance-1 is replaced.
- Case4 MN-CSE creates contentInstance-0 after receiving the request. Because contentInstance-0 and contentInstance-1 conflict, contentInstance-1 is replaced.
- the MN-CSE sends the standby status update request to the AE at the time when the first status time of the plurality of contentInstance sub-resources of the container-desired is subtracted from the determineDelay, and the content update content request carries the content attribute content in the contentInstance. Same as A106.
- B107 The AE switches the device status according to the device status update request received from the MN-CSE. Same as A107.
- B108 After the AE updates the device status, it sends a Create contentInstance request to the MN-CSE, requesting access to the container-actual, indicating that the device has successfully switched the state.
- the Create contentInstance request carries the current actual state of the device. Same as A108.
- B109 The MN-CSE creates a contentInstance resource after receiving the request. Same as A109.
- B110 The MN-CSE sends a notification to the MN-AE, indicating that the device status has been successfully switched. Same as A110.
- Instructions issued to all applications can be executed in order.
- AGV automated guided vehicle
- the application sends commands through the platform to command the robot to carry materials.
- Each instruction contains a source address and a destination address. Therefore, the request issued by each application must be executed, otherwise it will result in a backlog of goods or insufficient supply of materials.
- the instruction needs to be executed at the specified time.
- time-sensitive operations such as controlling the speed of the conveyor belt, controlling the cooperation relationship between the assembled robots, and the like. This kind of operation requires the instruction to be executed at a certain time, and the production line can operate normally, otherwise it may cause serious problems such as stop of the production line and collision of the instrument.
- the equipment needs to be operated for a specific length of time.
- some industrial scenarios such as cooling, exhausting, etc. of the device, according to the efficiency of the cooling device or the exhaust device, in order to achieve better cooling or exhausting effects, it is necessary to ensure that the operating state of the device reaches a specified length, otherwise it may cause accident.
- FIG. 20 is a schematic diagram of another embodiment of a common capability component in the embodiment of the present application.
- the receiving module 2001 is configured to receive a first characterization state instance resource creation request sent by the application, where the first characterization state instance resource creation request includes a device state attribute; and the actual state instance resource creation request sent by the receiving device;
- the processing module 2002 is configured to create a first characterization state instance resource according to the first characterization state instance resource creation request and the created second characterization state instance resource; and create an actual state instance resource according to the actual state instance resource creation request;
- the sending module 2003 is configured to send a device status update request to the device, where the device status update request includes a device status attribute, and send, to the application, indication information that the actual status resource is successfully created.
- the first characterization state instance resource and the second characterization state instance resource are sub-resources that represent the state resource
- Characterizing state resources includes: update mode and time mode;
- the update mode includes: a sequence status or a latest status
- the time mode includes: a time mode, a time mode, or a mixed mode, and the mixed mode is a time mode plus a time mode.
- the first characterization state instance resource creation request includes: an identifier that identifies the state resource, and at least one of the first state moment and the first state duration.
- the processing module 2002 is specifically configured to create a first characterization state instance resource according to at least one of a first state time and a first state time, and a second characterization state instance resource.
- the first characterization state instance resource creation request includes a first state time and a first state duration
- the sending module 2003 is configured to send a device status update request to the device at a time point indicated by the first state time, and instruct the device to keep the device state unchanged within a time length indicated by the first state duration.
- the characterization state resource includes a connection state attribute, and the connection state attribute indicates a time period [t1, t2] of the public capability component connected to the device;
- the update mode for characterizing the state resource is a sequence state, and the time mode is a time mode;
- the first characterization state instance resource creation request includes a first state moment
- the processing module 2002 is specifically configured to: if it is determined that the first state moment falls between the time segments [t1, t2], and the first state time is different from the second state time of the created second characterization state instance resource, create The first characterizes the state instance resource.
- the characterization state resource includes a connection state attribute, and the connection state attribute indicates a time period [t1, t2] of the public capability component connected to the device;
- the update mode for characterizing the state resource is a sequence state, and the time mode is a mixed mode
- the first characterization state instance resource creation request includes a first state time and a first state duration
- the processing module 2002 is specifically configured to: if it is determined that the first time period is between the time segments [t1, t2], and the first time period does not coincide with the second time period of the created second characterization state instance resource, create the first Determining a state instance resource, where the first time period includes: starting with a first state time, and length of time is a first state duration;
- the processing module 2002 is specifically configured to: if it is determined that the first state moment falls between the time segments [t1, t2], and the first state time is different from the second state time of the created second characterization state instance resource, create First characterization state instance resource;
- the processing module 2002 is specifically configured to: if it is determined that the first state falls within the time period [t1, t2], any idle time period other than the second time period of the created second characterization state instance resource is deleted, A representation of a state instance resource.
- the characterization state resource includes a connection state attribute, and the connection state attribute indicates a time period [t1, t2] of the public capability component connected to the device;
- the update mode for characterizing the state resource is a sequence state, and the time mode is a duration mode;
- the first characterization state instance resource creation request includes a first state duration
- the processing module 2002 is specifically configured to: if it is determined that the first state falls within the time period [t1, t2], any idle time period other than the second time period of the created second characterization state instance resource is deleted, A representation of a state instance resource.
- the characterization state resource includes a connection state attribute, and the connection state attribute indicates a time period [t1, t2] of the public capability component connected to the device;
- the update mode for characterizing the state resource is the latest state, and the time mode is the time mode
- the first characterization state instance resource creation request includes a first state moment
- the processing module 2002 is specifically configured to: if it is determined that the first state moment falls between the time segments [t1, t2], and the first state time is different from the second state time of the created second characterization state instance resource, delete The second characterizes the state instance resource, creating a first characterization state instance resource.
- the characterization state resource includes a connection state attribute, and the connection state attribute indicates a time period [t1, t2] of the public capability component connected to the device;
- the update mode for characterizing the state resource is the latest state, and the time mode is the hybrid mode;
- the first characterization state instance resource creation request includes a first state time and a first state duration
- the processing module 2002 is specifically configured to: if the first time period is determined to be between the time segments [t1, t2], and the first time period coincides with the second time period of the created second characterization state instance resource, delete the second time Representing the state instance resource, creating a first characterization state instance resource, where the first time period includes: taking the first state time as a starting time, and the time length is a first state duration;
- the processing module 2002 is specifically configured to: if it is determined that the first state moment falls between the time segments [t1, t2], and the first state time is different from the second state time of the created second characterization state instance resource, delete Second characterization of the state instance resource, creating a first characterization state instance resource;
- the processing module 2002 is specifically configured to: if the first state is determined to fall between the time segments [t1, t2], and the first state duration and the third time segment obtained by t1 and the created second characterization state instance resource If the two time periods are not coincident, the second characterization state instance resource is deleted, and the first characterization state instance resource is created.
- the characterization state resource includes a connection state attribute, and the connection state attribute indicates a time period [t1, t2] of the public capability component connected to the device;
- the update mode for characterizing the state resource is the latest state, and the time mode is the duration mode;
- the first characterization state instance resource creation request includes a first state duration
- the processing module 2002 is specifically configured to: if the first state is determined to fall between the time segments [t1, t2], and the first state duration and the third time segment obtained by t1 and the created second characterization state instance resource If the two time periods coincide, the second characterization state instance resource is deleted, and the first characterization state instance resource is created.
- the receiving module 2001 is further configured to receive a representation status resource creation request, and receive an actual status resource creation request.
- the processing module 2002 is further configured to: create a representation status resource according to the representation status resource creation request; and create an actual status resource according to the actual status resource creation request.
- FIG. 21 is a schematic structural diagram of a common capability component provided by an embodiment of the present application.
- Can include:
- the steps performed by the common capability component in the above embodiment may be based on the common capability component structure shown in FIG. I will not repeat them here.
- the computer program product includes one or more computer instructions.
- the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
- the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a website site, computer, server or data center Transfer to another website site, computer, server, or data center by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL), or wireless (eg, infrared, wireless, microwave, etc.).
- the computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
- the usable medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
- the disclosed system, apparatus, and method may be implemented in other manners.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- a computer readable storage medium A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
- the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Mobile Radio Communication Systems (AREA)
- Computer And Data Communications (AREA)
Abstract
本申请实施例公开了一种设备状态同步的方法,用于公共能力组件完成设备表征状态和实际状态的同步,提高处理效率。本申请实施例方法包括:公共能力组件接收应用发送的第一表征状态实例资源创建请求,第一表征状态实例资源创建请求包括设备状态属性;公共能力组件根据第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建第一表征状态实例资源;公共能力组件向设备发送设备状态更新请求,设备状态更新请求中包含设备状态属性;公共能力组件接收设备发送的实际状态实例资源创建请求;公共能力组件根据实际状态实例资源创建请求,创建实际状态实例资源;公共能力组件向应用发送实际状态资源创建成功的指示信息。
Description
本申请要求于2018年4月20日提交中国国家知识产权局、申请号为201810362144.X、发明名称为“一种设备状态同步的方法及公共能力组件”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及通信领域,尤其涉及一种设备状态同步的方法及公共能力组件。
物联网(internet of things,IoT)***可以由平台、网关、设备以及应用组成,如图1所示,图1是应用、公共能力组件(common services entity,CSE)和设备的交互流程示意图。其中,CSE是物联网***定义的公共能力组件。
当应用想要更新设备的实际状态时,首先发送资源更新请求到CSE来更新设备的表征状态,CSE更新资源状态成功以后向应用返回更新成功响应。设备通过轮询或者订阅的方式监听资源的变化。图2中采用订阅通知的方法,即设备订阅资源的变化,如果资源发生变化,CSE将发送通知给设备,该通知中包含资源变化以后的最新状态。当设备收到通知,检测到资源变化时,先向CSE返回收到通知的响应,通过本地的硬件驱动或者接口更新设备的实际状态。
但是,CSE每次只能允许一个应用更新资源,而且,当CSE收到应用发送的资源更新请求时,会锁定资源,拒绝其他请求,降低***的可用性。
发明内容
本申请实施例提供了一种设备状态同步的方法,用于公共能力组件完成设备表征状态和实际状态的同步,提高处理效率。
有鉴于此,本申请实施例第一方面提供了一种设备状态同步的方法,可以包括:公共能力组件接收应用发送的第一表征状态实例资源创建请求,该第一表征状态实例资源创建请求可以包括设备状态属性;可以理解的是,第一表征状态实例资源创建请求也可以称为更新表征状态资源请求。该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建第一表征状态实例资源;即公共能力组件上维护不止一个表征状态实例资源。该公共能力组件向设备发送设备状态更新请求,该设备状态更新请求中包含该设备状态属性;该公共能力组件接收该设备发送的实际状态实例资源创建请求;该公共能力组件根据该实际状态实例资源创建请求,创建实际状态实例资源;该公共能力组件向该应用发送实际状态资源创建成功的指示信息。
在本申请实施例中,公共能力组件可以维护多个表征状态实例资源,公共能力组件保存设备的表征状态资源和实际状态资源,负责和设备的实际状态之间的同步,提高处理效率。
可选的,在本申请的一些实施例中,该第一表征状态实例资源和该第二表征状态实例资源为表征状态资源的子资源;该表征状态资源可以包括:更新模式和时间模式;其中,该更 新模式可以包括:序列状态或者最新状态;该时间模式包括:时刻模式、时长模式或者混合模式,该混合模式为该时刻模式加该时长模式。
更新模式为序列状态时,表示公共能力组件可以把应用对表征状态资源的请求逐个按次序传递到设备,每个请求都不能忽略,而且请求之间的次序也要保持一致。
更新模式为最新状态时,表示公共能力组件可以对应用发送到表征状态资源的请求进行删减,当公共能力组件发现设备的连接状态为不可达时,公共能力组件只需要保留最新的一个表征状态实例资源,其余旧的表征状态实例资源可以丢弃。当设备恢复连接或者配置了设备地址以后,公共能力组件只需要发送最新的一个表征状态实例资源中的设备状态到设备。
当时间模式是时刻模式时,表示请求需要在指定的时刻在设备侧执行,即需要设备在指定的时刻改变设备状态,例如开关在指定的时刻打开或者关闭。
当时间模式是时长模式时,表示请求需要设备保持执行请求以后的状态达到该的时长长度。
当时间模式是时刻+时长模式时,表示设备需要在特定的时间点改变其状态,并且保持该状态特定长度的时间。
可选的,在本申请的一些实施例中,该第一表征状态实例资源创建请求包括:该表征状态资源的标识,以及第一状态时刻和第一状态时长中的至少一个属性。在本申请实施例中,表征状态资源的标识可以指示该第一表征状态实例资源创建请求是属于表征状态资源的子资源的创建请求。
可选的,在本申请的一些实施例中,该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:该公共能力组件根据该第一状态时刻和第一状态时长中的至少一个属性,以及该第二表征状态实例资源,创建该第一表征状态实例资源。在本申请实施例中,公共能力组件在创建第一表征状态实例资源的时候,具体可以根据该第一状态时刻和第一状态时长中的至少一个属性,以及该第二表征状态实例资源,来创建该第一表征状态实例资源。为创建第一表征状态实例资源,提供了一个可行性的方案。
可选的,在本申请的一些实施例中,该第一表征状态实例资源创建请求可以包括第一状态时刻和第一状态时长;该公共能力组件向该设备发送设备状态更新请求,可以包括:该公共能力组件在该第一状态时刻表示的时间点,向该设备发送该设备状态更新请求,且指示该设备在该第一状态时长表示的时间长度内,保持该设备状态不变。在本申请实施例中,公共能力组件还可以根据第一状态时刻,确定向设备发送设备状态更新请求的时间点,以及指示该设备在该第一状态时长表示的时间长度内,保持该设备状态不变。
可选的,在本申请的一些实施例中,该表征状态资源包括连接状态属性,该连接状态属性指示该公共能力组件与该设备连接的时间段[t1,t2];该表征状态资源的更新模式为该序列状态,时间模式为该时刻模式;该第一表征状态实例资源创建请求包括该第一状态时刻。
该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:若该公共能力组件确定该第一状态时刻落在该时间段[t1,t2]之间,且该第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则该公共能力组件创建该第一表征状态实例资源。
在本申请实施例中,当表征状态资源的更新模式为序列状态,时间模式为时刻模式时,提供了公共能力组件创建第一表征状态实例资源的具体实现方案,增加了该技术方案的可行性。
可选的,在本申请的一些实施例中,该表征状态资源包括连接状态属性,该连接状态属性指示该公共能力组件与该设备连接的时间段[t1,t2];该表征状态资源的更新模式为该序列状态,时间模式为该混合模式;该第一表征状态实例资源创建请求包括该第一状态时刻和该第一状态时长。
该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:
(1)若该公共能力组件确定第一时间段落在该时间段[t1,t2]之间,且该第一时间段与已创建的第二表征状态实例资源的第二时间段未重合,则该公共能力组件创建该第一表征状态实例资源,其中,该第一时间段包括:以该第一状态时刻为起始时刻,时间长度为该第一状态时长;或者,
(2)若该公共能力组件确定该第一状态时刻落在该时间段[t1,t2]之间,且该第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则该公共能力组件创建该第一表征状态实例资源;或者,
(3)若该公共能力组件确定该第一状态时长落在该时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则该公共能力组件创建该第一表征状态实例资源。
在本申请实施例中,当表征状态资源的更新模式为序列状态,时间模式为混合模式时,提供了公共能力组件创建第一表征状态实例资源的具体实现方案,增加了该技术方案的可行性。
可选的,在本申请的一些实施例中,该表征状态资源包括连接状态属性,该连接状态属性指示该公共能力组件与该设备连接的时间段[t1,t2];该表征状态资源的更新模式为该序列状态,时间模式为该时长模式;该第一表征状态实例资源创建请求包括该第一状态时长。
该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:若该公共能力组件确定该第一状态时长落在该时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则该公共能力组件创建该第一表征状态实例资源。
在本申请实施例中,当表征状态资源的更新模式为序列状态,时间模式为时长模式时,提供了公共能力组件创建第一表征状态实例资源的具体实现方案,增加了该技术方案的可行性。
可选的,在本申请的一些实施例中,该表征状态资源包括连接状态属性,该连接状态属性指示该公共能力组件与该设备连接的时间段[t1,t2];该表征状态资源的更新模式为该最新状态,时间模式为该时刻模式;该第一表征状态实例资源创建请求包括该第一状态时刻。
该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:若该公共能力组件确定该第一状态时刻落在该时间段[t1,t2]之间,且该第一状态时刻与已创建的第二表征状态实例资源的第二状态时 刻不相同,则该公共能力组件删除该第二表征状态实例资源,创建该第一表征状态实例资源。
在本申请实施例中,当表征状态资源的更新模式为最新状态,时间模式为时刻模式时,提供了公共能力组件创建第一表征状态实例资源的具体实现方案,增加了该技术方案的可行性。
可选的,在本申请的一些实施例中,该表征状态资源包括连接状态属性,该连接状态属性指示该公共能力组件与该设备连接的时间段[t1,t2];该表征状态资源的更新模式为该最新状态,时间模式为该混合模式;该第一表征状态实例资源创建请求包括该第一状态时刻和该第一状态时长。
该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:
(1)若该公共能力组件确定第一时间段落在该时间段[t1,t2]之间,且该第一时间段与已创建的第二表征状态实例资源的第二时间段重合,则该公共能力组件删除该第二表征状态实例资源,创建该第一表征状态实例资源,其中,该第一时间段包括:以该第一状态时刻为起始时刻,时间长度为该第一状态时长;或者,
(2)若该公共能力组件确定该第一状态时刻落在该时间段[t1,t2]之间,且该第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则该公共能力组件删除该第二表征状态实例资源,创建该第一表征状态实例资源;或者,
(3)若该公共能力组件确定该第一状态时长落在该时间段[t1,t2]之间,且该第一状态时长与该t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段未重合,则该公共能力组件删除该第二表征状态实例资源,创建该第一表征状态实例资源。
在本申请实施例中,当表征状态资源的更新模式为最新状态,时间模式为混合模式时,提供了公共能力组件创建第一表征状态实例资源的具体实现方案,增加了该技术方案的可行性。
可选的,在本申请的一些实施例中,该表征状态资源包括连接状态属性,该连接状态属性指示该公共能力组件与该设备连接的时间段[t1,t2];该表征状态资源的更新模式为该最新状态,时间模式为该时长模式;该第一表征状态实例资源创建请求包括该第一状态时长。
该公共能力组件根据该第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建该第一表征状态实例资源,可以包括:若该公共能力组件确定该第一状态时长落在该时间段[t1,t2]之间,且该第一状态时长与该t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段重合,则该公共能力组件删除该第二表征状态实例资源,创建该第一表征状态实例资源。
在本申请实施例中,当表征状态资源的更新模式为最新状态,时间模式为时长模式时,提供了公共能力组件创建第一表征状态实例资源的具体实现方案,增加了该技术方案的可行性。
可选的,在本申请的一些实施例中,该公共能力组件接收应用发送的第一表征状态实例资源创建请求之前,该方法还可以包括:该公共能力组件接收表征状态资源创建请求;该公共能力组件根据该表征状态资源创建请求,创建表征状态资源;该公共能力组件接收实际状态资源创建请求;该公共能力组件根据该实际状态资源创建请求,创建实际状态资源。
本申请实施例第二方面提供一种公共能力组件,具有公共能力组件完成设备表征状态和实际状态的同步,提高处理效率的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。
本申请实施例又一方面提供一种公共能力组件,可以包括:收发器,用于与所述公共能力组件之外的装置进行通信;存储器,用于存储计算机执行指令;一个或多个处理器,通过总线与所述存储器和所述收发器连接,当所述处理器执行所述存储器中存储的计算机执行指令;以及一个或多个计算机程序,其中,所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述公共能力组件执行时,使得所述公共能力组件执行如上述各方面或各方面任一可选方式所述的方法。
本申请实施例又一方面提供一种无线通信装置,可以包括:
至少一个处理器,存储器,收发电路和总线***,所述处理器,所述存储器,所述收发电路通过所述总线***耦合,所述无线通信装置通过所述收发电路与服务器相通信,所述存储器用于存储程序指令,所述至少一个处理器用于执行所述存储器中存储的所述程序指令,使得所述无线通信装置执行如本申请实施例上述各方面所述的方法中所述终端操作的部分。所述无线通信装置既可以是公共能力组件,也可以是应用在平台、网关、设备中执行相应功能的芯片。
本申请实施例又一方面提供一种存储介质,需要说明的是,本申请技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产口的形式体现出来,该计算机软件产品存储在一个存储介质中,用于储存为上述终端所用的计算机软件指令,其包含用于执行上述各方面为终端所设计的程序,或者,用于储存为上述服务器所用的计算机软件指令,其包含用于执行上述各方面为服务器所设计的程序。
该存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
本申请实施例又一方面提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行如上述各方面或各方面任一可选实现方式中所述的方法。
为了更清楚地说明本申请实施例技术方案,下面将对实施例和现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,还可以根据这些附图获得其它的附图。
图1为现有技术中应用、公共能力组件和设备的交互流程示意图;
图2为本申请实施例中物联网领域国际标准化组织定义的IoT***的架构图;
图3为阻塞式方案的流程示意图;
图4为ThingShadow方案的流程示意图;
图5为本申请实施例所应用的***架构图;
图6为本申请实施例中表征状态资源的一个示意图;
图7为本申请实施例中表征状态实例资源的一个示意图;
图8为本申请实施例中实际状态资源的一个示意图;
图9为本申请实施例中设备状态同步的方法的一个实施例示意图;
图10为本申请实施例中公共能力组件创建表征状态实例资源的一个实施例示意图;
图11为本申请实施例中公共能力组件创建表征状态实例资源的一个示意图;
图12为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图13为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图14为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图15为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图16为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图17为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图18为本申请实施例中公共能力组件创建表征状态实例资源的另一个示意图;
图19为本申请实施例中以oneM2M标准为基础的一个实施例示意图;
图20为本申请实施例中公共能力组件的一个实施例示意图;
图21为本申请实施例中公共能力组件的另一个实施例示意图。
本申请实施例提供了一种设备状态同步的方法,用于公共能力组件完成设备表征状态和实际状态的同步,提高处理效率。
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,都应当属于本申请保护的范围。
在IoT***中,平台、网关和设备在整个物联网体系架构中承担不同的角色,平台作为信息的汇聚者,负责给应用提供调用各种能力的应用程序接口(application program interface,API)接口。网关作为信息的中继者,一方面需要从设备收集和下发数据,一方面需要将数据上报给平台或者从平台接收各种指令。设备是信息的采集者和执行者,广泛存在于各种IoT***的末端,例如温度传感器、伺服电机、车机、机床等等。
例如,如图2所示,图2为物联网领域国际标准化组织oneM2M标准定义的IoT***的架构图。在图2所示的oneM2M架构中,基础能力节点(infrastructure node,IN)是平台,中间节点(middle node,MN)是网关,设备分为应用受限节点(application dedicated node,ADN)和应用服务节点(application service node,ASN)两种,分别适用于受限设备和资源丰富设备。IN、MN、ASN和ADN都是oneM2M定义的设备类型,符合oneM2M的规范。对于不符合oneM2M规范的设备,oneM2M统一使用非oneM2M设备(non-one M2M device node,NoDN)来表示。这种设备符合其他IoT规范例如Z-Wave、ZigBee、蓝牙(bluetooth)等。它们通过互通(Interworking)接入到oneM2M***,因此也可以通过oneM2M定义的接口访问其服务。
在oneM2M定义的节点(Node)中,有的节点拥有公共能力组件(common services entity,CSE),例如基础能力节点(infrastructure node,IN)、中间节点(middle node,MN)、应用服务节点(application service node,ASN)。有的节点没有CSE,例如应用受限节点(application dedicated node,ADN)。CSE是oneM2M定义的公共能力组件,可以包括为不 同行业应用的公共能力,例如:设备注册、设备管理、数据下发和上报、事件的订阅等。CSE对外开放接口方便应用调用这些公共能力。
其中,CSE通过资源的形式对外提供这些公共能力的接口,资源可以理解成CSE持有的一个信息片段,这个信息片段可能是一个文档或者一条数据库记录等。资源记录了CSE对外提供某种服务的上下文环境和服务的内容本身。CSE对外开放的设备注册、数据上报下发等能力都是通过对资源的访问实现的。资源可以被创建(Create)、更新(Update)、获取(Retrieve)和删除(Delete)。从而代表一个CSE提供的公共能力的整个生命周期所提供的接口。创建表示该公共能力的注册和产生,更新可以用来更新该能力的全部或者部分信息,获取可以用来监视公共能力的状态,删除可以销毁和去注册该公共能力。
CSE提供的一个关键的公共能力是设备状态的同步。在IoT***中,设备的服务需要以数字化的形式和IoT***同步以实现对设备服务通过软件定义的网络接口调用。具体的即是数据的上报和下发。数据的上报可以是传感器采集数据以后,将数据上报到平台。注册到平台的应用然后可以通过平台读取该数值。注册到平台的应用也可以通过该能力下发控制命令到平台,控制器通过从平台读取控制命令的具体内容,再执行对应的操作。
在图1所示中,应用具体可以是注册到平台的应用,可以理解为基础能力节点上的应用实体(infrastructure node application entity,IN-AE)。CSE上存储表示设备状态的资源(如设备的表征状态资源)。设备具体可以理解为应用受限节点上的应用实体(application dedicated node application entity,ADN-AE),即设备上的应用,该设备上的应用用来同步设备的实际状态和CSE中的资源状态。
如果CSE到设备之间的链路出现问题,CSE到设备的通知没有及时成功发送,但是CSE上的资源已经被更新,将会造成设备的表征状态和实际状态不一致的情况。如果设备因为硬件故障或者意外宕机,CSE到ADN-AE的通知成功发送,但是设备的实际状态并没有切换,也会造成表征状态和实际状态不一致的情况。
在其中一种实现方式中,如图3所示,图3为阻塞式方案的流程示意图。当CSE收到应用的资源更新请求时,CSE并不立即更新资源,而是将资源锁定,并进一步发送通知到设备。只有当设备实际更新了设备状态之后,设备才会发送成功响应到CSE。CSE只有收到成功响应以后才会执行资源更新动作,并返回更新成功响应到IN-AE。
但是,CSE在资源锁定期间,将会拒绝其他任何请求,造成***的可用性降低。如果设备因为各种原因不能立即响应,将会造成CSE上的资源进入长期锁定状态,使整个***停止。
在另一种实现方式中,例如:ThingShadow是亚马逊网络服务(amazon web service,AWS)IoT中设备状态同步方案。IoT平台中对一个设备维护两个状态,一个desired,一个reported。desired用来表示应用期望设备的状态,reported用来表示设备的实际状态。应用想要获取设备的实际状态时,发送获取请求到IoT平台,访问reported资源;应用想要修改设备的状态时,发送更新请求到IoT平台,访问desired资源。AWS平台根据其他环境逐步同步desired状态和reported状态。如图4所示,图4为ThingShadow方案的流程示意图。
例如,控制一个开关,在AWS ThingShadow模式下,应用先发送更新请求到CSE,访问desired资源,更新desired=ON以打开开关。此时因为设备的实际状态还没有发生变化,所以reported=OFF。设备因为事先订阅了desired来跟踪应用实体对开关的更新请求,当设备 收到desired状态的更新请求以后,更新设备实际状态,如果更新成功,设备再更新reported为ON。应用因为订阅了reported,当reported状态变化为ON时,IN-AE收到通知,得知设备实际状态已经和desired同步。
但是,在这一过程中,因为应用对于设备具体执行指令的时间没有预期,为了等待确认设备状态是否发生改变,可能需要长时间在线以监听设备状态。而这一过程可能非常漫长,使得应用空耗资源。同时在这种方法下,并没有考虑工厂场景下对不同设备的不同更新策略。对每一个应用的指令,设备都是按次序执行,存在资源浪费且不能满足需求。
本申请所要解决的技术问题为:在设备状态托管在平台、网关或其他服务器的情况下,存在表征状态和实际状态之间的同步问题。即需要解决如何同步、何时同步等问题。
如图5所示,图5为本申请实施例所应用的***架构图。本申请在IoT平台、网关或者设备的公共能力组件中同时维护设备的两个状态资源,一个表征状态资源,一个实际状态资源。
需要说明的是,表征状态资源公共能力组件可以是独立的实体设备,也可以部署在IoT平台、网关或者设备上。
表征状态资源包含表征状态实例资源,表征状态实例资源为表征状态资源的子资源。实际状态资源包含实际状态实例资源,实际状态实例资源为实际状态资源的子资源。表征状态资源和实际状态资源都可以有多个子资源。子资源的生命周期依赖于其父资源,若父资源被删除,则其所属的所有子资源都会被删除。表征状态资源可以理解为应用期望设备切换的状态的信息;实际状态资源可以理解为设备实际状态的信息。
公共能力组件中维护的表征状态资源接收应用发送的请求,请求创建一条表征状态实例资源,表征状态实例资源包含应用更新的设备状态。设备监听表征状态实例资源的创建,当设备发现新的表征状态实例资源创建时,根据表征状态实例资源中的设备状态相应的切换设备的状态,设备状态切换成功以后,发送请求到公共能力组件中维护的实际状态资源以创建实际状态实例资源,并保证最新的实际状态实例资源和设备状态是同步的。应用如果想获取设备的当前实际状态,需要获取实际状态资源下最新的实际状态实例资源。
可以理解的是,设备监听表征状态实例资源的创建,可以是设备被动接收公共能力组件发送的表征状态实例资源创建请求成功的指示信息,也可以是设备主动向公共能力组件发送请求,请求表征状态实例资源是否创建成功的指示信息。
表征状态资源由设备或者设备的应用设置,并根据设备的特征,在表征状态资源中设置相应的属性,以规范应用对表征状态资源的创建请求以及公共能力组件向设备传递更新请求的策略。例如对于AGV小车,任何对其表征状态资源的更新请求都会及时传递到设备;相反对于压力控制器设备,对其表征状态资源的更新请求可能会被公共能力组件缓存,公共能力组件只会将最新的一个更新请求发送给设备。如图6所示,图6为本申请实施例中表征状态资源的一个示意图。
实际状态资源由设备或者设备的应用设置,其中包括设备状态以及设备状态的元数据。例如:设备当前状态,以及设备当前状态还需要保持多久的信息等等。以方便平台上的应用确定何时可以发送请求。
其中,设备的表征状态资源中包括各种属性,例如:更新模式、时间模式、设备地址、 连接状态、确定时延等。表征状态资源包括表征状态实例资源。
可以理解的是,(1)更新模式可以是序列状态或者最新状态。
(2)时间模式可以是时刻、时长或者时刻+时长等。
(3)设备地址表示设备可达地址,公共能力组件可以通过该设备地址发送请求给设备。
(4)连接状态表示设备在线的时间安排,即设备在哪些时间段在线,哪些时间段会休眠或者不在线,公共能力组件可以根据连接状态确定是否可以发送请求到设备。
(5)确定时延是在时间确定性网络中,从公共能力组件发送消息到设备成功执行消息所需要的时间。该时间由两部分组成,一部分是网络传输时间,即公共能力组件发送消息到设备的网络时延;另一部分是设备从接收到消息到设备状态实际发生变化的程序时延。确定时延的值等于网络时延和程序时延的和。程序时延设备可以根据自己的软件环境确定,一般是一个固定的数值。网络时延的值在设备上线后根据和公共能力组件的通信时间测得。
其中,更新模式为序列状态时,表示公共能力组件可以把应用对表征状态资源的请求逐个按次序传递到设备,每个请求都不能忽略,而且请求之间的次序也必须保持一致。
更新模式为最新状态时,表示公共能力组件可以对应用发送到表征状态资源的请求进行删减,当公共能力组件发现设备的连接状态为不可达时,公共能力组件只需要保留最新的一个表征状态实例资源,其余旧的表征状态实例资源可以丢弃。当设备恢复连接或者配置了设备地址以后,公共能力组件只需要发送最新的一个表征状态实例资源中的设备状态到设备。
当时间模式是时刻时,表示请求需要在指定的时刻在设备侧执行,即需要设备在指定的时刻改变设备状态,例如开关在指定的时刻打开或者关闭。
当时间模式是时长时,表示请求需要设备保持执行请求以后的状态达到所述的时长长度。
当时间模式是时刻+时长时,表示设备需要在特定的时间点改变其状态,并且保持该状态特定长度的时间。
表征状态实例资源表示的是一个设备状态的实例,表征状态实例资源由以下属性构成:设备状态、状态时刻、状态时长。如图7所示,图7为本申请实施例中表征状态实例资源的一个示意图。
其中设备状态表示应用想要切换设备的状态,例如打开开关即是把设备状态切换成ON,关闭开关即是把设备状态切换成OFF。
状态时刻表示设备在指定时刻切换到特定状态。例如状态时刻等于20171228T122000.000即是指在该时刻切换开关状态到ON或者OFF。
状态时长表示设备切换到特定状态以后需要维持的时间。例如状态时长等于60s表示开关切换到ON以后要至少保持60秒。
部署状态表示该表征状态实例资源是否已经转发给设备并被设备执行。如果已经转发给设备并执行,该属性值为“已部署”;如果还处在待命状态,该属性值为“未部署”;如果设备正在执行过程中,该属性值为“部署中”。
实际状态资源包含实际状态实例资源,实际状态资源可能包含多个实际状态实例资源,其中最新的实际状态实例资源表示当前设备的实际状态,该状态保存在设备状态属性中。如图8所示,图8为本申请实施例中实际状态资源的一个示意图。
在本申请中,所提到的应用,没有进行特别的说明,则认为该应用可以是平台上的应用, 也可以是网关上的应用,也可以是设备上的应用,不做具体限定。公共能力组件保存设备的表征状态资源和实际状态资源,负责和设备的实际状态之间的同步。下面以实施例的方式,对本申请中的方法实施例进行说明,如图9所示,图9为本申请实施例中设备状态同步的方法的一个实施例示意图。即公共能力组件接收应用发送的请求,同步设备状态的流程如下图所示:
901:应用和设备分别向公共能力组件进行注册。
在本申请实施例中,应用和设备分别向公共能力组件进行注册,注册可以包括认证鉴权分配安全秘钥等流程。注册完成之后,应用和设备可以调用公共能力组件提供的公共能力,即可以使用公共能力提供的设备状态同步方法,进行设备状态的同步。
902:公共能力组件接收表征状态资源配置请求。
公共能力组件接收应用或者设备发送的表征状态资源配置请求。表征状态资源配置请求中可以携带设备表征状态资源。该表征状态资源配置请求可能来自设备本身,即设备根据自己的特征在注册完成以后主动向公共能力组件发起表征状态资源创建请求,以向应用开放自己的服务接口。
903、公共能力组件根据表征状态配置请求,创建表征状态资源。
公共能力组件可以根据表征状态资源创建请求,创建表征状态资源。设备表征状态资源创建成功以后,应用可以通过访问该资源控制设备的状态。
904:公共能力组件接收实际状态资源配置请求。
公共能力组件接收应用或者设备发送的实际状态资源配置请求。实际状态资源配置请求中可以携带设备实际状态资源。该实际状态资源配置请求也可以理解为实际状态资源创建请求。可能来自设备本身,设备创建实际状态资源以更新自己的实际状态,以便于应用可以访问设备的实际状态。
905、公共能力组件根据实际状态资源配置请求,创建实际状态资源。
公共能力组件可以根据实际状态资源创建请求,创建实际状态资源。需要说明的是,步骤902和904的时序不做限定。
906:公共能力组件接收应用发送的更新表征状态资源请求。
其中,更新表征状态资源请求中包括表征状态资源标识。更新表征状态资源请求具体可以是表征状态实例资源创建请求,表征状态实例资源为表征状态资源的子资源。
907:公共能力组件根据更新表征状态资源请求,创建表征状态实例资源。
公共能力组件确定表征状态实例资源能否成功创建。如果表征状态实例资源创建成功,根据表征状态实例资源中的信息,在达到预置条件时发送设备状态更新请求到设备。
908:公共能力组件发送设备状态更新请求到设备。
909:设备根据设备状态更新请求中的内容更新设备状态。
910:设备发送实际状态实例资源创建请求到公共能力组件。
即设备状态更新成功以后,设备发送更新实际状态资源请求到公共能力组件。可以理解的是,更新实际状态资源请求可以是实际状态实例资源创建请求。
911:公共能力组件根据实际状态实例资源创建请求,创建实际状态实例资源。
912:公共能力组件发送实际状态资源更新通知到应用。
应用可以得知设备的实际状态已经发生改变。
在本申请实施例中,公共能力组件接收应用发送的第一表征状态实例资源创建请求,所述第一表征状态实例资源创建请求包括设备状态属性;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源;所述公共能力组件向所述设备发送设备状态更新请求,所述设备状态更新请求中包含所述设备状态属性;所述公共能力组件接收所述设备发送的实际状态实例资源创建请求;所述公共能力组件根据所述实际状态实例资源创建请求,创建实际状态实例资源;所述公共能力组件向应用发送实际状态资源更新通知。公共能力组件可以维护多个表征状态实例资源,完成设备表征状态和实际状态的同步,提高处理效率。
如图10所示,图10为本申请实施例中公共能力组件接收应用发送的更新表征状态资源请求;公共能力组件根据更新表征状态资源请求,创建表征状态实例资源的一个实施例示意图,如下所示:
1051:公共能力组件接收应用发送的表征状态实例资源创建请求。
其中,表征状态实例资源创建请求中包括设备状态属性,可选的,还可以包括状态时刻、状态时长等属性。可以理解的是,设备状态表示应用想要设备切换到的新状态。状态时刻表示应用计划在该时刻让设备切换状态。状态时长表示应用计划让设备在该状态下保持特定长度的时间。
表征状态实例资源创建请求中还可以包括所述表征状态资源的标识,表征状态实例资源创建请求中可以同时包含状态时刻和状态时长,也可以只包含其中的任意一个。
1052:公共能力组件确定表征状态资源里面的更新模式为序列状态或者最新状态。
其中,更新模式为序列状态的时候,执行步骤1053,更新模式为最新状态的时候,执行步骤1054。
1053:当表征状态资源的更新模式为序列状态时,进一步确认表征状态资源的时间模式。
若时间模式是时刻,则执行步骤1055;若时间模式是时长,则执行步骤1056;若时间模式是时刻+时长,则执行步骤1057。
1054:当表征状态资源的更新模式为最新状态时,进一步确认表征状态资源的时间模式。
若时间模式是时刻,则执行步骤10510;若时间模式是时长,则执行步骤10511;若时间模式是时刻+时长,则执行步骤10512。
1055:当表征状态资源的更新模式是序列状态,且时间模式是时刻时,说明创建的每一个表征状态实例资源都需要同步到设备,且设备的同步需要遵从具体的时刻。
公共能力组件确定所需要的设备状态是否能够在指定时刻同步到设备。具体的,可以包括,公共能力组件确定在指定的时刻,设备的连接状态是否可达;以及根据连接状态和确定时延确定是否可以在指定的时刻切换设备状态。
如图11所示,图11为公共能力组件创建表征状态实例资源的一个示意图。确定时延是阴影部分表示的时长。公共能力组件收到的表征状态实例资源创建请求中包含状态时刻texe和设备状态,表示公共能力组件需要确保设备可以在texe时刻按照设备状态属性切换设备状态。
在case1的情况下,texe在t1和t2之间,考虑到确定时延的长度,公共能力组件需要 在tsend时刻发送设备状态更新请求到设备,以确保设备能够在确定时延以后切换设备状态。这种情况下,公共能力组件成功创建该表征状态实例资源并返回创建成功响应1059。
在case2的情况下,texe在t1和t2之外,因此,公共能力组件拒绝表征状态实例资源的创建请求,并返回创建失败响应1058。
同时,因为表征状态资源的更新模式是序列状态,公共能力组件还需要确定在已经创建成功的,但是部署状态依然为False的表征状态实例资源中,是否存在和表征状态实例资源创建请求中的表征状态实例资源的状态时刻冲突的表征状态实例资源。如果发现冲突,则返回创建失败响应1058。
如果公共能力组件收到的表征状态实例资源创建请求中携带了状态时长属性,公共能力组件需要返回创建失败响应1058,因为时间模式是时刻,设备不能接受规定时长的时间模式。
1057:当表征状态资源的更新模式是序列模式,且时间模式是时刻+时长时,说明创建的每一个表征状态实例资源都需要同步到设备,且设备的同步需要遵从具体的时刻和时长。
当公共能力组件收到表征状态实例资源创建请求,表征状态实例资源创建请求中包含状态时刻属性、状态时长属性和设备状态属性,表示公共能力组件需要在状态时刻,切换设备到设备状态,并维持状态时长的时间。例如图12所示,图12为公共能力组件创建表征状态实例资源的另一个示意图。
texe0表示表征状态实例资源创建请求中待创建的表征状态实例资源的状态时刻、状态时长。如图12所示。因为更新模式是序列状态,公共能力组件需要确定texe0和已经存在的状态时刻为texe1,texe2,texe3的表征状态实例资源及其状态时长之间的关系,以确定待创建的表征状态实例资源是否可以创建成功。
如果texe0在texe1和texe2之间的空白处,且texe0加状态时长以后仍然没有超过texe2,则表征状态实例资源可以成功创建,公共能力组件创建该表征状态实例资源并返回创建成功响应1059。如果texe0在texe2和texe3之间或其他地方,因为texe0加状态时长,已经和其他已经创建成功的表征状态实例资源之间产生了冲突,所以创建失败,公共能力组件返回创建失败响应1058。
如果表征状态实例资源创建请求只携带了状态时刻或者状态时长中的一个。则需要综合判断该待创建表征状态实例资源和已经存在的表征状态实例资源的状态时刻和状态时长之间的关系以确定能否创建成功。
例如,图13所示,图13为公共能力组件创建表征状态实例资源的另一个示意图。已经存在3个表征状态实例资源,表征状态实例资源1状态时刻为texe1,状态时长如图13所示;表征状态实例资源2没有设置状态时刻,状态时长如图13所示;表征状态实例资源3状态时刻为texe3,没有设置状态时长。待创建表征状态实例资源在三种不同的case时,执行如下过程:
case1:当待创建表征状态实例资源设置了状态时刻为texe01和状态时长,执行过程如前文所述。
case2:当待创建表征状态实例资源只设置了状态时刻为texe02时,只要确定texe02没有和当前已经存在的3个表征状态实例资源相冲突即可以成功创建。
case3:当待创建表征状态实例资源只设置了状态时长,因为没有约束状态时刻,公共能 力组件则确定当前立即执行是否可以成功创建。如果确定当前设备在线,并且当前设备不在一个表征状态实例资源的状态时长内,则成功创建该资源并返回成功响应1059。
否则,顺次确定下一个可以成功创建的时间。例如,图13中所示texe1和表征状态实例资源1有冲突,则可以把待创建表征状态实例资源创建在表征状态实例资源1和表征状态实例资源2之间。
创建成功以后,公共能力组件需要为新创建的表征状态实例资源分配状态时刻属性,该状态时刻属性是公共能力组件根据具体情况分配的具体切换设备状态的时刻。并且公共能力组件需要在创建成功响应中携带该分配的状态时刻属性,以通知应用设备状态切换的时刻。如果在已知的设备在线时间内都找不到可以创建该待创建表征状态实例资源的时间,则返回创建失败响应1058。
1056:当表征状态资源的更新模式是序列模式,且时间模式是时长时,说明创建的每一个表征状态实例资源都需要同步到设备,且设备的同步需要遵从具体的时长。
当公共能力组件收到表征状态实例资源创建请求时,该表征状态实例资源创建请求包含状态时长属性。当表征状态资源下还有其他表征状态实例资源时,该表征状态实例资源创建请求能否成功,如图14所示,图14为公共能力组件创建表征状态实例资源的另一个示意图。
公共能力组件在已知的设备在线的时间段内,确定已经被其他表征状态实例资源预留的时间段之外的第一个其他时间段,创建成功以后返回创建成功响应1059。如步骤1057中case3的描述,此处不再赘述。
10515:如果表征状态资源设置了更新模式但是没有设置时间模式,公共能力组件根据当前设备状态确定该表征状态实例资源是否可以创建,创建以后,立即通知设备执行设备状态更新请求,切换设备状态。
具体的,公共能力组件确定当前设备在线,确定当前设备并没有处在一个需要维持特定状态时长的请求中时,创建该表征状态实例资源,并返回创建成功响应10515。否则返回创建失败响应。
10510:当表征状态资源的更新模式是最新状态,且时间模式是时刻时。
当创建表征状态实例资源时,如果该表征状态实例资源创建请求中包含状态时刻属性,且在该状态时刻,已经存在其他表征状态实例资源,只需要同步最新的表征状态实例资源到设备,旧表征状态实例资源被替换。
具体的,公共能力组件收到表征状态实例资源创建请求,所述表征状态实例资源创建请求包含状态时刻属性。如图15所示,图15为公共能力组件创建表征状态实例资源的另一个示意图。
表征状态资源下已经包含表征状态实例资源1,表征状态实例资源1包含状态时刻的时间为texe1。如果待创建的表征状态实例资源的状态时刻属性中的时刻为texe01,且texe01=texe1,则用待创建表征状态实例资源替换表征状态实例资源1,并返回创建成功响应。如果时刻属性中的时刻为texe02,texe02≠texe1,则直接创建表征状态实例资源,返回成功响应10513。
10511:当表征状态资源的更新模式是最新状态,且时间模式是时刻+时长时。
当创建表征状态实例资源时,如果该表征状态实例资源中包含状态时刻属性或者状态时 长属性,且该状态时刻或者状态时长已经存在其他表征状态实例资源形成冲突(如图16所示,图16为公共能力组件创建表征状态实例资源的另一个示意图),则:
公共能力组件收到表征状态实例资源创建请求,且创建的表征状态资源下已经包含3个表征状态实例资源。在不同的情况下,处理方式不同:
case1:当待创建的表征状态实例资源同时包含状态时长和状态时刻时,如果texe01大于texe1且在表征状态实例资源1的状态时长之内,或者,texe01小于texe1且texe1在待创建表征状态实例资源的状态时长内,或者,待创建表征状态实例资源的状态时长和表征状态实例资源2的状态时长有重叠,或者,texe3落在了待创建的表征状态实例资源的状态时长之内。成功创建该表征状态实例资源,相应的,冲突的表征状态实例资源1,2或者3被替换删除,并返回成功响应10513。
case2:当待创建的表征状态实例资源只包含时刻时,如果和表征状态实例资源存在冲突。例如texe02在表征状态实例资源1或者2的状态时长之内,或者texe02=texe3,成功创建该表征状态实例资源。相应的,冲突的表征状态实例资源1,2或者3被替换删除,并返回成功响应10513。
case3:当待创建的表征状态实例资源只包含状态时长,公共能力组件确定第一个设备可达的时间,例如上图16中t1,成功创建并替换有冲突的其他表征状态实例资源,返回创建成功响应10513。如果在要求的状态时长内有其他表征状态实例资源,例如图16中的表征状态实例资源1,则替换该资源。公共能力组件在创建表征状态实例资源时,需要根据情况,为状态时刻分配具体的值表示设备将会在该时刻切换状态。并在成功响应中携带状态时刻。
在case1和case2情况中,如果待创建的表征状态实例资源和当前正在执行的其他表征状态实例资源的状态时长相冲突,则创建失败,返回创建失败响应10514。如图17所示,图17为公共能力组件创建表征状态实例资源的另一个示意图。
如果当前时间如图17中虚线所示,公共能力组件已经执行了表征状态实例资源1,部署状态从“未部署”,切换成了“部署中”。对于case 1和case 2如果texe01或者texe02的时间和表征状态实例资源1的状态时长冲突,则需要拒绝表征状态实例资源的创建请求。对于case 3,公共能力组件寻找第一个设备可达的时间应该从表征状态实例资源1执行完毕,部署状态切换成“已部署”以后开始搜索。
10512:当表征状态资源的更新模式是最新状态,且时间模式是时长时。
说明当创建表征状态实例资源时,如果该表征状态实例资源中包含状态时长属性,且该状态时长和已经创建了的其他表征状态实例资源冲突,如图18所示,图18为公共能力组件创建表征状态实例资源的另一个示意图。执行如下步骤。
公共能力组件在设备可达的第一个可用时间段内,例如上图18中的t1开始,创建该表征状态实例资源。如果和其他表征状态实例资源发生冲突,例如图18中的表征状态实例资源1,则替换删除表征状态实例资源1。公共能力组件同时需要根据情况为创建的表征状态实例资源分配状态时刻,并在响应中携带该状态时刻,以通知应用设备状态实际切换的时间。
在本申请实施例中,主要介绍了公共能力组件如何成功创建表征状态实例资源的详细说明,增加了方案的可行性。
实施例2:如图19所示,图19是本申请以oneM2M标准为基础的一个实施例示意图。MN-CSE 是中间节点公共能力中间件,通过oneM2M定义的Mca接口和灯的开关相连,开关相当于设备。同时AE作为应用也和MN-CSE公共能力组件相连接。
(1)以oneM2M为例进行说明,oneM2M中更新模式为序列状态。
oneM2M采用容器(container)资源表征设备的状态,例如一个开关设备使用container资源来表征其ON或者OFF的状态。container包含一个或者多个实例(contentInstance)子资源,每个contentInstance子资源表示一条开关状态的历史记录。每个contentInstance子资源包含创建时间(creationTime),内容(content)等属性。其中creationTime是这条contentInstance的创建时间,content即是ON或者OFF的值。container资源下可能有多个contentInstance,其中creationTime最新的一个,即是开关当前的状态。
container资源即是本申请中的表征状态资源和实际状态资源。例如,通过oneM2M协议控制开关,创建两个container资源分别表示针对这个开关的表征状态资源和实际状态资源。container下的contentInstance是表征状态实例资源和实际状态实例资源。
A101:MN-AE和AE分别和MN-CSE注册。
具体的表现在分别发送创建应用实体(Create AE)请求到MN-CSE,注册以后,MN-CSE的CSEBase资源下分别创建MN-AE和AE对应的AE资源。如图19所示,AE创建的AE资源为CSEBase的子资源。AE资源包含属性接入点(pointOfAccess)是开关设备的访问地址。
例如:为http://1.1.1.1:8080/app,MN-CSE可以通过该地址访问AE;schedule是AE的连接状态,表示AE的可达时间段;determineDelay是发送请求到AE并被AE成功执行的往返时间,该时间由AE根据其本地环境确定(例如程序执行时间,和MN-CSE之间的网络延迟等)。
A102:AE发送资源创建(create container)请求到MN-CSE,请求访问AE资源的地址。
在AE资源下创建container子资源,该container子资源包括如下属性:stateType为desired,表示该container资源是表征状态资源;更新模式(updateMode)为序列状态(sequence),表示MN-CSE在同步container资源状态到AE的时候为序列状态;时间模式(timeMode)表示同步的时间模式。该container资源的ID是container-desired
A103:AE发送create container请求到MN-CSE,请求访问AE资源的地址。
在AE下创建container子资源,该container子资源包含的属性状态类型(stateType)为实际(actual),表示该container资源是实际状态资源。该container资源的ID是container-actual。
A104:MN-AE发送create contentInstance到container-desired。
该contentInstance的ID为contentInstance-0,contentInstance-0包含表示设备状态的content属性为ON表示打开开关;表示状态时刻的stateTime属性表示在特定时刻打开开关;表示状态时长的stateDuration为表示持续时间。
A105:MN-CSE首先确定container-desired下所有isDeployed为false的contentInstance资源,这些资源状态都还没有同步到AE。
假如为contentInstance-1,contentInstance-2,contentInstance-3。再根据contentInstance-0和contentInstance-1,2,3资源以及AE资源的schedule属性、determineDelay属性和timeMode确定contentInstance-0是否可以创建。分为如下几种情 况:(time表示stateTime属性,duration表示stateDuration属性)
表1
在上面表1所示中,AE的schedule属性是20180130T000000:000到20180130T006000:000的一个小时,这里为了表述简单写成00~60。每个contentInstance的stateTime的数字表示的都是从00开始的分钟数。stateDuration表示的是持续的分钟数。从MN-CSE发出消息到开关实际切换状态的时间determineDelay是1s。timeMode是TIME表示时间模式是时刻,MIXED表示是时刻+时长,DURATION表示时长。根据待创建的contentInstance资源和container-desired下已经有的三个contentInstance资源的状态,具体可以分成7种情况如上表所示。根据步骤905的描述,具体解释如下:
Case1:因为contentInstance-0和contentInstance-1,2,3之间没有冲突关系,所以创建成功。
Case2:因为contentInstance-0的stateTime超过了AE的schedule的可达时间,所以创建失败。
Case3:因为contentInstance-0和contentInstance-1的stateTime有冲突,所以创建失败。
Case4:因为contentInstance-0的时间段正好可以嵌入在AE的schedule开始时间和contentInstance-1的开始时间之间,所以创建成功。
Case5:contentInstance-0的开始时间正好在contentInstance-1之后,但是duration和contentInstance-2有冲突,所以创建失败。
Case6:contentInstance-0的stateTime恰好在contentInstance-1和contentInstance-2之间的空闲时间,所以创建成功。
Case7:contentInstance-0的duration是10,MN-CSE在AE的可达时间内确定的第一个符合条件的时间段是0~10,所以创建成功,并设置contentInstance-0的stateTime为0。
Case8:contentInstance-0的duration是15,MN-CSE在AE的可达时间内确定的第一个符合条件的时间段是contentInstance-1结束以后15~30,所以创建成功,并设置 contentInstance-0的stateTime是15。
Case9:contentInstance-0的duration是20,MN-CSE在AE的可达时间内没有合适的时间段可以创建成功,所以创建失败。
A106:MN-CSE在到达container-desired下多个contentInstance子资源中第一个状态时刻减去determineDelay的时刻发送备状态更新请求到AE,备状态更新请求中携带contentInstance中的content属性内容。
A107:AE根据从MN-CSE收到的设备状态更新请求切换设备状态。
A108:AE更新设备状态以后,发送Create contentInstance请求到MN-CSE,请求访问container-actual,用来表示设备当前已经成功切换状态。Create contentInstance请求中携带设备当前的实际状态。
A109:MN-CSE收到请求以后创建contentInstance资源。
A110:MN-CSE发送通知给MN-AE,表示设备状态已经成功切换。
(2)以oneM2M为例进行说明,oneM2M中更新模式为最新状态。
在该实施例中,不同点在于container-desired的更新模式(updateMode)是最新状态(Latest),表示同一时间只需要对最后一个请求进行响应即可。
B101:MN-AE和AE分别和MN-CSE注册。同A101。
B102:AE发送Create Container请求到MN-CSE,请求访问AE资源的地址。在AE资源下创建container子资源,该container子资源包括如下属性:stateType为desired,表示该container资源是表征状态资源;updateMode为latest,表示MN-CSE在同步container资源状态到AE的时候为最新状态;timeMode表示同步的时间模式。该container资源的ID是container-desired。
B103:AE发送create container请求到MN-CSE,请求访问AE资源的地址。同A103。
B104:MN-AE发送create contentInstance到container-desired。同A104。
B105:MN-CSE首先确定container-desired下所有isDeployed为false的contentInstance资源,这些资源状态都还没有同步到AE,假如为contentInstance-1,contentInstance-2,contentInstance-3。再根据contentInstance-0和contentInstance-1,2,3资源以及AE资源的schedule属性、determineDelay属性和timeMode确定contentInstance-0是否可以创建。分为如下几种情况:(time表示stateTime属性,duration表示stateDuration属性)
表2
在上面的例子中,AE的schedule属性是20180130T000000:000到20180130T006000:000的一个小时,这里为了表述简单写成00~60。每个contentInstance的stateTime的数字表示的都是从00开始的分钟数。stateDuration表示的是持续的分钟数。从MN-CSE发出消息到开关实际切换状态的时间determineDelay是1s。timeMode是TIME表示时间模式是时刻,MIXED表示是时刻+时长,DURATION表示时长。根据待创建的contentInstance资源和container-desired下已经有的三个contentInstance资源的状态,具体可以分成7种情况如上表所示。根据步骤905的描述,具体解释如下:
case1:contentInstance-0和contentInstance-1冲突,创建成功,contentInstance-1被替换。
case2:contentInstance-0和contentInstance-2冲突,创建成功,contentInstance-2被替换。
case3:contentInstance-0和contentInstance-1冲突,创建成功,contentInstance-1被替换。
case4:MN-CSE收到请求以后创建contentInstance-0,因为contentInstance-0和contentInstance-1有冲突,所以contentInstance-1被替换。
B106:MN-CSE在到达container-desired下多个contentInstance子资源中第一个状态时刻减去determineDelay的时刻发送备状态更新请求到AE,备状态更新请求中携带contentInstance中的content属性内容。同A106。
B107:AE根据从MN-CSE收到的设备状态更新请求切换设备状态。同A107。
B108:AE更新设备状态以后,发送Create contentInstance请求到MN-CSE,请求访问container-actual,用来表示设备当前已经成功切换状态。Create contentInstance请求中携带设备当前的实际状态。同A108。
B109:MN-CSE收到请求以后创建contentInstance资源。同A109。
B110:MN-CSE发送通知给MN-AE,表示设备状态已经成功切换。同A110。
示例性的,在实际应用场景中,通过本申请技术方案,当应用控制设备执行某种操作时,在不同的情况下可以达到不同的效果:
(1)对所有应用下发的指令能够按次序执行。例如在工厂内负责搬运货物的自动导引车(automated guided vehicle,AGV)小车,应用通过平台发送指令命令机器人搬运物料。每个指令到包含源地址和目的地址。因此每一道应用发放的请求都必须执行,否则会造成货物积压或者物料供应不足。
(2)需要执行最新的一个指令。例如控制压力、液位、油位、炉温等。因为变化过程缓慢,而且作用时间周期较长,所以在较多控制指令序列化到达的情况下,如果前面的指令执行尚未结束或者还未执行,则可以直接跳过只执行最新的指令。
(3)需要在指定的时间执行指令。在生产控制过程中,有大量时间敏感的操作,例如控 制传送带的速率,控制组装机器人之间的配合关系等。这种操作要求指令须在确定的时间执行,产线可以正常运行,否则可能造成产线停止,器械碰撞等严重问题。
(4)需要设备运转特定时间长度。在一些工业场景中,例如装置的冷却、排风等,根据冷却装置或者排风装置的效率,为了达到较好的冷却或者排风效果,须保证设备的运转状态达到指定的长度,否则会造成意外。
如图20所示,图20为本申请实施例中公共能力组件的另一个实施例示意图。
接收模块2001,用于接收应用发送的第一表征状态实例资源创建请求,第一表征状态实例资源创建请求包括设备状态属性;接收设备发送的实际状态实例资源创建请求;
处理模块2002,用于根据第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建第一表征状态实例资源;根据实际状态实例资源创建请求,创建实际状态实例资源;
发送模块2003,用于向设备发送设备状态更新请求,设备状态更新请求中包含设备状态属性;向应用发送实际状态资源创建成功的指示信息。
可选的,在本申请的一些实施例中,第一表征状态实例资源和第二表征状态实例资源为表征状态资源的子资源;
表征状态资源包括:更新模式和时间模式;
其中,更新模式包括:序列状态或者最新状态;
时间模式包括:时刻模式、时长模式或者混合模式,混合模式为时刻模式加时长模式。
可选的,在本申请的一些实施例中,第一表征状态实例资源创建请求包括:表征状态资源的标识,以及第一状态时刻和第一状态时长中的至少一个属性。
可选的,在本申请的一些实施例中,
处理模块2002,具体用于根据第一状态时刻和第一状态时长中的至少一个属性,以及第二表征状态实例资源,创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,第一表征状态实例资源创建请求包括第一状态时刻和第一状态时长;
发送模块2003,具体用于在第一状态时刻表示的时间点,向设备发送设备状态更新请求,且指示设备在第一状态时长表示的时间长度内,保持设备状态不变。
可选的,在本申请的一些实施例中,表征状态资源包括连接状态属性,连接状态属性指示公共能力组件与设备连接的时间段[t1,t2];
表征状态资源的更新模式为序列状态,时间模式为时刻模式;
第一表征状态实例资源创建请求包括第一状态时刻;
处理模块2002,具体用于若确定第一状态时刻落在时间段[t1,t2]之间,且第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,表征状态资源包括连接状态属性,连接状态属性指示公共能力组件与设备连接的时间段[t1,t2];
表征状态资源的更新模式为序列状态,时间模式为混合模式;
第一表征状态实例资源创建请求包括第一状态时刻和第一状态时长;
处理模块2002,具体用于若确定第一时间段落在时间段[t1,t2]之间,且第一时间段与 已创建的第二表征状态实例资源的第二时间段未重合,则创建第一表征状态实例资源,其中,第一时间段包括:以第一状态时刻为起始时刻,时间长度为第一状态时长;
或者,
处理模块2002,具体用于若确定第一状态时刻落在时间段[t1,t2]之间,且第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则创建第一表征状态实例资源;
或者,
处理模块2002,具体用于若确定第一状态时长落在时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,表征状态资源包括连接状态属性,连接状态属性指示公共能力组件与设备连接的时间段[t1,t2];
表征状态资源的更新模式为序列状态,时间模式为时长模式;
第一表征状态实例资源创建请求包括第一状态时长;
处理模块2002,具体用于若确定第一状态时长落在时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,表征状态资源包括连接状态属性,连接状态属性指示公共能力组件与设备连接的时间段[t1,t2];
表征状态资源的更新模式为最新状态,时间模式为时刻模式;
第一表征状态实例资源创建请求包括第一状态时刻;
处理模块2002,具体用于若确定第一状态时刻落在时间段[t1,t2]之间,且第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则删除第二表征状态实例资源,创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,表征状态资源包括连接状态属性,连接状态属性指示公共能力组件与设备连接的时间段[t1,t2];
表征状态资源的更新模式为最新状态,时间模式为混合模式;
第一表征状态实例资源创建请求包括第一状态时刻和第一状态时长;
处理模块2002,具体用于若确定第一时间段落在时间段[t1,t2]之间,且第一时间段与已创建的第二表征状态实例资源的第二时间段重合,则删除第二表征状态实例资源,创建第一表征状态实例资源,其中,第一时间段包括:以第一状态时刻为起始时刻,时间长度为第一状态时长;
或者,
处理模块2002,具体用于若确定第一状态时刻落在时间段[t1,t2]之间,且第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则删除第二表征状态实例资源,创建第一表征状态实例资源;
或者,
处理模块2002,具体用于若确定第一状态时长落在时间段[t1,t2]之间,且第一状态时长与t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段未重合,则删除第二表征状态实例资源,创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,表征状态资源包括连接状态属性,连接状态属性指 示公共能力组件与设备连接的时间段[t1,t2];
表征状态资源的更新模式为最新状态,时间模式为时长模式;
第一表征状态实例资源创建请求包括第一状态时长;
处理模块2002,具体用于若确定第一状态时长落在时间段[t1,t2]之间,且第一状态时长与t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段重合,则删除第二表征状态实例资源,创建第一表征状态实例资源。
可选的,在本申请的一些实施例中,
接收模块2001,还用于接收表征状态资源创建请求;接收实际状态资源创建请求;
处理模块2002,还用于根据表征状态资源创建请求,创建表征状态资源;根据实际状态资源创建请求,创建实际状态资源。
如图21所示,图21是本申请实施例提供的一种公共能力组件的结构示意图。可以包括:
收发器2101、存储器2102和处理器2103,其中,收发器2101、存储器2102和处理器2103互相之间通过总线连接。上述实施例中由公共能力组件所执行的步骤可以基于该图21所示的公共能力组件结构。此处不再赘述。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的***,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个 单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。
Claims (26)
- 一种设备状态同步的方法,其特征在于,包括:公共能力组件接收应用发送的第一表征状态实例资源创建请求,所述第一表征状态实例资源创建请求包括设备状态属性;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建第一表征状态实例资源;所述公共能力组件向设备发送设备状态更新请求,所述设备状态更新请求中包含所述设备状态属性;所述公共能力组件接收所述设备发送的实际状态实例资源创建请求;所述公共能力组件根据所述实际状态实例资源创建请求,创建实际状态实例资源;所述公共能力组件向所述应用发送实际状态资源创建成功的指示信息。
- 根据权利要求1所述的方法,其特征在于,所述第一表征状态实例资源和所述第二表征状态实例资源为表征状态资源的子资源;所述表征状态资源包括:更新模式和时间模式;其中,所述更新模式包括:序列状态或者最新状态;所述时间模式包括:时刻模式、时长模式或者混合模式,所述混合模式为所述时刻模式加所述时长模式。
- 根据权利要求2所述的方法,其特征在于,所述第一表征状态实例资源创建请求包括:所述表征状态资源的标识,以及第一状态时刻和第一状态时长中的至少一个属性。
- 根据权利要求3所述的方法,其特征在于,所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:所述公共能力组件根据所述第一状态时刻和第一状态时长中的至少一个属性,以及所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求1-4任一项所述的方法,其特征在于,所述第一表征状态实例资源创建请求包括第一状态时刻和第一状态时长;所述公共能力组件向所述设备发送设备状态更新请求,包括:所述公共能力组件在所述第一状态时刻表示的时间点,向所述设备发送所述设备状态更新请求,且指示所述设备在所述第一状态时长表示的时间长度内,保持所述设备状态不变。
- 根据权利要求3所述的方法,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述序列状态,时间模式为所述时刻模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:若所述公共能力组件确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则所述公共能力组件创建所述第一表征状态实例资源。
- 根据权利要求3所述的方法,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述序列状态,时间模式为所述混合模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻和所述第一状态时长;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:若所述公共能力组件确定第一时间段落在所述时间段[t1,t2]之间,且所述第一时间段与已创建的第二表征状态实例资源的第二时间段未重合,则所述公共能力组件创建所述第一表征状态实例资源,其中,所述第一时间段包括:以所述第一状态时刻为起始时刻,时间长度为所述第一状态时长;或者,若所述公共能力组件确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则所述公共能力组件创建所述第一表征状态实例资源;或者,若所述公共能力组件确定所述第一状态时长落在所述时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则所述公共能力组件创建所述第一表征状态实例资源。
- 根据权利要求3所述的方法,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述序列状态,时间模式为所述时长模式;所述第一表征状态实例资源创建请求包括所述第一状态时长;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:若所述公共能力组件确定所述第一状态时长落在所述时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则所述公共能力组件创建所述第一表征状态实例资源。
- 根据权利要求3所述的方法,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述最新状态,时间模式为所述时刻模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:若所述公共能力组件确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则所述公共能力组 件删除所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求3所述的方法,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述最新状态,时间模式为所述混合模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻和所述第一状态时长;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:若所述公共能力组件确定第一时间段落在所述时间段[t1,t2]之间,且所述第一时间段与已创建的第二表征状态实例资源的第二时间段重合,则所述公共能力组件删除所述第二表征状态实例资源,创建所述第一表征状态实例资源,其中,所述第一时间段包括:以所述第一状态时刻为起始时刻,时间长度为所述第一状态时长;或者,若所述公共能力组件确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则所述公共能力组件删除所述第二表征状态实例资源,创建所述第一表征状态实例资源;或者,若所述公共能力组件确定所述第一状态时长落在所述时间段[t1,t2]之间,且所述第一状态时长与所述t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段未重合,则所述公共能力组件删除所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求3所述的方法,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述最新状态,时间模式为所述时长模式;所述第一表征状态实例资源创建请求包括所述第一状态时长;所述公共能力组件根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建所述第一表征状态实例资源,包括:若所述公共能力组件确定所述第一状态时长落在所述时间段[t1,t2]之间,且所述第一状态时长与所述t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段重合,则所述公共能力组件删除所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求1-11任一项所述的方法,其特征在于,所述公共能力组件接收应用发送的第一表征状态实例资源创建请求之前,所述方法还包括:所述公共能力组件接收表征状态资源创建请求;所述公共能力组件根据所述表征状态资源创建请求,创建表征状态资源;所述公共能力组件接收实际状态资源创建请求;所述公共能力组件根据所述实际状态资源创建请求,创建实际状态资源。
- 一种公共能力组件,其特征在于,包括:接收模块,用于接收应用发送的第一表征状态实例资源创建请求,所述第一表征状态 实例资源创建请求包括设备状态属性;接收所述设备发送的实际状态实例资源创建请求;处理模块,用于根据所述第一表征状态实例资源创建请求和已创建的第二表征状态实例资源,创建第一表征状态实例资源;根据所述实际状态实例资源创建请求,创建实际状态实例资源;发送模块,用于向设备发送设备状态更新请求,所述设备状态更新请求中包含所述设备状态属性;向所述应用发送实际状态资源创建成功的指示信息。
- 根据权利要求13所述的公共能力组件,其特征在于,所述第一表征状态实例资源和所述第二表征状态实例资源为表征状态资源的子资源;所述表征状态资源包括:更新模式和时间模式;其中,所述更新模式包括:序列状态或者最新状态;所述时间模式包括:时刻模式、时长模式或者混合模式,所述混合模式为所述时刻模式加所述时长模式。
- 根据权利要求14所述的公共能力组件,其特征在于,所述第一表征状态实例资源创建请求包括:所述表征状态资源的标识,以及第一状态时刻和第一状态时长中的至少一个属性。
- 根据权利要求15所述的公共能力组件,其特征在于,所述处理模块,具体用于根据所述第一状态时刻和第一状态时长中的至少一个属性,以及所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求13-16任一项所述的公共能力组件,其特征在于,所述第一表征状态实例资源创建请求包括第一状态时刻和第一状态时长;所述发送模块,具体用于在所述第一状态时刻表示的时间点,向所述设备发送所述设备状态更新请求,且指示所述设备在所述第一状态时长表示的时间长度内,保持所述设备状态不变。
- 根据权利要求15所述的公共能力组件,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述序列状态,时间模式为所述时刻模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻;所述处理模块,具体用于若确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则创建所述第一表征状态实例资源。
- 根据权利要求15所述的公共能力组件,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述序列状态,时间模式为所述混合模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻和所述第一状态时长;所述处理模块,具体用于若确定第一时间段落在所述时间段[t1,t2]之间,且所述第一时间段与已创建的第二表征状态实例资源的第二时间段未重合,则创建所述第一表征状 态实例资源,其中,所述第一时间段包括:以所述第一状态时刻为起始时刻,时间长度为所述第一状态时长;或者,所述处理模块,具体用于若确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则创建所述第一表征状态实例资源;或者,所述处理模块,具体用于若确定所述第一状态时长落在所述时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则创建所述第一表征状态实例资源。
- 根据权利要求15所述的公共能力组件,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述序列状态,时间模式为所述时长模式;所述第一表征状态实例资源创建请求包括所述第一状态时长;所述处理模块,具体用于若确定所述第一状态时长落在所述时间段[t1,t2]中除去已创建的第二表征状态实例资源的第二时间段之外的任一空闲时间段,则创建所述第一表征状态实例资源。
- 根据权利要求15所述的公共能力组件,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述最新状态,时间模式为所述时刻模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻;所述处理模块,具体用于若确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则删除所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求15所述的公共能力组件,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述最新状态,时间模式为所述混合模式;所述第一表征状态实例资源创建请求包括所述第一状态时刻和所述第一状态时长;所述处理模块,具体用于若确定第一时间段落在所述时间段[t1,t2]之间,且所述第一时间段与已创建的第二表征状态实例资源的第二时间段重合,则删除所述第二表征状态实例资源,创建所述第一表征状态实例资源,其中,所述第一时间段包括:以所述第一状态时刻为起始时刻,时间长度为所述第一状态时长;或者,所述处理模块,具体用于若确定所述第一状态时刻落在所述时间段[t1,t2]之间,且所述第一状态时刻与已创建的第二表征状态实例资源的第二状态时刻不相同,则删除所述 第二表征状态实例资源,创建所述第一表征状态实例资源;或者,所述处理模块,具体用于若确定所述第一状态时长落在所述时间段[t1,t2]之间,且所述第一状态时长与所述t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段未重合,则删除所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求15所述的公共能力组件,其特征在于,所述表征状态资源包括连接状态属性,所述连接状态属性指示所述公共能力组件与所述设备连接的时间段[t1,t2];所述表征状态资源的更新模式为所述最新状态,时间模式为所述时长模式;所述第一表征状态实例资源创建请求包括所述第一状态时长;所述处理模块,具体用于若确定所述第一状态时长落在所述时间段[t1,t2]之间,且所述第一状态时长与所述t1得到的第三时间段与已创建的第二表征状态实例资源的第二时间段重合,则删除所述第二表征状态实例资源,创建所述第一表征状态实例资源。
- 根据权利要求13-23任一项所述的公共能力组件,其特征在于,所述接收模块,还用于接收表征状态资源创建请求;接收实际状态资源创建请求;所述处理模块,还用于根据所述表征状态资源创建请求,创建表征状态资源;根据所述实际状态资源创建请求,创建实际状态资源。
- 一种公共能力组件,其特征在于,包括:收发器,用于与所述公共能力组件之外的装置进行通信;存储器,用于存储计算机执行指令;一个或多个处理器,通过总线与所述存储器和所述收发器连接,当所述处理器执行所述存储器中存储的计算机执行指令,所述公共能力组件执行如权利要求1-12任一项所述的方法。
- 一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行如权利要求1-12任意一项所述的方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP19788007.3A EP3780494A4 (en) | 2018-04-20 | 2019-04-17 | DEVICE STATE SYNCHRONIZATION PROCESS AND COMMON CAPACITY COMPONENT |
US17/075,437 US11496564B2 (en) | 2018-04-20 | 2020-10-20 | Device state synchronization method and common capability component |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810362144.X | 2018-04-20 | ||
CN201810362144.XA CN110391927B (zh) | 2018-04-20 | 2018-04-20 | 一种设备状态同步的方法及公共能力组件 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/075,437 Continuation US11496564B2 (en) | 2018-04-20 | 2020-10-20 | Device state synchronization method and common capability component |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019201258A1 true WO2019201258A1 (zh) | 2019-10-24 |
Family
ID=68240467
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/082957 WO2019201258A1 (zh) | 2018-04-20 | 2019-04-17 | 一种设备状态同步的方法及公共能力组件 |
Country Status (4)
Country | Link |
---|---|
US (1) | US11496564B2 (zh) |
EP (1) | EP3780494A4 (zh) |
CN (2) | CN113162987B (zh) |
WO (1) | WO2019201258A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP4170988A4 (en) * | 2020-06-22 | 2024-06-12 | BOE Technology Group Co., Ltd. | RESOURCE GUIDE METHOD, DEVICE AND STORAGE MEDIUM |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105323228A (zh) * | 2014-07-30 | 2016-02-10 | 中兴通讯股份有限公司 | 更新资源通告的方法、本地公共业务实体及*** |
WO2016173280A1 (zh) * | 2015-04-28 | 2016-11-03 | 中兴通讯股份有限公司 | 监控管理方法及装置 |
CN106714199A (zh) * | 2015-11-13 | 2017-05-24 | 中兴通讯股份有限公司 | 获取承载网的网络状态信息的方法及装置 |
CN107026882A (zh) * | 2016-02-02 | 2017-08-08 | 华为技术有限公司 | 一种资源获取的方法及相关设备 |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8429236B2 (en) * | 2009-04-08 | 2013-04-23 | Research In Motion Limited | Transmission of status updates responsive to status of recipient application |
US8504933B2 (en) * | 2010-05-28 | 2013-08-06 | Microsoft Corporation | Translating overlapping states into representative states |
CN103546433B (zh) * | 2012-07-12 | 2017-06-30 | 阿里巴巴集团控股有限公司 | 信息同步***和方法 |
KR101432128B1 (ko) * | 2013-01-29 | 2014-08-21 | 주식회사 케이티 | M2m 네트워크상에서의 리소스를 디바이스 오브젝트로 추상화하는 m2mm 플랫폼 |
US9887889B1 (en) * | 2013-07-15 | 2018-02-06 | Amazon Technologies, Inc. | State reconciliation using event tracking and polling |
US10523537B2 (en) * | 2015-06-30 | 2019-12-31 | Amazon Technologies, Inc. | Device state management |
CN107484211B (zh) * | 2016-06-08 | 2020-06-26 | 华为技术有限公司 | 切换接入点的方法及装置 |
CN106776947A (zh) * | 2016-12-02 | 2017-05-31 | 乐视控股(北京)有限公司 | 资源获取方法、装置及终端 |
CN106453657A (zh) * | 2016-12-07 | 2017-02-22 | 海信集团有限公司 | 智能家居设备的状态信息更新方法及装置 |
-
2018
- 2018-04-20 CN CN202110329097.0A patent/CN113162987B/zh active Active
- 2018-04-20 CN CN201810362144.XA patent/CN110391927B/zh active Active
-
2019
- 2019-04-17 EP EP19788007.3A patent/EP3780494A4/en active Pending
- 2019-04-17 WO PCT/CN2019/082957 patent/WO2019201258A1/zh unknown
-
2020
- 2020-10-20 US US17/075,437 patent/US11496564B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105323228A (zh) * | 2014-07-30 | 2016-02-10 | 中兴通讯股份有限公司 | 更新资源通告的方法、本地公共业务实体及*** |
WO2016173280A1 (zh) * | 2015-04-28 | 2016-11-03 | 中兴通讯股份有限公司 | 监控管理方法及装置 |
CN106714199A (zh) * | 2015-11-13 | 2017-05-24 | 中兴通讯股份有限公司 | 获取承载网的网络状态信息的方法及装置 |
CN107026882A (zh) * | 2016-02-02 | 2017-08-08 | 华为技术有限公司 | 一种资源获取的方法及相关设备 |
Non-Patent Citations (1)
Title |
---|
See also references of EP3780494A4 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP4170988A4 (en) * | 2020-06-22 | 2024-06-12 | BOE Technology Group Co., Ltd. | RESOURCE GUIDE METHOD, DEVICE AND STORAGE MEDIUM |
Also Published As
Publication number | Publication date |
---|---|
EP3780494A1 (en) | 2021-02-17 |
EP3780494A4 (en) | 2021-05-26 |
CN110391927B (zh) | 2021-03-30 |
CN110391927A (zh) | 2019-10-29 |
US20210037093A1 (en) | 2021-02-04 |
US11496564B2 (en) | 2022-11-08 |
CN113162987A (zh) | 2021-07-23 |
CN113162987B (zh) | 2022-09-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102095436B1 (ko) | 서비스 계층에서의 요청 처리 | |
KR102323696B1 (ko) | 서비스 가입 방법 및 장치 | |
US9438601B2 (en) | Operating group resources in sub-groups and nested groups | |
US20230143979A1 (en) | Resource acquisition method, resource scheduling method, terminal, service node, and medium | |
US11184428B2 (en) | Distributed transaction management in a network service layer | |
WO2011150707A1 (zh) | 一种m2m业务中终端状态或事件管理的方法及*** | |
WO2018000202A1 (zh) | 一种负载迁移方法、装置及*** | |
US20160241635A1 (en) | M2m data querying and invoking methods, querying and invoking devices, and system | |
AU2018453104B2 (en) | Subscription message processing method and apparatus, and computer device and storage medium | |
WO2016127612A1 (zh) | 监控处理方法及装置 | |
CN102307194B (zh) | 一种通用协议进程平滑重启方法和装置 | |
WO2019201258A1 (zh) | 一种设备状态同步的方法及公共能力组件 | |
CN111885103B (zh) | 资源处理方法、服务器、电子设备及存储介质 | |
WO2022083281A1 (zh) | 消息传输方法、***、电子设备和存储介质 | |
CN103002508A (zh) | 一种ap发现ac的方法及ap | |
KR20210118105A (ko) | 무선 통신 네트워크에서 ue의 rid 업데이트를 수행하는 방법 및 ue | |
WO2016082492A1 (zh) | 一种原始资源通告的方法及相应的节点 | |
CN116634470B (zh) | 机器人协同作业方法、控制服务器及本地网络管理服务器 | |
RU2783811C2 (ru) | Способ подписки на услуги и устройство | |
EP3487147A1 (en) | Information synchronization method and device | |
CN116321110B (zh) | 服务订阅方法、装置、服务提供网元及存储介质 | |
WO2023005768A1 (zh) | 一种小区切换方法、终端和网络设备 | |
CN118042531A (zh) | 数据交互方法、装置及电子设备 | |
CN103442462A (zh) | 一种pgw流程处理的实现方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19788007 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
ENP | Entry into the national phase |
Ref document number: 2019788007 Country of ref document: EP Effective date: 20201030 |