Internet of Things communication data legality verification method, system and device and storage medium

By separating the definition of object model from verification rules and setting up local cache in the Internet of Things communication system, the problems of large resource overhead, insufficient flexibility and inefficiency in the existing technology are solved, and more efficient and stable Internet of Things communication data verification is achieved.

CN120017216APending Publication Date: 2025-05-16XIAMEN LEELEN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510093106.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The existing IoT communication data verification methods have high resource overhead, insufficient flexibility and low efficiency, especially in the frequent changes in device models and high concurrent communication scenarios, resulting in performance degradation and management complexity.

Method used

By separating object model definition from verification rules, the object model definition service translation object model is defined as standardized verification rules and stored in the rule management center. The verification server obtains corresponding verification rules from the rule management center for data verification, and caches common rules locally to reduce dependence on external storage.

Benefits of technology

The decoupling of device model definition and verification rules is achieved, the stability and flexibility of the system are improved, the dependence on external storage is reduced, and the efficiency and performance of verification services are improved, especially in high concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120017216A_ABST
    Figure CN120017216A_ABST
Patent Text Reader

Abstract

The invention discloses an Internet of Things communication data legality verification method, system and device and a storage medium, and the method comprises the following steps: initiating an object model definition request to an object model definition service, and storing a defined object model; translating the stored object model definition into a standardized verification rule, and submitting the standardized verification rule to a rule management center for storage; the Internet of Things terminal reports data and requests a data verification service; and the verification server obtains a verification rule corresponding to the terminal from a rule management center, and performs validity verification on the data reported by the terminal based on the verification rule. According to the method and the device, the definition of the equipment model and the decoupling of the verification rule are realized, so that the adjustment or updating of the equipment model does not influence the normal operation of verification service, and the stability and flexibility of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Internet of Things communications, and in particular relates to a method, system, device and storage medium for verifying the legitimacy of Internet of Things communication data. Background Art

[0002] In the field of the Internet of Things, devices are digitally modeled by defining object models. Devices and the Internet of Things platform communicate based on the object model. Typical communication scenarios include attribute reporting, event reporting, action execution, and attribute setting. In the communication process, in order to avoid unexpected effects caused by incorrect parameters, there are constraints on the range of communication data values. For example, if an action for adjusting the temperature is defined for a smart air conditioner, it contains a parameter: the target temperature value. Then, this action can be called through the Internet of Things platform to adjust the air conditioner temperature. At this time, the target temperature value cannot be set too low or too high, otherwise it will have adverse effects on the human body. Therefore, the communication data needs to be verified.

[0003] Devices can flexibly define object models based on actual functions, so the object models of different devices are also different. When developing new devices, new object model definitions will also be added. In addition, during the upgrade and function iteration of the Internet of Things, the description of the device object model may be adjusted, including the introduction of new functions, the removal of unsupported functions, the introduction of new concepts, etc. If the verification method is bound to the object model definition method, then every adjustment to the object model definition method will force the verification service to adjust. This will lead to additional workload and complexity, increase the instability of the Internet of Things platform, and bring certain repetitiveness and complexity to program development and maintenance.

[0004] The Chinese invention patent application with publication number CN111106899A discloses a data verification method, device, computer equipment and storage medium in the Internet of Things, the method comprising: when receiving the data to be verified, obtaining the JSON schema rule of the device model to which the access device corresponding to the data to be verified belongs; cutting out the JSON schema rule fragment describing the data to be verified from the JSON schema rule according to the data to be verified; and verifying the data to be verified using the JSON schema rule fragment. Through the above method, in the data verification process in the Internet of Things, in view of the characteristics of the fragmentary periodic transmission of the Internet of Things scene data, the JSON schema rule fragment corresponding to the data to be detected is used to verify the data to be detected.

[0005] In IoT applications, different products and different versions of object models of the same product have different verification rules. In addition, multiple functions may be defined in the same product, such as different attributes, events, actions, etc. These different object models and different functions will be transformed into verification rules, so the number of verification rules will gradually accumulate over time. Verification services are generally designed as stateless services, so each verification service may verify the data corresponding to any rule, so the verification service may use any verification rule. If the verification rules are stored in external storage, such as a database, each verification needs to read the verification rules from the external storage, which will cause the performance of the verification service to drop sharply, which is unbearable in the high-concurrency communication of the IoT. Even if the rules are cached in the middleware, it is not the best practice.

