Protocol generation method and apparatus, electronic device, and storage medium

By automatically generating protocols from upgrade and scenario parameters obtained from the database, the problem of time-consuming and laborious manual protocol conversion is solved, the accuracy and efficiency of protocol conversion are improved, and automated protocol generation for smart home scenarios is realized.

CN119676319BActive Publication Date: 2025-12-05GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411693760.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-12-05
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

In existing technologies, protocol conversion relies on manual programming, which is time-consuming, labor-intensive, and prone to errors, resulting in low accuracy and efficiency in protocol conversion.

Method used

By retrieving the upgrade parameters corresponding to the target function from the database, determining the protocol conversion group, obtaining the scenario parameters of the device to be processed, and determining the target parameters and conversion method from the protocol conversion group based on the scenario parameters, the target protocol is generated and sent.

Benefits of technology

It improves the accuracy and efficiency of protocol conversion, reduces the workload of manually writing conversion rules, and enhances the automation and intelligence of protocol generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676319B_ABST
    Figure CN119676319B_ABST
Patent Text Reader

Abstract

The application discloses a protocol generation method and device, electronic equipment and a storage medium. Embodiments of the application obtain an upgrade parameter corresponding to a target function from a database; determine a protocol conversion group according to the upgrade parameter; the protocol conversion group includes a target parameter corresponding to a source parameter and a conversion method; obtain a scene parameter corresponding to a device to be processed; the scene parameter is used to indicate a scene mode and a working state of the device to be processed; based on the scene parameter, determine a first target parameter and a first conversion method corresponding to the scene parameter from the protocol conversion group; generate a target protocol according to the first target parameter and the first conversion method; and send the target protocol to a client, so that the client executes a target function corresponding to the scene parameter based on the target protocol. The embodiments of the application improve the correctness of protocol conversion and the efficiency of protocol generation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of communication, and particularly relates to a protocol generation method and device, electronic equipment and a storage medium. BACKGROUND

[0002] In modern communication systems, data exchange between various systems and devices relies on diversified protocols. However, different systems and devices can adopt different protocols, which makes protocol conversion crucial.

[0003] Under current technical conditions, protocol conversion mostly relies on manually written conversion rules, which is time-consuming and laborious, and is prone to errors. Subsequent maintenance work is also quite cumbersome. Therefore, how to automatically generate accurate and efficient protocol conversion rules to simplify the entire protocol conversion process has become a technical problem to be solved in the field of communication. SUMMARY

[0004] The embodiments of the present application provide a protocol generation method and device, electronic equipment and a storage medium, which can solve the problems of low accuracy of protocol conversion and low efficiency of protocol generation in the process of protocol generation in related technologies.

[0005] In a first aspect, the embodiments of the present application provide a protocol generation method, which comprises:

[0006] obtaining an upgrade parameter corresponding to a target function from a database;

[0007] determining a protocol conversion group according to the upgrade parameter; the protocol conversion group comprises a target parameter corresponding to a source parameter and a conversion method;

[0008] obtaining a scene parameter corresponding to a to-be-processed device; the scene parameter is used to indicate a scene mode and a working state of the to-be-processed device;

[0009] determining a first target parameter and a first conversion method corresponding to the scene parameter from the protocol conversion group based on the scene parameter;

[0010] generating a target protocol according to the first target parameter and the first conversion method;

[0011] sending the target protocol to a client, so that the client executes a target function corresponding to the scene parameter based on the target protocol.

[0012] In a second aspect, the embodiments of the present application provide a protocol generation device, which comprises:

[0013] a first obtaining module, configured to obtain an upgrade parameter corresponding to a target function from a database;

[0014] The first determining module is configured to determine a protocol conversion group according to the upgrade parameter; the protocol conversion group comprises a target parameter corresponding to a source parameter and a conversion method;

[0015] The first obtaining module is further configured to obtain a scene parameter corresponding to the device to be processed; the scene parameter is used to indicate a scene mode and a working state of the device to be processed.

[0016] The first determining module is further configured to determine a first target parameter and a first conversion method corresponding to the scene parameter from the protocol conversion group based on the scene parameter.

[0017] The first generating module is configured to generate a target protocol according to the first target parameter and the first conversion method.

[0018] The sending module is configured to send the target protocol to a client, so that the client performs a target function corresponding to the scene parameter based on the target protocol.

[0019] The second generating module is configured to generate a pre-conversion protocol based on the first target parameter and the first conversion method.

[0020] The second determining module is configured to test the pre-conversion protocol and determine a test result corresponding to the pre-conversion protocol.

[0021] The obtaining module is configured to, in a case where the pre-conversion protocol passes the test, perform format conversion on the pre-conversion protocol according to a configuration parameter of the device to be processed, and obtain a target protocol.

[0022] The third determining module is configured to determine a home scene according to collected sensor data or user input data, and determine a scene mode corresponding to the home scene based on the home scene.

[0023] The second obtaining module is configured to obtain a scene parameter corresponding to the device to be processed from the database based on the scene mode.

[0024] The fourth determining module is configured to determine first identification information corresponding to the scene mode and second identification information corresponding to the working state, and traverse the protocol conversion group, determine a first target parameter and a first conversion method corresponding to the scene parameter based on an identification matching strategy.

[0025] In a third aspect, an electronic device is provided, which comprises a processor, a memory, a communication interface and a communication bus. The processor, the memory and the communication interface complete communication with each other through the communication bus. The memory is used to store executable instructions, and the executable instructions make the processor execute the protocol generation method in any one of the above aspects.

[0026] In a fourth aspect, an embodiment of the present application provides a readable storage medium, and the readable storage medium stores a program or instructions, and the program or instructions are executed by a processor to implement the protocol generation method in any one of the above aspects.

[0027] In the embodiment of the present application, a protocol generation method is provided. An upgrade parameter corresponding to a target function is obtained from a database. A protocol conversion group is determined according to the upgrade parameter. The protocol conversion group includes a target parameter corresponding to a source parameter and a conversion method. A scene parameter corresponding to a to-be-processed device is obtained. The scene parameter is used to indicate a scene mode and a working state of the to-be-processed device. Based on the scene parameter, a first target parameter and a first conversion method corresponding to the scene parameter are determined from the protocol conversion group. The target protocol is generated according to the first target parameter and the first conversion method. The target protocol is sent to a client, so that the client executes a target function corresponding to the scene parameter based on the target protocol. In the process of generating the protocol, the server can determine the protocol conversion group according to the obtained upgrade parameter, improve the correctness of the protocol conversion, and then determine the target protocol from the protocol conversion group according to the obtained scene parameter, so as to improve the efficiency of the protocol generation. BRIEF DESCRIPTION OF DRAWINGS

