Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and an apparatus for creating a virtual device, so as to solve the problem that when a virtual device calls the functions of these home appliances in the prior art, the calling is often failed due to mutual restriction between the function operations of these appliances, so that a user cannot obtain an expected service.
In one aspect, the present invention provides a virtual device creating method, including: abstracting each function of physical equipment into corresponding abstract equipment respectively, wherein each abstract equipment is provided with logical relationship description information, and the logical relationship description information comprises an operation logical relationship among each user operation of the abstract equipment and/or an equipment logical relationship between the abstract equipment and other abstract equipment; and creating virtual equipment according to the user requirements and the logic relationship description information.
Optionally, the operation logical relationship includes a premise that one user operation is another user operation; the device logical relationship includes one abstract device being mutually exclusive from another abstract device.
Optionally, the creating a virtual device according to the user requirement and the logical relationship description information includes: receiving a virtual device creating request of a user, wherein the virtual device creating request carries function information of a virtual device to be created; selecting corresponding abstract equipment from an abstract equipment database according to the function information so as to realize corresponding functions; according to the logical relationship description information, after abstract equipment with logical relationship conflict is removed from the selected abstract equipment, virtual equipment is created; and acquiring the user operation equipped by the virtual equipment from the corresponding abstract equipment according to the logical relationship description information.
Optionally, after removing the abstract device with the logical relationship conflict from the selected abstract devices according to the logical relationship description information, creating a virtual device includes: and if at least two abstract devices with mutual exclusion relationship exist in the selected abstract devices, only one abstract device with mutual exclusion relationship is reserved, and the virtual device is created.
Optionally, the obtaining, according to the logical relationship description information, the user operation equipped by the virtual device from the corresponding abstract device includes: and if the abstract device has a first user operation and the first user operation has a second precondition operation, acquiring the user operation equipped by the virtual device from the corresponding abstract device according to the logical relationship description information, wherein the user operation equipped by the virtual device comprises the first user operation and the second user operation.
In another aspect, the present invention further provides a virtual device creating apparatus, including: the abstract unit is used for abstracting each function of the physical equipment into corresponding abstract equipment, wherein each abstract equipment is provided with logical relationship description information, and the logical relationship description information comprises an operation logical relationship among each user operation of the abstract equipment and/or an equipment logical relationship between the abstract equipment and other abstract equipment; and the creating unit is used for creating the virtual equipment according to the user requirements and the logic relationship description information.
Optionally, the operation logical relationship includes a premise that one user operation is another user operation; the device logical relationship includes one abstract device being mutually exclusive from another abstract device.
Optionally, the creating unit includes: the virtual device creating system comprises a receiving module, a creating module and a processing module, wherein the receiving module is used for receiving a virtual device creating request of a user, and the virtual device creating request carries function information of a virtual device to be created; the selection module is used for selecting corresponding abstract equipment from an abstract equipment database according to the function information so as to realize corresponding functions; the removing module is used for removing the abstract equipment with the logical relationship conflict from the selected abstract equipment according to the logical relationship description information and then creating virtual equipment; and the acquisition module is used for acquiring the user operation equipped by the virtual equipment from the corresponding abstract equipment according to the logical relationship description information.
Optionally, the removing module is specifically configured to, if at least two pieces of abstract devices with a mutual exclusion relationship exist in the selected abstract devices, only one of the abstract devices with the mutual exclusion relationship is reserved, and a virtual device is created.
Optionally, the obtaining module is specifically configured to, if the abstract device has a first user operation and the first user operation has a second prerequisite operation, obtain, according to the logical relationship description information, a user operation configured for the virtual device from a corresponding abstract device, where the user operation configured for the virtual device includes the first user operation and the second user operation.
According to the virtual device creating method and device provided by the embodiment of the invention, various functions of physical devices are respectively abstracted into corresponding abstract devices, and each abstract device is provided with the logical relationship description information, so that the virtual devices are created according to user requirements and the logical relationship description information. Because the logical relationship description information includes the operation logical relationship between the user operations of the abstract device and/or the device logical relationship between the abstract device and other abstract devices, after the logical relationship between the user operations of the abstract device and the logical relationship between one abstract device and other abstract devices are clarified, the logical relationship between the abstract device and the operation corresponding to the virtual device created accordingly will bypass conflict or contradiction, thereby ensuring the effectiveness of each function and operation of the virtual device and realizing the expected service of the virtual device by the user.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
As shown in fig. 1, an embodiment of the present invention provides a virtual device creating method, including:
s11, abstracting each function of the physical device into corresponding abstract devices, where each abstract device is provided with logical relationship description information, and the logical relationship description information includes an operation logical relationship between each user operation of the abstract device and/or a device logical relationship between the abstract device and another abstract device;
and S12, creating virtual equipment according to the user requirement and the logic relation description information.
According to the virtual device creating method provided by the embodiment of the invention, various functions of physical devices are respectively abstracted into corresponding abstract devices, and each abstract device is provided with the logical relationship description information, so that the virtual devices are created according to user requirements and the logical relationship description information. Because the logical relationship description information includes the operation logical relationship between the user operations of the abstract device and/or the device logical relationship between the abstract device and other abstract devices, after the logical relationship between the user operations of the abstract device and the logical relationship between one abstract device and other abstract devices are clarified, the logical relationship between the abstract device and the operation corresponding to the virtual device created accordingly will bypass conflict or contradiction, thereby ensuring the effectiveness of each function and operation of the virtual device and realizing the expected service of the virtual device by the user.
Specifically, in step S11, the abstract relationship among the physical device, the abstract device, and the virtual device may be as shown in fig. 2. The physical equipment air conditioner has a refrigeration function and a temperature sensor function, and two abstract equipment are correspondingly abstracted, namely the refrigeration abstract equipment and the temperature sensor abstract equipment; the physical equipment television has a display function and a sound function, and correspondingly abstracts display abstract equipment and sound abstract equipment. All abstract devices can form an abstract device database on the cloud platform, and when a user needs to create a virtual device, the user can select the needed abstract device from the abstract device database to form a new virtual device.
Optionally, as shown in fig. 3 and 4, each abstraction device is provided with logical relationship description information, where the logical relationship description information may be an operation logical relationship between user operations of the abstraction device, for example, a precondition that one user operation is another user operation, or may be a device logical relationship between the abstraction device and another abstraction device, for example, one abstraction device and another abstraction device cannot be simultaneously enabled, that is, mutual exclusion cannot be simultaneously enabled. In this way, because each abstract device records the logical relationship between each operation related to the abstract device and other abstract devices in detail, the logical relationship can be taken into account when forming the virtual device, so that the function and operation of the virtual device are clearer and more complete.
Specifically, in step S12, creating a virtual device according to the user requirement and the logical relationship description information specifically includes:
receiving a virtual device creating request of a user, wherein the virtual device creating request carries function information of a virtual device to be created;
selecting corresponding abstract equipment from an abstract equipment database according to the function information so as to realize corresponding functions;
according to the logical relationship description information, after abstract equipment with logical relationship conflict is removed from the selected abstract equipment, virtual equipment is created;
and acquiring the user operation equipped by the virtual equipment from the corresponding abstract equipment according to the logical relationship description information.
Optionally, in each alternative abstract device, some abstract devices may have a logical relationship conflict with each other, and therefore the abstract devices having the logical relationship conflict need to be removed. For example, if at least two abstract devices with mutually exclusive relationships exist in the selected abstract devices, only one abstract device with mutually exclusive relationships is reserved, and the virtual device is created. In one embodiment of the invention, the heating function and the dehumidifying function of the air conditioner are mutually exclusive, so that only one heating abstract device and one dehumidifying abstract device of the air conditioner can be reserved when the virtual device is created.
After the abstract devices with the conflicting logical relations are removed, new virtual devices can be created by utilizing the selected abstract devices, and the new virtual devices can be provided with corresponding user operations according to the user operations of the abstract devices. Further, if the abstract device has a first user operation and the first user operation has a second prerequisite operation, the user operation configured for the virtual device is obtained from the corresponding abstract device according to the logical relationship description information, wherein the user operation configured for the virtual device includes the first user operation and the second user operation.
For example, in one embodiment of the invention, if abstract device F has user operation F1 and user operation F2, abstract device G has user operations G1, G2, and G3. The virtual device composed of the abstract device F and the abstract device G has user operations F1, F2, G1, G2, and G3. Further, if the user operation F0 is also required as a precondition for the execution of the user operation F1, the user operation F0 is also included in the user operations provided to the virtual device.
Taking the embodiment shown in fig. 2 as an example, when a user needs to create a temperature display virtual device, the temperature sensor of the refrigerator and the temperature sensor of the air conditioner are found in the abstract device database to be able to display the temperature, and the display of the television and the display of the electronic photo frame are also found to be able to display the temperature. One temperature sensor and display from each of the above abstract devices can thus be selected to form a new temperature display virtual device. However, the temperature sensing function of the air conditioner can be normally used only after the power button of the air conditioner is turned on, and the temperature sensor of the refrigerator can be used only by switching on the power supply, and the refrigerator is not required to be started by the power button, so that the cloud platform can detect whether the temperature reporting operations of the refrigerator and the air conditioner have the precondition operation or not firstly when the virtual equipment is created, and if the precondition operation is performed, the cloud platform needs to check whether the precondition operation can be realized or not, if the precondition operation can be realized, the cloud platform can create the virtual equipment by using the abstract equipment, and if the precondition operation cannot be realized at present, the cloud platform can select abstract equipment with other similar functions. That is, if the power button of the air conditioner is in the on state, that is, the precondition of the temperature reporting operation is already implemented, the temperature sensor of the air conditioner may be used as an abstract device to create the temperature display virtual device, otherwise, the temperature sensor of the refrigerator may be selected to create the temperature display device. Optionally, the virtual device may be formed by temporarily using a temperature sensor of an air conditioner, and the switch-on operation may be performed before the temperature display is performed.
In another embodiment of the present invention, the air conditioner has a cooling function, a heating function and a dehumidifying function, which can respectively correspond to three abstract devices, and the three abstract devices are mutually exclusive. The air-conditioning fan has the functions of heating, refrigerating and humidifying, which are not mutually exclusive. If a virtual device having a heating function, a cooling function, a humidifying function, and a dehumidifying function is to be created, the cooling function and the heating function cannot be selected if the dehumidifying function is selected because the dehumidifying function of the air conditioner is mutually exclusive with the cooling function and the heating function, and thus the cooling function and the heating function of the virtual device can be realized by the corresponding functions of the air conditioner fan. The virtual equipment can synchronously provide a humidifying function while cooling and heating through the air conditioner fan, but can also adjust the humidity through the dehumidifying function of the air conditioner when the air humidity is overlarge.
The following describes the virtual device creating method provided by the present invention in detail by using a specific embodiment.
As shown in fig. 5, in one embodiment of the present invention, a user needs to create a virtual Device including two intelligent home devices, Device _ a and Device _ B.
Wherein, Device _ a: the function 1 and the function 2 can be realized, and the two functions respectively correspond to abstract devices absDevice _1 and absDevice _ 2; the function 1 comprises an operation 3, and the function 2 comprises an operation 4; absDevice _1 and absDevice _2 are mutually exclusive; the operation 3 is the operation 1.
Device _ B: the function 2 and the function 3 can be realized, the two functions respectively correspond to abstract devices absDevice _3 and absDevice _4, the function 2 comprises an operation 4, and the function 3 comprises an operation 5; absDevice _3 and absDevice _4 are not mutually exclusive; neither operation 4 nor operation 5 has a precondition.
In this scenario, Device _ a is a new access Device assuming that Device _ B has accessed the cloud platform at the current time, so only the process of Device _ a participation is listed in fig. 5, and the process of Device _ B participation is similar. After a user sends a service calling request (the service comprises functions 1 to 3), a request for creating virtual equipment is initiated based on that neither Device _ A nor Device _ B can meet the user requirement alone.
Step 0: the method comprises the steps of expanding an existing intelligent household appliance model and an abstract rule thereof in advance, adding attributes for describing precondition operations for each operation (operation), and adding attributes for describing mutual exclusion relationship for each abstract device (absDevice).
Step 1: the intelligent household appliance Device _ A is connected to the home gateway and sends an online notification to the cloud platform through the home gateway.
Step 2: after receiving the online notification of the Device _ a, the cloud platform creates a Device instance DI _ a corresponding to the Device _ a based on the Device model, and creates an abstract Device absDevice _1 corresponding to the function 1 and an abstract Device absDevice _2 corresponding to the function 2 according to the Device abstraction rule.
And step 3: and the user sends a service calling request through the APP to call the service comprising the functions 1-3.
And 4, step 4: the cloud platform queries the required abstract devices according to the user requirements, and obtains abstract devices absDevice _1, absDevice _3 and absDevice _ 4. The abstract device absDevice _2 can provide the function 2 required by the user, but is not selected because of the mutual exclusion relationship with absDevice _1, and an abstract device absDevice _3 which can also provide the function 2 is selected.
And 5: the cloud platform semantically combines the absDevice _1, the absDevice _3 and the absDevice _4 to create a virtual device.
Step 6: the cloud platform queries the device instance DI _ A corresponding to the absDevice _1, acquires the operation 3 contained in the function corresponding to the abstract device, and meanwhile discovers that the operation 3 has the precondition operation 1.
And 7: the cloud platform generates a Device _ A control instruction, which comprises operation 1 and operation 3, and sends the Device _ A control instruction to the Device _ A through the home gateway.
And 8: and after the Device _ A executes the corresponding operation, the operation result is sent to the cloud platform through the home gateway.
And step 9: and the cloud platform collects the operation results fed back by each member device, generates a service calling result and sends the service calling result to the user.
Correspondingly, as shown in fig. 6, an embodiment of the present invention further provides a virtual device creating apparatus, including:
an abstraction unit 61, configured to abstract each function of a physical device into corresponding abstraction devices, where each abstraction device is provided with logical relationship description information, where the logical relationship description information includes an operation logical relationship between each user operation of the abstraction device and/or a device logical relationship between the abstraction device and another abstraction device;
and the creating unit 62 is configured to create a virtual device according to the user requirement and the logical relationship description information.
In the virtual device creating apparatus provided in the embodiment of the present invention, the abstraction unit 61 can abstract each function of the physical device into corresponding abstraction devices, each abstraction device is provided with logical relationship description information, and the creating unit 62 can create the virtual device according to a user requirement and the logical relationship description information. Because the logical relationship description information includes the operation logical relationship between the user operations of the abstract device and/or the device logical relationship between the abstract device and other abstract devices, after the logical relationship between the user operations of the abstract device and the logical relationship between one abstract device and other abstract devices are clarified, the logical relationship between the abstract device and the operation corresponding to the virtual device created accordingly will bypass conflict or contradiction, thereby ensuring the effectiveness of each function and operation of the virtual device and realizing the expected service of the virtual device by the user.
Optionally, the operation logical relationship includes a premise that one user operation is another user operation; the device logical relationship includes one abstract device being mutually exclusive from another abstract device.
Specifically, the creating unit may include:
the virtual device creating system comprises a receiving module, a creating module and a processing module, wherein the receiving module is used for receiving a virtual device creating request of a user, and the virtual device creating request carries function information of a virtual device to be created;
the selection module is used for selecting corresponding abstract equipment from an abstract equipment database according to the function information so as to realize corresponding functions;
the removing module is used for removing the abstract equipment with the logical relationship conflict from the selected abstract equipment according to the logical relationship description information and then creating virtual equipment;
and the acquisition module is used for acquiring the user operation equipped by the virtual equipment from the corresponding abstract equipment according to the logical relationship description information.
Optionally, the removing module may be specifically configured to, if at least two pieces of abstract devices with a mutual exclusion relationship exist in the selected abstract devices, only one of the abstract devices with the mutual exclusion relationship is reserved, and a virtual device is created.
Optionally, the obtaining module is specifically configured to, if the abstract device has a first user operation and the first user operation has a second prerequisite operation, obtain, according to the logical relationship description information, a user operation configured for the virtual device from a corresponding abstract device, where the user operation configured for the virtual device includes the first user operation and the second user operation.
Although the preferred embodiments of the present invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that various modifications, additions and substitutions are possible, and the scope of the invention should not be limited to the embodiments described above.