[0006] Therefore, the above solution relies on the complete JSON schema rules, and obtains the JSON schema rule fragments that describe the data to be verified through clipping. This process requires dynamic clipping of rules for each reported data, which adds additional computing overhead. At the same time, it cannot adapt to frequent changes in device models and is difficult to flexibly support different versions of device models. In addition, the implementation of dynamic clipping rules requires frequent access to the device model database, which may cause delays or performance bottlenecks, resulting in low efficiency in rule storage and management. Summary of the invention

[0007] The present invention provides a method, system, device and storage medium for verifying the legitimacy of Internet of Things communication data, aiming to solve the problems of large resource overhead, insufficient flexibility and low efficiency.

[0008] In order to solve the above technical problems, the first aspect of the present invention provides a method for verifying the legitimacy of IoT communication data, comprising the following steps:

[0009] Initiate a thing model definition request to the thing model definition service and save the defined thing model;

[0010] Translate the saved physical model definition into standardized verification rules and submit them to the rule management center for storage;

[0011] The IoT terminal reports data and requests data verification service;

[0012] The verification service end obtains the verification rules corresponding to the terminal from the rule management center, and performs a legality verification on the data reported by the terminal based on the verification rules.

[0013] Preferably, the verification server is also provided with a local cache, and the local cache obtains and caches corresponding verification rules from the rule management center based on the IoT communication statistics data.

[0014] Preferably, the cache rule of the local cache is:

[0015] Introduce communication statistics service to count the number of communications defined in each object model within the preset statistical period;

[0016] The statistical information is associated with the verification rules and stored in the verification rule management center;

[0017] Based on the communication quantity of the statistical information, a frequently used verification rule is determined, and the frequently used verification rule is cached in a local cache of the verification service.

[0018] Preferably, the verification server also updates the local cache when receiving data reported by the IoT terminal, and the updating method is:

[0019] Receive data reported by IoT terminals;

[0020] Check whether there is a verification rule corresponding to the reported data in the local cache. If there is a verification rule, further determine whether the corresponding verification rule has expired;

[0021] If the verification rule corresponding to the local cache does not exist or has expired, obtain a new verification rule from the verification rule management center;

[0022] Check if the local cache is full;

[0023] If the local cache is not full, the new verification rule is inserted into the local cache to complete the local cache update;

[0024] If the local cache is full, extract the lowest priority verification rule in the local cache according to the preset cache rules, and determine whether the new verification rule is used more frequently than the extracted verification rule. If so, use the new verification rule to replace the extracted verification rule. Otherwise, do not update the local cache and end the local cache update task.

[0025] Preferably, the translation of the saved object model definition into standardized verification rules includes attribute reporting translation, attribute sending translation, action sending translation, action sending response translation, event reporting translation and basic type variable translation.

[0026] Preferably, the rules for translating the basic type variables include:

[0027] For int32 type variables, get the variable type, upper and lower limits;

[0028] For float type variables, get the variable type, upper and lower limits;

[0029] For double type variables, get the variable type, upper and lower limits;

[0030] For enum type variables, get the variable type, translate the value range into a oneof rule, and translate the enumeration value into multiple integer rules within the oneof rule. The maximum and minimum values ​​of the integer rules are both enumeration values.

[0031] For bool type variables, set the variable type to integer, the minimum value to 0, and the maximum value to 1;

[0032] For text type variables, get the variable type, minimum length, and maximum length;

[0033] For date type variables, get the variable type, set the same upper and lower limits, and set a regular expression to verify the variable;

[0034] For a struct type variable, obtain the variable type, configure a declaration and an attribute, the declaration indicates that no additional fields are allowed to be added, and the attribute lists the validation rules for each field;

[0035] For array type variables, get the variable type, and set the minimum and maximum values ​​to the size value in the variable.

[0036] Preferably, the specific method of sending the attribute translation is:

[0037] Iterate over all properties in the object model definition;

[0038] If the attribute is readable and writable, the attribute is translated according to the rules for translating variables of the basic type;

[0039] If the property is read-only, it is translated as: false, and explicitly states that this property is not allowed to exist during the delivery process.