[0028] Figure 1 is a step flow of a protocol generation method provided by an embodiment of the present application Figure One ;

[0029] Figure 2 is a step flow of a protocol generation method provided by an embodiment of the present application Figure Two ;

[0030] Figure 3 is a step flow of a protocol generation method provided by an embodiment of the present application Figure Three ;

[0031] Figure 4 is a step flow of a protocol generation method provided by an embodiment of the present application Figure Four ;

[0032] Figure 5 is a step flow of a protocol generation method provided by an embodiment of the present application Figure Five ;

[0033] Figure 6 is a logic block of a protocol generation device provided by an embodiment of the present application Figure One ;

[0034] Figure 7 is a logic block of a protocol generation device provided by an embodiment of the present application Figure Two ;

[0035] Figure 8Figure 1 is a logic block diagram of a protocol generation device according to an embodiment of the present application. Figure Three ;

[0036] Figure 9 Figure 1 is a logic block diagram of a protocol generation device according to an embodiment of the present application. Figure Four ;

[0037] Figure 10 Figure 2 is a structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0038] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of them. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.

[0039] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally a category and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the front and rear associated objects are in an "or" relationship.

[0040] Method embodiments

[0041] The protocol generation method provided by the embodiments of the present application will be described in detail below with reference to the drawings, specific embodiments and application scenarios.

[0042] Referring to Figure 1 , a step flowchart of a protocol generation method provided by an embodiment of the present application is shown, as shown in Figure 1 , the method specifically includes steps 101 to 106:

[0043] Step 101, obtaining an upgrade parameter corresponding to a target function from a database.

[0044] The protocol generation method provided by the embodiments of the present application can be applied to a server. In the process of generating a protocol, the server can first obtain an upgrade parameter corresponding to a target function from a database.

[0045] In the embodiments of the present application, the data form corresponding to the upgrade parameter can include but is not limited to a function field, an encoding identifier, etc. Similarly, the target function can include but is not limited to a new sensor type, a sensor data format, etc.

[0046] Specifically, in the embodiments of the present application, the target function can be determined by the client from the obtained data packet to be upgraded, or can be determined by the client after receiving the upgrade instruction sent by the server, by comparing the target function with the protocol stored in the client.

[0047] For example, the client can compare the new upgrade instruction information with the original instruction information stored in the client, the instruction information is converted into a communication protocol, and then the target function is determined.

[0048] Step 102, determining a protocol conversion group according to the upgrade parameter; the protocol conversion group includes a target parameter corresponding to a source parameter and a conversion method.

[0049] The protocol generation method provided in the embodiments of the present application can be used to determine a protocol conversion group according to the upgrade parameter after the server obtains the upgrade parameter corresponding to the target function from the database; the protocol conversion group includes a target parameter corresponding to a source parameter and a conversion method.

[0050] Specifically, the server can generate a protocol conversion group according to the existing protocol in the system and the upgrade parameter, the protocol conversion group can include each protocol conversion rule in the existing protocol, including a target parameter corresponding to a source parameter and a conversion method.

[0051] For example, the server can add a new upgrade parameter to the existing protocol in the system according to the upgrade parameter, determine a new protocol corresponding to the upgrade parameter, and then determine a protocol conversion group according to the existing protocol and the new protocol, that is, the protocol conversion group can represent a protocol set.

[0052] For example, in the process of determining the target parameter corresponding to the source parameter, the protocol conversion group can be searched in the case that the source parameter is "username", and then the target parameter "user_id" corresponding to the source parameter can be found, that is, the target parameter corresponding to the source parameter is determined.

[0053] For example, in the process of determining the conversion method corresponding to the source parameter, the protocol conversion group can be searched in the case that the upgrade parameter is "light status", and then the target parameter "light_status" corresponding to the upgrade parameter and the conversion method "string mapping" can be found.

[0054] Exemplarily, in the process of determining the protocol conversion group, a field can be added to the protocol stored in the system according to the upgrade parameter, a new protocol is obtained, the new protocol and the protocol stored in the system are combined to obtain the protocol conversion group, that is, the protocol conversion set is obtained.

[0055] In step 103, scene parameters corresponding to the device to be processed are obtained. The scene parameters are used to indicate the scene mode and working state of the device to be processed.

[0056] The protocol generation method provided by the embodiments of the present application can obtain scene parameters corresponding to the device to be processed after the server determines the protocol conversion group according to the upgrade parameter. The scene parameters are used to indicate the scene mode and working state of the device to be processed.

[0057] Specifically, the scene parameters corresponding to the device to be processed can include but are not limited to the scene mode and working state of the device to be processed, which are not limited in the embodiments of the present application.

[0058] Exemplarily, the scene mode of the device to be processed can include but is not limited to "night mode", "away mode", "home mode", etc., which are not limited in the embodiments of the present application.

[0059] Specifically, the working state of the device to be processed can include but is not limited to the on-off state of the device to be controlled, the high-low state of the temperature, the percentage state of the purification degree, etc.

[0060] Specifically, the obtained scene parameters can include scene modes such as "night mode", "away mode", "home mode", and can also include parameters such as "light state: off" and "air conditioner temperature: 22 degrees" in "night mode", which are not limited in the embodiments of the present application.

[0061] Exemplarily, in the case of obtaining the scene parameters, the scene parameters can be collected through sensor data and user input. For example, current environmental information and user instructions can be collected through various sensors (such as temperature sensors, motion sensors, light sensors, etc.) or user input (such as mobile phone APP, voice control, etc.), and then these data are summarized and sent to the central controller or server of the smart home system.

[0062] Further, the server can determine the current home scene according to the collected data. For example, by detecting the event that the user leaves home and closes the door, the system can determine that the current scene is "away mode". This determination process can be based on predefined rules or machine learning models.

[0063] Further, after determining the current scene, the system generates a scene identifier (for example, "away mode") and queries the database, that is, the system uses the scene identifier to query the corresponding parameter set in the pre-set database.

[0064] For example, the database stores various scene corresponding parameter sets, each parameter set including the device and its state that need to be controlled in the scene. For example, "away mode" can include "light state: off".

[0065] For example, the database returns the parameter set matching the current scene identifier. The system passes the parameter set to the protocol generation module for further processing and control.

[0066] Further, when obtaining the scene parameters corresponding to the device to be processed, the server can determine the home scene according to the collected sensor data or user input data, determine the scene mode corresponding to the home scene based on the home scene, and obtain the scene parameters corresponding to the device to be processed from the database based on the scene mode.

[0067] For example, the sensor data can be temperature data obtained by a temperature sensor, or speed data obtained by a motion sensor, or brightness data obtained by an illumination sensor, etc., which is not limited in the embodiments of the present application.