[0040] In a second aspect of the present invention, a system for verifying the legitimacy of Internet of Things communication data is further provided. The system is used to implement the method for verifying the legitimacy of Internet of Things communication data as described in the first aspect of the present invention, comprising:

[0041] The object model definition service module is used to receive the user's request for defining a new object model, save the object model definition, translate it into standard verification rules, and submit the verification rules to the rule management center for storage;

[0042] The rule management center is used to receive and store the verification rules submitted by the object model definition service module, and to count and mark the usage frequency of the verification rules based on the IoT communication statistics;

[0043] The communication statistics service module is used to count the number of communications of IoT terminals within a preset statistical period, associate the statistical results with the corresponding object model definition, and provide them to the verification rule management center to update the usage frequency of the verification rules;

[0044] The verification service module is used to receive data reported by the IoT terminal, and further includes a local cache submodule and a rule acquisition submodule;

[0045] The local cache submodule stores commonly used validation rules and dynamically updates the cache based on statistical data, time sensitivity, or other priority strategies;

[0046] The rule acquisition module obtains the corresponding verification rules from the verification rule management center and updates the local cache when the rules do not exist in the local cache or have expired;

[0047] The data verification module verifies the legitimacy of the reported data based on the obtained verification rules.

[0048] According to a third aspect of the present invention, an electronic device is provided, comprising:

[0049] one or more processors;

[0050] A memory for storing executable instructions;

[0051] Among them, when the executable instructions in the memory are executed by the processor, the electronic device can implement the method for verifying the legitimacy of Internet of Things communication data as described in the first aspect of the present invention.

[0052] The fourth aspect of the present invention further proposes a storage medium storing computer executable instructions, wherein the instructions, when executed by a processor, enable a device to execute the method for verifying the legitimacy of Internet of Things communication data as described in the first aspect of the present invention.

[0053] Compared with the prior art, the present invention has the following technical effects:

[0054] 1. The Internet of Things communication data legitimacy verification method proposed in the present invention separates the verification rules from the object model definition. Since the verification service only depends on the verification rules, not the object model definition, the decoupling of the device model definition and the verification rules is achieved, so that the adjustment or update of the device model will not affect the normal operation of the verification service, thereby improving the stability and flexibility of the system.

[0055] 2. The Internet of Things communication data legitimacy verification method proposed in the present invention can set up multiple different object model definition services, corresponding to a verification rule management center, to separate the object model definition and data verification; ensure that after the old object model definition mode is upgraded, the functional consistency of the verification service in different object model definition modes is maintained, thereby improving the efficiency of legitimacy verification.

[0056] 3. The IoT communication data legitimacy verification method proposed in the present invention sets local cache and cache rules, and dynamically manages cache rules based on communication statistics, time sensitivity or other priority strategies. By storing commonly used rules in local memory, the dependence on database or external storage is greatly reduced, the efficiency of rule acquisition is improved, and the system overhead is reduced; the cache-based rule management mechanism significantly reduces the number of accesses to external storage, ensuring the rapid response capability of the verification service in high-concurrency scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a schematic diagram of the flow of the verification method of the present invention;

[0058] Figure 2 is a timing diagram of the translation preservation verification rule according to an embodiment of the present invention;

[0059] Figure 3 This is a statistical information update timing diagram described in an embodiment of the present invention. DETAILED DESCRIPTION

[0060] In order to make the objectives, technical solutions and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in combination with specific embodiments of the present application and with reference to the accompanying drawings.

[0061] Object model: describes what the entity is, what it can do, and what information it can provide to the outside world from the three dimensions of attributes, actions, and events. In the IoT industry, object models are generally used to model devices. Object models are generally divided into functional definitions such as attributes, actions, and events. Each function will have some constraints on related data.

[0062] Attributes: used to describe and adjust the information and status of a device. The attribute definition should include constraints on the range of attribute values.

[0063] Action: An instruction used for external calls. The action definition should include constraints on the value range of the request and response data.

[0064] Event: used by devices to report information to the IoT platform. The event definition contains constraints on the value range of event data.

[0065] When using the object model for communication, the above communication data needs to be verified according to the object model definition.

[0066] Verification rules: Based on the object model definition, the content that needs to be verified is extracted and constructed into data in a certain format, namely the rules, for subsequent actual verification.

[0067] Embodiment 1