[0068] Specifically, the user input data can include, but is not limited to, data input through a mobile phone software program application or data input through voice control, etc., and then the home scene is determined according to the user input data.

[0069] For example, in the process of determining the current home scene according to the sensor data, the indoor temperature read by the temperature sensor is 28℃, and then it can be determined that the current home scene is "cooling mode", at this time, the air conditioner will automatically adjust to cooling state and set the temperature to 24℃.

[0070] For example, if no activity is detected by the motion sensor within a certain time, it can be determined that the current home scene is "away mode", at this time, the server will control to turn off all lights and air conditioners, and increase the alert level of the home security system.

[0071] For example, if regular breathing sounds are detected by the sound sensor, it can be determined that the current home scene is "sleep mode", at this time, the server will control to turn off all lights, adjust the air conditioner temperature to 22℃, and set the smart curtain to close slowly.

[0072] For example, if "night mode" is selected through the mobile phone APP, the system adjusts to "night mode", reduces the light brightness, and turns off the infrequently used electrical appliances.

[0073] For example, when the user says "I'm home" through voice control, the system adjusts to "home mode", turns on the living room lights, preheats the water heater, and adjusts the air conditioner temperature to 24°C.

[0074] For example, when the user selects "I'm leaving" through the mobile phone APP, the system adjusts to "away mode", turns off all lights and air conditioners, and increases the alert level of the home security system.

[0075] For example, when the user says "bedtime" through voice control, the system adjusts to "sleep mode", turns off all lights, adjusts the air conditioner temperature to 22°C, and sets the smart curtain to close slowly.

[0076] For example, the home scene can include but is not limited to "sleep mode, turn off all lights, adjust air conditioner temperature to 22°C, set smart curtain to close slowly", "home mode, turn on living room lights, preheat water heater, adjust air conditioner temperature to 24°C", etc.

[0077] For example, the scene mode corresponding to the home scene can include but is not limited to home mode, away mode, sleep mode, etc., which is not limited in the embodiments of the present application.

[0078] Specifically, the server can obtain the scene parameters corresponding to the device to be processed from the database according to "night mode", "away mode", "home mode", etc.

[0079] Specifically, the server can collect data through sensors, i.e., the smart home system can identify the current home scene through sensors (such as temperature sensors, motion sensors, light sensors, etc.) or user input (such as mobile phone APP, voice control, etc.). Further, the mode of the current scene is determined under the current home scene. The smart home system can determine the current home scene according to sensor data or user input, such as "night mode", "away mode", "home mode", etc.; after determining the home scene, the database is queried, i.e., the system obtains the parameter set corresponding to the current scene from the pre-set database. These parameter sets include the devices and their states that need to be controlled under this scene. For example, "night mode" can include "light state: off", "air conditioner temperature: 22 degrees", etc.

[0080] Step 104, determining the first target parameter and the first conversion method corresponding to the scene parameter from the protocol conversion group based on the scene parameter.

[0081] The protocol generation method provided in the embodiments of the present application comprises the following steps: a server obtains scene parameters corresponding to a device to be processed; the scene parameters are used to indicate a scene mode and a working state of the device to be processed; and based on the scene parameters, a first target parameter corresponding to the scene parameters and a first conversion method are determined from a protocol conversion group.

[0082] Specifically, the first target parameter corresponding to the scene parameters can be obtained by searching the protocol conversion group according to the scene parameters.

[0083] For example, in the embodiments of the present application, when the scene parameters are “light state”, the server can query the protocol conversion group to find the first target parameter “light_status” corresponding to the “light state”.

[0084] For example, the first conversion method corresponding to the scene parameters can be obtained by searching the protocol conversion group according to the scene parameters.

[0085] For example, in the embodiments of the present application, when the scene parameters are “light state”, the server can query the protocol conversion group to find the first conversion method “string mapping” corresponding to the “light state”.

[0086] For example, the server can determine the target parameter “light_status” and the conversion method “string mapping” corresponding to “light state is off in night mode” from the protocol set, or determine the target parameter “Air conditioner_status” and the conversion method “string mapping” corresponding to “temperature of air conditioner is 22 degrees in night mode”, and the like, which are not limited in the embodiments of the present application.

[0087] Further, when the server determines the first target parameter corresponding to the scene parameters and the first conversion method from the protocol conversion group based on the scene parameters, the server can first determine first identification information corresponding to the scene mode and second identification information corresponding to the working state; and then search the protocol conversion group based on an identification matching strategy to determine the first target parameter corresponding to the scene parameters and the first conversion method.

[0088] Specifically, the first identification information corresponding to the scene mode is identification information generated by the server after determining the home scene, for example, “away mode”.

[0089] For example, the second identification information corresponding to the working state is identification information generated by the server after determining the home scene, for example, “light off”.

[0090] Specifically, the identification matching strategy can be a matching strategy used by the server in the process of traversing and searching in the protocol conversion group according to the first identification information and the second identification information.

[0091] For example, in the case of the scene parameter being "the temperature of the air conditioner is 22 degrees", the server can first query the protocol conversion group to find the target parameter "air conditioner_temperature" corresponding to "the temperature of the air conditioner" and the conversion method "string mapping", and then determine the target parameter and the conversion method to obtain "air conditioner_temperature: 22", that is, convert "the temperature of the air conditioner: 22" to "air conditioner_temperature: 22". In the embodiments of the present application, this is not limited.

[0092] Step 105, generating a target protocol according to the first target parameter and the first conversion method.

[0093] The protocol generation method provided by the embodiments of the present application can be used by the server to generate a target protocol according to the first target parameter and the first conversion method after determining the first target parameter and the first conversion method corresponding to the scene parameter from the protocol conversion group based on the scene parameter.

[0094] Specifically, the target protocol can be generated according to a specific rule or standard, for example: the target protocol can be determined according to the protocol conversion table corresponding to the conversion of different scenes, and the protocol conversion table is a predefined mapping table used to indicate the conversion of the scene parameter to the parameter corresponding to the target device. When the target device is a smart bulb, the requirement for format conversion is that the value of the "light_status" parameter is "on" or "off". The system needs to convert the scene parameter "light state: off" to the target protocol.

[0095] For example, the target protocol can be a protocol corresponding to the scene parameter obtained after the conversion of the scene parameter.

[0096] The server can first query the protocol conversion group to find the target parameter "light_status" corresponding to "light state" and the conversion method "string mapping", and then determine the target parameter and the conversion method to obtain "light_status: off", that is, convert "light state: off" to "light_status: off". Finally, the target protocol is generated according to the target parameter and the conversion method, which is not limited in the embodiments of the present application.

[0097] Further, when generating the target protocol according to the first target parameter and the first conversion method, the server can generate a pre-conversion protocol based on the first target parameter and the first conversion method, test the pre-conversion protocol to determine a test result corresponding to the pre-conversion protocol, and when the pre-conversion protocol passes the test, perform format conversion on the pre-conversion protocol according to the configuration parameter of the device to be processed to obtain the target protocol.

[0098] Illustratively, according to the parameter to be converted, the target parameter and the conversion method matching the parameter to be converted are obtained in the protocol conversion group, and a pre-conversion protocol is generated.

[0099] Illustratively, the server can find the target parameter "user_id" and the conversion method "string mapping" corresponding to "username" by querying the protocol conversion group, thereby generating a pre-conversion protocol and converting "username: JohnDoe" to "user_id: 12345".

[0100] Specifically, the process of testing the pre-conversion protocol can include sending test data to the server by sending prepared test cases to simulate actual application scenarios. The target parameter and the source parameter information "username, user_id" are stored in the database. The conversion process is monitored, including recording the process of converting "username" to "user_id" after the server receives "username". The conversion result is recorded, i.e., the conversion result of each test case is saved for subsequent verification. It is ensured that the converted "user_id" can be correctly identified and processed, for example, in login, query, and permission management scenarios.

[0101] Illustratively, the server needs to determine whether the test results corresponding to the pre-conversion protocol meet the expectations.

[0102] Specifically, the test results can include but are not limited to test pass, test fail, and in the case where the pre-conversion protocol passes the test, the server can perform format conversion on the pre-conversion protocol according to the configuration parameter of the device to be processed, and thus the target protocol can be obtained.

[0103] Illustratively, when the device to be processed is a lamp, the configuration parameter of the device to be processed can be "light_status: off".

[0104] Specifically, "light_status: off" can be converted to a format consistent with the API of the smart bulb according to the API of the smart bulb.

[0105] The server can first query the protocol conversion group, find the target parameter "light_status" corresponding to the "light state" and the conversion method "string mapping", then determine the target parameter and the conversion method, obtain "light_status: off", that is, convert "light state: off" to "light_status: off". Finally, the target protocol is generated according to the API of the smart bulb, and "light_status: off" is converted into a format conforming to the API. In the embodiments of the present application, no limitation is made.

[0106] Further, when the server tests the pre-conversion protocol and determines the test result corresponding to the pre-conversion protocol, the server can generate test cases for the pre-conversion protocol, execute the test cases in a test system to obtain a conversion result corresponding to the pre-conversion protocol, verify whether the conversion result can be correctly recognized and processed by the to-be-processed device in a test scenario, and determine that the pre-conversion protocol passes the test in a case where the conversion result can be correctly recognized and processed by the to-be-processed device.

[0107] Illustratively, the test cases can be used to verify whether the conversion result of the pre-conversion protocol meets the expectation.

[0108] Illustratively, during the execution of the test cases in the test system, the conversion result can be obtained after all the test cases are executed, or a conversion result can be obtained after each test case is executed.

[0109] Illustratively, the test scenario includes, but is not limited to, login, query, permission management, and the like.

[0110] Specifically, verifying whether the conversion result can be correctly recognized and processed by the to-be-processed device can be recording the process of how the system receives the source parameter "username", converts and generates the target parameter "user_id" during monitoring of the conversion, recording the conversion result, saving the conversion result of each test case for subsequent verification, and ensuring that the converted target parameter "user_id" can be correctly recognized and processed.

[0111] Illustratively, in a case where the converted target parameter "user_id" can be correctly recognized and processed, the server can determine that the pre-conversion protocol passes the test.

[0112] Step 106, sending the target protocol to the client, so that the client executes the target function corresponding to the scene parameter based on the target protocol.

[0113] The protocol generation method provided by the embodiments of the present application can be used to generate a target protocol corresponding to a scene parameter based on a first target parameter and a first conversion method, and then send the target protocol to a client, so that the client executes a target function corresponding to the scene parameter based on the target protocol.

[0114] Specifically, the client can be a device receiving the upgrade instruction sent by the server, and the upgrade data packet carried in the upgrade instruction is parsed online. The client can also obtain the newly added function points by comparing the stored protocol in the client.

[0115] For example, the server sends the generated target protocol to the corresponding smart home device. The smart home device responds to the processing, that is, after the smart home device receives the target protocol, the state of the device is adjusted according to the instructions in the target protocol, for example, the light is turned off or the air conditioner temperature is adjusted. In the embodiments of the present application, no limitation is performed.

[0116] For example, the target function corresponding to the scene parameter can be a function that has not been stored in the to-be-processed device.

[0117] Further, the server can also determine the source parameters corresponding to each protocol based on the stored protocols in the database; determine the target parameters and conversion methods corresponding to each source parameter for each source parameter; and generate a protocol conversion group according to the target parameters and conversion methods corresponding to each source parameter.

[0118] Specifically, the protocols stored in the database can be protocols corresponding to the related functions stored in the to-be-processed device.

[0119] Specifically, for each source parameter stored in the database, the target parameter and the conversion method corresponding to each source parameter can be determined first, that is, there is a corresponding relationship between the source parameters, the target parameters, and the conversion methods stored in the database, and then the protocol conversion group can be determined according to the corresponding relationship between the source parameters, the target parameters, and the conversion methods stored in the database.

[0120] In summary, in the embodiments of the present application, in the process of generating a protocol, the server can obtain the upgrade parameters corresponding to the target function from the database; determine the protocol conversion group according to the upgrade parameters; the protocol conversion group includes the target parameters and the conversion methods corresponding to the source parameters; obtain the scene parameters corresponding to the to-be-processed device; the scene parameters are used to indicate the scene mode and the working state of the to-be-processed device; determine the first target parameter and the first conversion method corresponding to the scene parameters from the protocol conversion group based on the scene parameters; generate a target protocol according to the first target parameter name and the first conversion method; and send the target protocol to the client, so that the client executes the target function corresponding to the scene parameters based on the target protocol.

[0121] As can be seen, in the process of generating a protocol, the server can first determine the protocol conversion group according to the obtained upgrade parameters, improve the correctness of protocol conversion, and then determine the target protocol from the protocol conversion group according to the obtained scene parameters, which can improve the efficiency of protocol generation.

[0122] Referring to Figure 2 , a step flow of a protocol generation method provided by an embodiment of the present application is shown Figure Two As shown in Figure 2 , the method specifically includes steps 201 to 213:

[0123] Step 201, obtaining an upgrade parameter corresponding to a target function from a database.

[0124] The protocol generation method provided by the embodiment of the present application can obtain the upgrade parameter corresponding to the target function from the database by the server.