[0068] This embodiment is a method for verifying the legitimacy of IoT communication data. In this embodiment, the user first initiates a request to define a physical model. After the request reaches the physical model definition service, it will be saved and then translated into verification rules. The verification rules are submitted to the verification rule management center for storage. When the device reports data, after the data reaches the verification service, the verification service obtains the verification rule details from the verification rule management center and performs verification according to the verification rules.

[0069] Specifically, Figure 1 As shown, the steps include steps 1 to 4:

[0070] In step 1, the user initiates a request for object model definition to the object model definition service and saves the defined object model. Here, after receiving the request, the object model definition service saves the object model definition.

[0071] An example of a thing model definition service is as follows:

[0072] {

[0073] "productKey":"e77f15",

[0074] "version":"V1",

[0075] "blockId":"e77f15",

[0076] "actions":Array[1],

[0077] "events":Array[1],

[0078] "properties":Array[2]

[0079] }

[0080] Among them, productKey represents the unique identifier of the product corresponding to the physical model, which is used to distinguish different products. version represents the version number of the physical model, which is used for version management of the device model. blockId is consistent with productKey and can be used to distinguish the functional module or device instance to which the device model belongs.

[0081] The actions of the object model define the operational behavior of the device (similar to the functions or services provided by the device). Each operation contains input parameters and output parameters, which are used to describe the conditions and return results required for the operation. Events define the events that the device can actively report during operation, which are usually used for status notifications, alarms, etc. Properties define the attributes of the device, which are usually used to describe the static or dynamic characteristics of the device.

[0082] Step 2: After the object model definition is saved, the object model definition service sends a new rule request to the verification rule management center to translate the saved object model definition into a standardized verification rule, and submits it to the rule management center for storage. After receiving the new request, the verification rule management center saves the verification rule.

[0083] In step 2, the backend needs to build verification rules from the object model definition. The format of the verification rules is determined by the communication protocol. For example, if json is used as the payload format for communication, the verification rule can be a json-schema, and the json-schema related library can be used for verification later. If it is other protocols, verification rules in other formats can be defined.

[0084] The verification process is determined by the specific communication protocol and verification rule format. For example, if json is used as the communication payload format, the verification rule can be a json-schema, and the json-schema related library can be used for verification.

[0085] This embodiment takes json as an example to illustrate the verification rules. Figure 2 As shown in the figure, it is a sequence diagram for translating and saving verification rules. In the actual implementation process, such as system upgrade, the new and old versions of services are used together, and there may be multiple different object model definition services, such as Figure 2 The object model definition service 1 and the object model definition service 2 shown can be distinguished in the version key of the object model definition. For example, in the request submitted to the object model definition service 1, the value corresponding to the version key is V1; in the request submitted to the object model definition service 2, the value corresponding to the version key is V2. However, even if there are multiple different versions of the object model definition service, only one verification rule management center can be set up, that is, the definition and verification are separated, and different versions of the object model definition service can be translated into verification rules and saved.

[0086] The translation of the saved object model definition into standardized verification rules includes attribute reporting translation, attribute delivery translation, action delivery translation, action delivery response translation, event reporting translation, and basic type variable translation. In the definitions of attributes, actions, and events, the most fine-grained variables are all basic type variables. Basic type variables can be: int32 type variables, float type variables, double type variables, enum type variables, bool type variables, text type variables, date type variables, struct type variables, and array type variables. An attribute can be a basic type variable; the request parameters and response parameters of an action can contain zero, one, or more basic type variables; the request parameters of an event can contain zero, one, or more basic type variables.

[0087] The rules for translating basic type variables include:

[0088] For int32 type variables, get the variable type, upper and lower limits. For example, for an int32 type variable, the requested object model definition parameters are as follows:

[0089] {"type":"int32","specs":{"max":"111","min":"1","step":"1","unit":"","unitName":"--"}}.

[0090] The translated validation rules are as follows:

[0091] {"type":"integer","minimum":1,"maximum":111}.

[0092] It can be seen that if the object model is defined as int32, the translation rules are: type in the verification rule is fixed to integer; max in the object model definition is translated into maximum, and the maximum value is the value of max; min in the object model definition is translated into minimum, and the minimum value is the value of min; other fields in the object model definition do not need to be verified, so they are not translated.

[0093] For float type variables, get the variable type, upper and lower limits. For example, for a float type variable, the requested object model definition parameters are as follows:

[0094] {"type":"float","specs":{"max":"111","min":"1","step":"1","unit":"","unitName":"--"}}.

[0095] The translated validation rules are as follows:

[0096] {"type":"number","minimum":1,"maximum":111}.

[0097] It can be seen that if the object model is defined as float, the translation rules are as follows: type in the verification rule is fixed to number; max in the object model definition is translated into maximum, and the maximum value is the value of max; min in the object model definition is translated into minimum, and the minimum value is the value of min; other fields in the object model definition do not need to be verified, so they are not translated.

[0098] For double type variables, get the variable type, upper and lower limits. For example, for a double type variable, the requested object model definition parameters are as follows:

[0099] {"type":"double","specs":{"max":"111","min":"1","step":"1","unit":"","unitName":"--"}}.

[0100] The translated validation rules are as follows:

[0101] {"type":"number","minimum":1,"maximum":111}.

[0102] It can be seen that if the object model is defined as double, the translation rules are: type in the verification rule is fixed to number; max in the object model definition is translated as maximum, and the maximum value is the value of max; min in the object model definition is translated as minimum, and the minimum value is the value of min; other fields in the object model definition do not need to be verified, so they are not translated.

[0103] For enum type variables, get the variable type, translate the value range into a oneof rule, and translate the enumeration value into multiple integer rules inside the oneof rule. The maximum and minimum values ​​of the integer rules are both enumeration values. For example, for an enum type variable, the requested object model definition parameters are as follows:

[0104] {"type":"enum","specs":{"1":"Type 1","2":"Type 2","3":"Type 3"}}.

[0105] The translated validation rules are as follows:

[0106] {"oneOf":[{"type":"integer","minimum":1,"maximum":1},{"type":"integer","minimum":2,"maximum":2},{"type":"integer","minimum":3,"maximum":3}]}.

[0107] It can be seen that if the object model is defined as enum, the translation rules are: type in the verification rule is fixed to integer; the value range is translated into a oneof rule, and the enumeration value is translated into multiple integer rules within the oneof rule. The maximum and minimum values ​​of the integer rules are both enumeration values; other fields in the object model definition do not need to be verified, so they are not translated.

[0108] For a bool type variable, set the variable type to integer, set the minimum value to 0, and set the maximum value to 1. For a bool type variable, the requested object model definition parameters are as follows:

[0109] {"type":"bool","specs":{"0":"off","1":"on"}}.

[0110] The translated validation rules are as follows:

[0111] {"type":"integer","minimum":0,"maximum":1}.

[0112] It can be seen that if the object model is defined as bool, the translation rules are: type in the verification rule is fixed to integer; the minimum value is fixed to 0; the maximum value is fixed to 1.

[0113] For text type variables, get the variable type, minimum length, and maximum length. For example, for a text type variable, the requested object model definition parameters are as follows:

[0114] {"type":"text","specs":{"length":"100"}}.

[0115] The translated validation rules are as follows:

[0116] {"type":"string","minLength":0,"maxLength":100}.

[0117] It can be seen that if the object model is defined as text type, the translation rules are: type in the verification rule is fixed to string; the minimum length minLength is fixed to 0; the maximum length maxLength is fixed to the length value in the definition.

[0118] For date type variables, get the variable type, set the same upper and lower limits, and set a regular expression to verify the variable. For example, for a date type variable, the requested object model definition parameters are as follows:

[0119] {"type":"date","specs":{}}.

[0120] The translated validation rules are as follows:

[0121] {"type":"string","minLength":13,"maxLength":13,"pattern":"^[0-9]+$"}.

[0122] It can be seen that if the object model is defined as the date type, a fixed length of 13 digits is required, and the regular expression "^[0-9]+$" is used to match numbers between 0 and 9.

[0123] For a struct type variable, obtain the variable type, configure a declaration and an attribute, the declaration indicates that no additional fields are allowed, and the attribute lists the validation rules for each field. For example, for a struct type variable, the requested object model definition parameters are as follows:

[0124] {"type":"struct","specs":[{"name":"a","identifier":"a","dataType":{"type":"int32","specs":{"max":"111","min":"1","step":"1","unit":"","unitName":"--"}}}]}.

[0125] The translated validation rules are as follows:

[0126] {"type":"object","additionalProperties":false,"required":["a"],"properties":{"a":{"type":"integer","minimum":1,"maximum":111}}}.

[0127] It can be seen that if the object model is defined as struct type, the translation rules are as follows: type in the validation rule is fixed to object; additionalProperties is configured as false, and additional fields are not allowed to be added; the validation rules for each field are listed in Properties, where the validation rules for the internal fields are translated from the fields in specs in the object model definition, and the translation rules are consistent with the rules for other basic types above; Required is defined as an array, which contains and only contains all subfields in specs in the object model definition.

[0128] For array type variables, get the variable type, and set the minimum and maximum values ​​to the size value in the variable. For example, for a struct type variable, the requested object model definition parameters are as follows:

[0129] {"type":"array","specs":{"item":{"type":"int32"},"size":"3"}}.

[0130] The translated validation rules are as follows:

[0131] {"type":"array","minItems":3,"maxItems":3,"items":{"type":"integer"}}.

[0132] It can be seen that if the object model is defined as array type, the translation rules are: type is fixed to array in the verification rule; the maxItems field is the value of size; the minItems field is the value of size; the items.type field is the value of specs.item.type in the object model definition.

[0133] The specific method of attribute reporting and translation is: traverse all attributes in the object model definition; each attribute is a basic type variable mentioned above, and is directly translated according to the above basic type variable.

[0134] The specific method of sending the attribute translation is:

[0135] Iterate over all properties in the object model definition;

[0136] If the attribute is readable and writable, the attribute is translated according to the rules for translating variables of the basic type;

[0137] If the property is read-only, it is translated as: false, and explicitly states that this property is not allowed to exist during the delivery process.

[0138] The specific method of sending the translation of the action is: traverse all fields in the input parameter inputData of the action in the object model definition; each field is a basic type variable mentioned above, and is directly translated according to the above basic type variable.

[0139] The specific method of translating the response sent by the action is: traverse all fields in the output parameter outputData of the action in the object model definition; each field is a basic type variable mentioned above, and is directly translated according to the above basic type variable.

[0140] The specific method of event reporting translation is: traverse all fields in the output parameter outputData of the event in the object model definition; each field is a basic type variable mentioned above, and is directly translated according to the above basic type variable.

[0141] Step 3: The IoT terminal reports data and requests data verification service.

[0142] Step 4: The verification server obtains the verification rules corresponding to the terminal from the rule management center, and performs a validity verification on the data reported by the terminal based on the verification rules. After the verification is completed, the IoT platform can proceed to the next step based on the verification results. Possible operations include but are not limited to: data that passes the verification is stored in the IoT, further processed, and forwarded to the application end; data that fails the verification is logged and a response is sent to the device end.

[0143] The verification service needs to use verification rules during verification, and the verification is generally stored in a database or middleware. In the high-concurrency communication scenario of the Internet of Things, even if it is stored in a high-performance middleware to achieve good performance indicators, there is still room for further optimization. A further optimization solution is to store the verification rules in the local memory of the service. However, the local memory of the service is limited and generally cannot store all the verification rules. Therefore, in this embodiment, the verification server is also provided with a local cache, and the local cache obtains and caches the corresponding verification rules from the rule management center based on the Internet of Things communication statistics.

[0144] The cache rules of the local cache include the following steps S11-S13:

[0145] S11: Introduce a communication statistics service to count the number of communications defined for each object model within a preset statistical period.

[0146] The statistical period can be adjusted according to actual needs, for example, it can be defined as 00:00:00-23:59:59 per day. The logical structure of the statistical results is as follows:

[0147] The object model defines a unique key Number of communications

[0148] Here is an example of statistics:

[0149]

[0150]

[0151] It can be seen that the object model with object model definition key = 2 has the largest number of daily communications, which means that the verification rule is used the most times. Such rules should be kept in memory to avoid additional retrieval from the database or middleware.

[0152] S12: Figure 3 As shown, the statistical information is associated with the verification rules and stored in the verification rule management center. Based on the above statistical information, the verification rule management center can additionally store this statistical information when storing the verification rules. An example of the logical structure stored in the rule verification center is as follows:

[0153] Verification rules Statistics

[0154] The following is an example of validation rule storage data:

[0155] Verification rules Statistics {"ruleId":123243,"…":"…"} 1002 {"ruleId":123244,"…":"…"} 300087 {"ruleId":123245,"…":"…"} 77282 {"ruleId":123246,"…":"…"} 235 …… ……

[0156] In order to maintain the accuracy of the statistical information, the communication statistics service needs to update the statistical information of the latest period to the verification rule management center at the end of each statistical period.

[0157] S13: Determine a frequently used verification rule based on the communication quantity of the statistical information, and cache the frequently used verification rule in a local cache of the verification service.

[0158] The verification server also updates the local cache when receiving data reported by the IoT terminal. The updating method includes steps S21-S26:

[0159] S21: receiving data reported by the IoT terminal;

[0160] S22: Check whether there is a verification rule corresponding to the reported data in the local cache, and if there is a verification rule, further determine whether the corresponding verification rule has expired;

[0161] S23: If the verification rule corresponding to the local cache does not exist or has expired, obtain a new verification rule from the verification rule management center;

[0162] S24: Check whether the local cache is full;

[0163] S25: If the local cache is not full, insert the new verification rule into the local cache to complete the local cache update;

[0164] S26: If the local cache is full, extract the lowest priority verification rule in the local cache according to the preset cache rules, and determine whether the new verification rule is used more frequently than the extracted verification rule. If so, use the new verification rule to replace the extracted verification rule. Otherwise, do not update the local cache and end the local cache update task.

[0165] In this way, as many communication processes as possible can be achieved without having to query the rules in the database or middleware, which reduces verification time and resource consumption, improves performance, and increases the hit rate of the local cache.

[0166] In order to ensure that the data of each statistical period can be used correctly, the timeout period of the verification rules in the local cache should be much smaller than a statistical period. For example, if the statistical period is 24 hours, then the timeout period is 30 minutes.

[0167] Embodiment 2

[0168] This embodiment is a system for verifying the legitimacy of Internet of Things communication data. The system is used to implement the method for verifying the legitimacy of Internet of Things communication data as described in Embodiment 1, including:

[0169] The object model definition service module is used to receive the user's request for defining a new object model, save the object model definition, translate it into standard verification rules, and submit the verification rules to the rule management center for storage;

[0170] The rule management center is used to receive and store the verification rules submitted by the object model definition service module, and to count and mark the usage frequency of the verification rules based on the IoT communication statistics;

[0171] The communication statistics service module is used to count the number of communications of IoT terminals within a preset statistical period, associate the statistical results with the corresponding object model definition, and provide them to the verification rule management center to update the usage frequency of the verification rules;

[0172] The verification service module is used to receive data reported by the IoT terminal, and further includes a local cache submodule and a rule acquisition submodule;

[0173] The local cache submodule stores commonly used validation rules and dynamically updates the cache based on statistical data, time sensitivity, or other priority strategies;

[0174] The rule acquisition module obtains the corresponding verification rules from the verification rule management center and updates the local cache when the rules do not exist in the local cache or have expired;

[0175] The data verification module verifies the legitimacy of the reported data based on the obtained verification rules.

[0176] Embodiment 3

[0177] This embodiment is an electronic device, including:

[0178] one or more processors;

[0179] A memory for storing executable instructions;

[0180] Among them, when the executable instructions in the memory are executed by the processor, the electronic device can implement the Internet of Things communication data legitimacy verification method as described in Example 1.

[0181] Embodiment 4

[0182] This embodiment is a storage medium storing computer executable instructions, wherein when the instructions are executed by a processor, the device can execute the Internet of Things communication data legitimacy verification method as described in the first embodiment.

[0183] The above is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A method for verifying the legitimacy of Internet of Things communication data, characterized in that: The following steps are involved: Initiate a thing model definition request to the thing model definition service and save the defined thing model; Translate the saved physical model definition into standardized verification rules and submit them to the rule management center for storage; The IoT terminal reports data and requests data verification service; The verification service end obtains the verification rules corresponding to the terminal from the rule management center, and performs a legality verification on the data reported by the terminal based on the verification rules.

2. The method for verifying the legitimacy of Internet of Things communication data according to claim 1, characterized in that: The verification server is also provided with a local cache, and the local cache obtains and caches corresponding verification rules from the rule management center based on the Internet of Things communication statistical data.