[0125] Exemplarily, the client can compare the new upgrade instruction information with the originally stored instruction information of the client, the instruction information is converted into a communication protocol, and then the target function is determined.

[0126] Step 202, determining a protocol conversion group according to the upgrade parameter; the protocol conversion group includes a target parameter corresponding to a source parameter and a conversion method.

[0127] The protocol generation method provided by the embodiment of the present application can determine the protocol conversion group according to the upgrade parameter by the server after obtaining the upgrade parameter corresponding to the target function from the database; the protocol conversion group includes the target parameter corresponding to the source parameter and the conversion method.

[0128] Exemplarily, in the process of determining the protocol conversion group, a field can be added to the protocol stored in the system according to the upgrade parameter to obtain a new protocol, the new protocol and the protocol stored in the system are combined to obtain the protocol conversion group, that is, a protocol conversion set is obtained.

[0129] Step 203, determining a home scene according to collected sensor data or user input data.

[0130] The protocol generation method provided by the embodiment of the present application can determine the home scene according to the collected sensor data or user input data by the server after determining the protocol conversion group according to the upgrade parameter.

[0131] Exemplarily, if no activity is detected by the motion sensor within a certain time, it can be determined that the current home scene is “away mode”.

[0132] Step 204, determining a scene mode corresponding to the home scene based on the home scene.

[0133] The protocol generation method provided by the embodiment of the present application can determine the scene mode corresponding to the home scene based on the home scene by the server after determining the home scene according to the collected sensor data or user input data.

[0134] Exemplarily, when the user says "sleep time" through voice control, the system is adjusted to "sleep mode", all lights are turned off, the air conditioner temperature is adjusted to 22℃, and the smart curtain is set to close slowly.

[0135] Step 205, based on the scene mode, the scene parameters corresponding to the device to be processed are obtained from the database.

[0136] The protocol generation method provided by the embodiment of the application can obtain the scene parameters corresponding to the device to be processed from the database based on the scene mode after determining the scene mode corresponding to the home scene.

[0137] Specifically, the service end can collect data through sensors, that is, the smart home system can recognize the current home scene through sensors (such as temperature sensors, motion sensors, light sensors, etc.) or user input (such as mobile phone APP, voice control, etc.). Further, the mode of the current scene is determined under the current home scene. The smart home system can determine the current home scene according to sensor data or user input, for example, "night mode", "away mode", "home mode", etc.; after determining the home scene, the database is queried, that is, the system obtains the parameter set corresponding to the current scene from the pre-set database. These parameter sets include the devices and their states that need to be controlled under the scene. For example, "night mode" can include "light state: off", "air conditioner temperature: 22 degrees", etc.

[0138] Step 206, determining the first identification information corresponding to the scene mode and the second identification information corresponding to the working state.

[0139] The protocol generation method provided by the embodiment of the application can determine the first identification information corresponding to the scene mode and the second identification information corresponding to the working state after obtaining the scene parameters corresponding to the device to be processed from the database based on the scene mode.

[0140] Specifically, the first identification information corresponding to the scene mode is the identification information generated by the service end after determining the home scene, for example, "away mode".

[0141] Exemplarily, the second identification information corresponding to the working state is the identification information generated by the service end after determining the home scene, for example, "light off".

[0142] Step 207, traversing the protocol conversion group, determining the first target parameter corresponding to the scene parameter and the first conversion method based on the identification matching strategy.

[0143] The protocol generation method provided in the embodiments of the present application can determine the first identification information corresponding to the scene mode and the second identification information corresponding to the working state, and then the server can traverse the protocol conversion group, determine the first target parameter corresponding to the scene parameter and the first conversion method based on the identification matching strategy.

[0144] Specifically, the identification matching strategy can be a matching strategy used by the server in the process of traversing and searching in the protocol conversion group according to the first identification information and the second identification information.

[0145] In step 208, a pre-conversion protocol is generated based on the first target parameter and the first conversion method.

[0146] The protocol generation method provided in the embodiments of the present application can determine the first target parameter corresponding to the scene parameter and the first conversion method based on the identification matching strategy after traversing the protocol conversion group, and then the server can generate a pre-conversion protocol based on the first target parameter and the first conversion method.

[0147] The server can first query the protocol conversion group to find the target parameter "light_status" corresponding to the "light state" and the conversion method "string mapping", and then determine the target parameter and the conversion method to obtain "light_status:off", that is, convert "light state: off" to "light_status:off".

[0148] In step 209, a test case is generated for the pre-conversion protocol.

[0149] The protocol generation method provided in the embodiments of the present application can generate a test case for the pre-conversion protocol after generating the pre-conversion protocol based on the first target parameter and the first conversion method.

[0150] Exemplarily, the test case can be used to verify whether the conversion result of the pre-conversion protocol meets the expectation.

[0151] In step 210, the test case is executed in a test system to obtain a conversion result corresponding to the pre-conversion protocol.

[0152] The protocol generation method provided in the embodiments of the present application can execute the test case in a test system to obtain a conversion result corresponding to the pre-conversion protocol after generating the test case for the pre-conversion protocol.

[0153] Specifically, in the process of monitoring the conversion, after the system receives the source parameter "username", the source parameter can be converted and processed, and then the target parameter "user_id" can be obtained, and the target parameter can be verified, for example, whether the target parameter can be correctly recognized and processed by the to-be-processed device.

[0154] Step 211, verify whether the conversion result can be correctly recognized and processed by the to-be-processed device in the test scene.

[0155] The protocol generation method provided in the embodiments of the present application can execute the test case in the test system, obtain the conversion result corresponding to the pre-conversion protocol, and then the server can verify whether the conversion result can be correctly recognized and processed by the to-be-processed device in the test scene.

[0156] For example, the conversion result is recorded, and the conversion result of each test case is saved for subsequent verification, so as to ensure that the converted target parameter "user_id" can be correctly recognized and processed.

[0157] Step 212, in the case that the conversion result can be correctly recognized and processed by the to-be-processed device, it is determined that the pre-conversion protocol passes the test.

[0158] The protocol generation method provided in the embodiments of the present application can execute the test case in the test system, obtain the conversion result corresponding to the pre-conversion protocol, and then the server can verify whether the conversion result can be correctly recognized and processed by the to-be-processed device in the test scene.

[0159] For example, in the case that the converted target parameter "user_id" can be correctly recognized and processed, the server can determine that the pre-conversion protocol passes the test.

[0160] Step 213, in the case that the pre-conversion protocol passes the test, the pre-conversion protocol is format-converted according to the configuration parameter of the to-be-processed device to obtain a target protocol.

[0161] The protocol generation method provided in the embodiments of the present application can execute the test case in the test system, obtain the conversion result corresponding to the pre-conversion protocol, and then the server can verify whether the conversion result can be correctly recognized and processed by the to-be-processed device in the test scene.

[0162] Specifically, "light_status:off" can be converted into a format conforming to the API according to the API of the smart bulb.

[0163] To sum up, in the embodiments of the present application, in the process of protocol generation, the server can obtain the upgrade parameters corresponding to the target function from the database; determine the protocol conversion group according to the upgrade parameters; the protocol conversion group includes the target parameters corresponding to the source parameters and the conversion method; obtain the scene parameters corresponding to the device to be processed; the scene parameters are used to indicate the scene mode and working state of the device to be processed; based on the scene parameters, determine the first target parameter and the first conversion method corresponding to the scene parameters from the protocol conversion group; generate the target protocol according to the first target parameter name and the first conversion method; and send the target protocol to the client, so that the client executes the target function corresponding to the scene parameters based on the target protocol.

[0164] Therefore, in the process of protocol generation, the server can first determine the protocol conversion group according to the obtained upgrade parameters, improve the correctness of protocol conversion, and then determine the target protocol from the protocol conversion group according to the obtained scene parameters, which can improve the efficiency of protocol generation.

[0165] In some embodiments, through the automatic generation mechanism of the database storage field and the protocol conversion group, the automatic generation of the protocol in the smart home scene and product upgrade is realized, and the workload of manually writing conversion rules is reduced. Real-time scene recognition and response: through sensors or user input, the smart home scene is recognized in real time, and the corresponding protocol is automatically generated and applied, which improves the intelligent level of the system.

[0166] Referring to Figure 3 , a step flow of a protocol generation method provided by an embodiment of the present application is shown Figure Three , as shown in Figure 3 , the method specifically includes steps 301 to 305:

[0167] When the product is online upgraded, the server automatically sends a command to the machine, sends the content to be upgraded to the device end, parses the function modification content in the online upgrade package, for example, adds a new sensor support function, and the device receives the instruction, and obtains the new function point by comparing the previous old protocol.

[0168] Step 301, upgrade parameter acquisition.

[0169] Obtain the parameter set corresponding to the function modification from the database, for example, "new sensor type", "sensor data format", etc.

[0170] Step 302, generate protocol conversion group.

[0171] According to the existing protocol in the system, a protocol conversion group is generated. The content of the protocol conversion group includes each conversion rule in the existing protocol, specifically including the source parameter name, the target parameter name, the conversion method, etc. For example, in the existing protocol A and protocol B, the source parameter name is "username", the target parameter name is "user_id", and the conversion method is "string mapping".

[0172] Step 303, generating a pre-conversion protocol.

[0173] According to the to-be-converted parameter, the target parameter name and the conversion method matching it are obtained in the protocol conversion group, forming a pre-conversion protocol. For example, by querying the protocol conversion group, the target parameter name "user_id" and the conversion method "string mapping" corresponding to "username" are found, and a pre-conversion protocol is generated to convert "username: JohnDoe" to "user_id: 12345".

[0174] Step 304, testing the pre-conversion protocol.

[0175] The pre-conversion protocol is tested to determine whether the conversion result meets the expectation. By simulating the actual application environment, the effectiveness and accuracy of the pre-conversion protocol are verified. For example, the pre-conversion protocol is applied to the actual system to check whether the converted "user_id" can be correctly identified and processed.

[0176] Step 305, automatic protocol generation.

[0177] Through the automatic generation mechanism of the database storage field and the protocol conversion group, the automatic generation of the protocol in the smart home scene and product upgrade is realized, reducing the workload of manually writing conversion rules.

[0178] Reference Figure 4 , a protocol generation method provided by an embodiment of the present application is shown Figure Four , as shown in Figure 4 , the method specifically includes steps 401 to 405:

[0179] Step 401, data collection by sensor.

[0180] The smart home system identifies the current home scene through sensors (such as temperature sensors, motion sensors, light sensors, etc.) or user input (such as mobile phone APP, voice control, etc.).

[0181] Step 402, determine the current scene mode.

[0182] The system determines the current home scene according to sensor data or user input, such as "night mode", "away mode", "home mode", etc.

[0183] Step 403, scene parameter acquisition.

[0184] Database query: the system obtains the parameter set corresponding to the current scene from the pre-set database. These parameter sets include the devices and their states that need to be controlled in this scene. For example, "night mode" may include "light status: off", "air conditioner temperature: 22 degrees", etc.

[0185] Step 404, protocol generation.

[0186] Protocol conversion group query: according to the acquired scene parameters, the system finds the corresponding target parameter name and conversion method in the protocol conversion group. Generate protocol: convert the scene parameters into the target protocol using the found target parameter name and conversion method. For example, "light status: off" is converted to "light_status: off".

[0187] Step 405, protocol application.

[0188] Send the generated protocol to the corresponding smart home device. Device response: after the smart home device receives the protocol, it adjusts its state according to the instructions in the protocol, such as turning off the light or adjusting the air conditioner temperature.

[0189] Reference Figure 5 , shows the steps of a protocol generation method provided by an embodiment of the present application Figure Five , as shown in Figure 5 , the method specifically includes steps 501 to 508:

[0190] Step 501, generate protocol conversion group.

[0191] According to the existing protocols in the system, generate a protocol conversion group. The content of the protocol conversion group includes the conversion rules in the existing protocols, including source parameter name, target parameter name, conversion method, etc. For example, in existing protocols A and B, the source parameter name is "username", the target parameter name is "user_id", and the conversion method is "string mapping".

[0192] Step 502, analyze the protocol to be converted.

[0193] Compare the new instruction information with the originally stored instruction information, and the instruction information will be converted into a communication protocol. The server initially compares the instruction information.

[0194] Step 503, match conversion rules.

[0195] Exemplarily, the server can determine the target parameter "light_status" and the conversion method "string mapping" corresponding to "light status off in night mode" from the protocol set according to the scene "light status off in night mode", or determine the target parameter "Air conditioner_status" and the conversion method "string mapping" corresponding to "temperature of air conditioner is 22 degrees in night mode" from the protocol set according to the scene "temperature of air conditioner is 22 degrees in night mode", and the like, which are not limited in the embodiments of the present application.

[0196] Step 504, generating a pre-conversion protocol.

[0197] Protocol conversion group query: according to the obtained scene parameters, the system searches for the corresponding target parameter name and conversion method in the protocol conversion group. Generating protocol: using the found target parameter name and conversion method, the scene parameters are converted into the target protocol. For example, "light status: off" is converted into "light_status: off".

[0198] Step 505, testing the pre-conversion protocol to obtain a test result.