3. The method for verifying the legitimacy of Internet of Things communication data according to claim 2, characterized in that: The cache rules of the local cache are: Introduce communication statistics service to count the number of communications defined in each object model within the preset statistical period; The statistical information is associated with the verification rules and stored in the verification rule management center; Based on the communication quantity of the statistical information, a frequently used verification rule is determined, and the frequently used verification rule is cached in a local cache of the verification service.

4. The method for verifying the legitimacy of Internet of Things communication data according to claim 2, characterized in that: The verification server also updates the local cache when receiving data reported by the IoT terminal. The updating method is: Receive data reported by IoT terminals; Check whether there is a verification rule corresponding to the reported data in the local cache. If there is a verification rule, further determine whether the corresponding verification rule has expired; If the verification rule corresponding to the local cache does not exist or has expired, obtain a new verification rule from the verification rule management center; Check if the local cache is full; If the local cache is not full, the new verification rule is inserted into the local cache to complete the local cache update; If the local cache is full, extract the lowest priority verification rule in the local cache according to the preset cache rules, and determine whether the new verification rule is used more frequently than the extracted verification rule. If so, use the new verification rule to replace the extracted verification rule. Otherwise, do not update the local cache and end the local cache update task.

5. The method for verifying the legitimacy of Internet of Things communication data according to claim 1, characterized in that: The translation of the saved object model definition into standardized verification rules includes attribute reporting translation, attribute sending translation, action sending translation, action sending response translation, event reporting translation and basic type variable translation.

6. The method for verifying the legitimacy of Internet of Things communication data according to claim 5, characterized in that: The rules for translating basic type variables include: For int32 type variables, get the variable type, upper and lower limits; For float type variables, get the variable type, upper and lower limits; For double type variables, get the variable type, upper and lower limits; For enum type variables, get the variable type, translate the value range into a oneof rule, and translate the enumeration value into multiple integer rules within the oneof rule. The maximum and minimum values ​​of the integer rules are both enumeration values. For bool type variables, set the variable type to integer, the minimum value to 0, and the maximum value to 1; For text type variables, get the variable type, minimum length, and maximum length; For date type variables, get the variable type, set the same upper and lower limits, and set a regular expression to verify the variable; For a struct type variable, obtain the variable type, configure a declaration and an attribute, the declaration indicates that no additional fields are allowed to be added, and the attribute lists the validation rules for each field; For array type variables, get the variable type, and set the minimum and maximum values ​​to the size value in the variable.

7. The method for verifying the legitimacy of Internet of Things communication data according to claim 6, characterized in that: The specific method of sending the attribute translation is: Iterate over all properties in the object model definition; If the attribute is readable and writable, the attribute is translated according to the rules for translating variables of the basic type; If the property is read-only, it is translated to false and explicitly states that this property is not allowed to exist during the release process.

8. The Internet of Things communication data legitimacy verification system is characterized by: The system is used to implement the method according to any one of claims 1 to 7, comprising: The object model definition service module is used to receive the user's request for defining a new object model, save the object model definition, translate it into standard verification rules, and submit the verification rules to the rule management center for storage; The rule management center is used to receive and store the verification rules submitted by the object model definition service module, and to count and mark the usage frequency of the verification rules based on the IoT communication statistics; The communication statistics service module is used to count the number of communications of IoT terminals within a preset statistical period, associate the statistical results with the corresponding object model definition, and provide them to the verification rule management center to update the usage frequency of the verification rules; The verification service module is used to receive data reported by the IoT terminal, and further includes a local cache submodule and a rule acquisition submodule; The local cache submodule stores commonly used validation rules and dynamically updates the cache based on statistical data, time sensitivity, or other priority strategies; The rule acquisition module obtains the corresponding verification rules from the verification rule management center and updates the local cache when the rules do not exist in the local cache or have expired; The data verification module verifies the legitimacy of the reported data based on the obtained verification rules.

9. An electronic device, comprising: one or more processors; A memory for storing executable instructions; It is characterized in that when the executable instructions in the memory are executed by the processor, the electronic device can implement the Internet of Things communication data legitimacy verification method as described in any one of claims 1-7.

10. A storage medium storing computer executable instructions, characterized in that: When the instruction is executed by the processor, the device can execute the Internet of Things communication data legitimacy verification method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Data verification method and device in Internet of Things, computer equipment and storage medium

    CN111106899A