[0199] The pre-conversion protocol is tested to determine whether the conversion result meets the expectation. By simulating the actual application environment, the effectiveness and accuracy of the pre-conversion protocol are verified. For example, the pre-conversion protocol is applied to the actual system to check whether the converted "user_id" can be correctly identified and processed.

[0200] Specifically, in the process of monitoring the conversion, after the system receives the source parameter "username", it can perform conversion processing on the source parameter, and then obtain the target parameter "user_id", verify the target parameter, for example, verify whether the target parameter can be correctly identified and processed by the device to be processed, and record the conversion result, save the conversion result of each test case for subsequent verification; ensure that the converted target parameter "user_id" can be correctly identified and processed.

[0201] Step 506, determining whether the test result meets the expectation.

[0202] Specifically, in the process of determining whether the test result meets the expectation, that is, determining whether the test result can be correctly identified and processed, in the case that the test result can be correctly identified and processed, it can be considered that the test result meets the expectation, and in the case that the test result cannot be correctly identified and processed, it can be considered that the test result does not meet the expectation.

[0203] Step 507, adjusting the protocol conversion group to be converted protocol parameters.

[0204] In the case that the test result does not meet the expectation, the server can adjust the protocol conversion group to be converted protocol parameter.

[0205] Step 508, confirming and applying the conversion protocol.

[0206] Exemplarily, the server sends the generated target protocol to the corresponding smart home device. The smart home device performs response processing, that is, after receiving the target protocol, the smart home device adjusts the state of the device according to the instruction in the target protocol, for example, turning off the light or adjusting the air conditioner temperature, which is not limited in the embodiment of the present application.

[0207] Device embodiment

[0208] As shown in Figure 6 , Figure 6 a logic block of a protocol generation device provided by an embodiment of the present application is shown Figure One , which comprises:

[0209] The first acquisition module 6001 is configured to acquire the upgrade parameter corresponding to the target function from the database;

[0210] The first determination module 6002 is configured to determine the protocol conversion group according to the upgrade parameter; the protocol conversion group comprises the target parameter corresponding to the source parameter and the conversion method;

[0211] The first acquisition module is further configured to acquire the scene parameter corresponding to the device to be processed; the scene parameter is used to indicate the scene mode and the working state of the device to be processed;

[0212] The first determination module is further configured to determine the first target parameter corresponding to the scene parameter and the first conversion method from the protocol conversion group based on the scene parameter;

[0213] The first generation module 6003 is configured to generate the target protocol according to the first target parameter name and the first conversion method;

[0214] The sending module 6004 is configured to send the target protocol to the client, so that the client executes the target function corresponding to the scene parameter based on the target protocol.

[0215] As shown in Figure 7 , Figure 7 a logic block of a protocol generation device provided by an embodiment of the present application is shown Figure Two , optionally, the device further comprises:

[0216] The second generation module 6005 is configured to generate the pre-conversion protocol based on the first target parameter and the first conversion method;

[0217] The second determination module 6006 is configured to test the pre-conversion protocol to determine the test result corresponding to the pre-conversion protocol.

[0218] Module 6007 is obtained, which is used to convert the format of the pre-conversion protocol according to the configuration parameters of the device to be processed, and obtain the target protocol, provided that the pre-conversion protocol passes the test.

[0219] like Figure 8 As shown, Figure Eight This paper illustrates a logic block diagram of a protocol generation apparatus provided in an embodiment of this application. Figure Three Optionally, the device further includes:

[0220] The third determining module 6008 is used to determine the home scene based on the collected sensor data or user input data; and to determine the scene mode corresponding to the home scene based on the home scene.

[0221] The second acquisition module 6009 is used to obtain the scene parameters corresponding to the device to be processed from the database based on the scene mode.

[0222] like Figure Nine As shown, Figure Nine This paper illustrates a logic block diagram of a protocol generation apparatus provided in an embodiment of this application. Figure Four Optionally, the device further includes:

[0223] The fourth determining module 6010 is used to determine the first identification information corresponding to the scene mode and the second identification information corresponding to the working state; traverse the protocol conversion group, and determine the first target parameter and the first conversion method corresponding to the scene parameter based on the identification matching strategy.

[0224] Optionally, the second determining module 6006 includes:

[0225] Generate sub-units to generate test cases for the pre-conversion protocol;

[0226] The sub-units are obtained and used to execute test cases in the test system to obtain the conversion results corresponding to the pre-conversion protocol;

[0227] The verification subunit is used to verify whether the conversion result can be correctly recognized and processed by the device under test in the test scenario;

[0228] The determination sub-unit is used to determine whether the pre-conversion protocol passes the test, provided that the conversion result can be correctly identified and processed by the device to be processed.

[0229] Optionally, the device further includes:

[0230] The sub-unit is determined based on the protocols stored in the database to identify the source parameters corresponding to each protocol; for each source parameter, the target parameters and conversion method are determined.

[0231] The generating sub-unit is configured to generate a protocol conversion group according to the target parameter corresponding to each source parameter and the conversion method.

[0232] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts are described in the method embodiment.

[0233] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between the embodiments can be referred to each other.

[0234] The protocol generation device in the embodiment of the application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than the terminal. For example, the electronic device can be a GPU BOX, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), and can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, and the like, and the embodiment of the application is not limited in this regard.

[0235] The protocol generation device in the embodiment of the application can be a device with an operating system. The operating system can be an Android operating system, a Linux operating system, a Windows operating system, or other possible operating systems, and the embodiment of the application is not limited in this regard.

[0236] The protocol generation device provided in the embodiment of the application can implement each process of the method embodiment, and thus the details are not described herein. Figure 1

[0237] Optionally, as Figure 10 ​As shown, the embodiment of the present application further provides an electronic device 1100, comprising a processor 1101 and a memory 1102, wherein the memory 1102 stores a program or instruction which can run on the processor 1101, and the program or instruction is executed by the processor 1101 to realize each step of the protocol generation method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein.

[0238] In the embodiment of the present application, the memory 1102 can be used to store software programs and various data. The memory 1102 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, at least one application program or instruction required by a function (such as a sound playing function, an image playing function, etc.), and the like. In addition, the memory 1102 can include a volatile memory or a non-volatile memory, or the memory 1102 can include both volatile and non-volatile memories. The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 1102 in the embodiment of the present application includes but is not limited to these and any other suitable type of memory.

[0239] The processor 1101 can include one or more processing units; optionally, the processor 1101 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and an application program, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1101.

[0240] The embodiment of the present application further provides an electronic device, which comprises a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is used for storing executable instructions, the executable instructions make the processor execute various processes of the protocol generation method embodiment and can achieve the same technical effects, to avoid repetition, here will not repeat.

[0241] The embodiment of the present application further provides a readable storage medium, the readable storage medium stores a program or instructions, the program or instructions are executed by a processor to realize various processes of the protocol generation method embodiment and can achieve the same technical effects, to avoid repetition, here will not repeat.

[0242] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0243] The embodiment of the present application further provides a chip, which comprises a processor and a communication interface, the communication interface and the processor are coupled, the processor is used for running a program or instructions to realize various processes of the protocol generation method embodiment and can achieve the same technical effects, to avoid repetition, here will not repeat.

[0244] It should be understood that the chip involved in the embodiment of the present application can also be referred to as a system level chip, a system chip, a chip system or a system on chip, etc.

[0245] The embodiment of the present application provides a computer program product, which is stored in a storage medium, the program product is executed by at least one processor to realize various processes of the protocol generation method embodiment and can achieve the same technical effects, to avoid repetition, here will not repeat.

[0246] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element. Furthermore, it is to be understood that the method and apparatus of the present application can be carried out by more than one process, method, article, or apparatus either simultaneously, concurrently, or with intermediate steps missing or added. Also, the features described in relation to one example can be combined with features described in relation to other examples.

[0247] From the above description of the embodiments, it is apparent that the above-described method of the embodiments can be implemented by means of software and the requisite general- purpose hardware platform, of course, but in many cases the former is the preferred implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the related art, can be embodied in the form of a computer software product stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk), including a number of instructions for causing a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in the various embodiments of the present application.

[0248] The embodiments of the present application are described above in conjunction with the drawings, but the present application is not limited to the specific embodiments described above, which are merely illustrative rather than restrictive, and a person of ordinary skill in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the protection scope of the claims.

Claims

1. A protocol generation method characterized by, Applied to a server, the method comprises: Obtaining an upgrade parameter corresponding to a target function from a database; Determining a protocol conversion group according to the upgrade parameter; the protocol conversion group comprises a target parameter corresponding to a source parameter and a conversion method; Obtaining a scene parameter corresponding to a device to be processed; the scene parameter is used to indicate a scene mode and a working state of the device to be processed; Based on the scene parameter, determining a first target parameter and a first conversion method corresponding to the scene parameter from the protocol conversion group; Generating a target protocol according to the first target parameter and the first conversion method; Sending the target protocol to a client to enable the client to execute a target function corresponding to the scene parameter based on the target protocol.

2. The method of claim 1, wherein, The generating of the target protocol according to the first target parameter and the first conversion method comprises: Generating a pre-conversion protocol based on the first target parameter and the first conversion method; Testing the pre-conversion protocol to determine a test result corresponding to the pre-conversion protocol; In the case that the pre-conversion protocol passes the test, performing format conversion on the pre-conversion protocol according to configuration parameters of the device to be processed to obtain the target protocol.

3. The method of claim 1, wherein, The obtaining of the scene parameter corresponding to the device to be processed comprises: Determining a home scene according to collected sensor data or user input data; Determining a scene mode corresponding to the home scene based on the home scene; Obtaining the scene parameter corresponding to the device to be processed from the database based on the scene mode.

4. The method of claim 1, wherein, The scene parameter comprises a scene mode and a working state of the device to be processed. The determining of the first target parameter and the first conversion method corresponding to the scene parameter from the protocol conversion group based on the scene parameter comprises: Determining first identification information corresponding to the scene mode and second identification information corresponding to the working state; Iterating through the protocol conversion group to determine the first target parameter and the first conversion method corresponding to the scene parameter based on an identification matching strategy.

5. The method of claim 1, wherein, The method further comprises: Determining source parameters corresponding to each protocol based on protocols stored in the database; For each source parameter, determining a target parameter and a conversion method corresponding to the source parameter; Generating a protocol conversion group according to the target parameter and the conversion method corresponding to each source parameter.

6. The method of claim 2, wherein, The testing of the pre-conversion protocol to determine a test result corresponding to the pre-conversion protocol comprises: Generating a test case for the pre-conversion protocol; Executing the test case in a test system to obtain a conversion result corresponding to the pre-conversion protocol; Verifying whether the conversion result can be correctly recognized and processed by the device to be processed in a test scene; In the case that the conversion result can be correctly recognized and processed by the device to be processed, determining that the pre-conversion protocol passes the test.

7. A protocol generation apparatus characterized by comprising: The apparatus comprises: A first obtaining module for obtaining an upgrade parameter corresponding to a target function from a database; A first determining module for determining a protocol conversion group according to the upgrade parameter; the protocol conversion group comprises a target parameter corresponding to a source parameter and a conversion method; The first obtaining module is further configured to obtain a scene parameter corresponding to the to-be-processed device; the scene parameter is used to indicate a scene mode and a working state of the to-be-processed device. The first determining module is further configured to determine a first target parameter and a first conversion method corresponding to the scene parameter from the protocol conversion group based on the scene parameter. The first generating module is configured to generate a target protocol according to the first target parameter and the first conversion method. The sending module is configured to send the target protocol to a client, so that the client performs a target function corresponding to the scene parameter based on the target protocol.

8. The protocol generation apparatus according to claim 7, wherein The apparatus further includes: The second generating module is configured to generate a pre-conversion protocol based on the first target parameter and the first conversion method. The second determining module is configured to test the pre-conversion protocol and determine a test result corresponding to the pre-conversion protocol. The obtaining module is configured to, in a case where the pre-conversion protocol passes the test, perform format conversion on the pre-conversion protocol according to configuration parameters of the to-be-processed device, and obtain a target protocol.

9. The protocol generation apparatus according to claim 7, wherein The apparatus further includes: The third determining module is configured to determine a home scene according to collected sensor data or user input data, and determine a scene mode corresponding to the home scene based on the home scene. The second obtaining module is configured to obtain a scene parameter corresponding to the to-be-processed device from the database based on the scene mode.

10. The protocol generation apparatus according to claim 7, wherein The apparatus further includes: The fourth determining module is configured to determine first identification information corresponding to the scene mode and second identification information corresponding to the working state, and traverse the protocol conversion group, determine a first target parameter and a first conversion method corresponding to the scene parameter based on an identification matching strategy.

11. An electronic device, comprising: The electronic device includes a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface complete communication with each other through the communication bus. The memory is used to store executable instructions, and the executable instructions make the processor execute the protocol generation method in any one of claims 1 to 6.

12. A readable storage medium, characterized by, The readable storage medium stores programs or instructions, and the programs or instructions are executed by the processor to implement the protocol generation method in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Protocol stack determination method and device, terminal and network equipment

    CN114727332A

  • Protocol generation method, end-cloud collaborative recommendation method and device

    CN116600020A