Device information management method and apparatus, electronic device, and storage medium
By distinguishing the message types of terminal devices and updating the active time comparison, the problem of resource waste caused by frequent updates of terminal devices is solved, and the data processing efficiency of the Netty-Redis cluster is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, frequent uplink messages from terminal devices update Netty-Redis cluster resources, leading to resource waste and reduced data processing efficiency.
By receiving messages from terminal devices, the message type is distinguished, and the active time in the application memory is updated based on the receiving time. This is compared with the active time within a preset interval, and only the necessary active time is updated in the remote dictionary service database to reduce unnecessary resource consumption.
It effectively reduces resource waste in the Netty-Redis cluster, improves data processing efficiency, and reduces the usage of Redis-setex by 30%.
Smart Images

Figure CN116846981B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, specifically to a device information management method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the rapid development of IoT technology, various terminal devices can be connected to the IoT for network management. After connecting to the IoT, terminal devices need to report device information to the server. Currently, each time the server receives device information reported by a terminal device, it updates the relevant information about the terminal device's status in the Remote Dictionary Server (Redis) database. However, due to the large number of uplink messages from terminal devices, and the fact that each uplink message requests an update to the information in Redis, resources in the Netty-Redis cluster are wasted, thus reducing the data processing efficiency of the Netty-Redis cluster. Summary of the Invention
[0003] This application provides a device information management method, apparatus, electronic device, and storage medium to reduce resource waste in Netty-Redis clusters and thereby improve the data processing efficiency of Netty-Redis clusters.
[0004] In a first aspect, embodiments of this application provide a device information management method, including:
[0005] Receive messages sent by terminal devices;
[0006] If the message type is the first message type, then based on the message reception time, the active time of the terminal device in the application memory is updated to obtain the first active time; wherein, the first message type is any message type other than the second message type among all message types; the second message type is a message type indicating that the device is online;
[0007] The first active time is compared with other active times among all active times within the current update interval, and the second active time of the terminal device in the remote dictionary service database is updated according to the comparison results.
[0008] In one embodiment, updating the second active time of the terminal device in the remote dictionary service database based on the comparison result includes:
[0009] If the comparison result shows that the first active time is the last active time among all active times within the current update interval, then the first active time will be updated to the second active time of the terminal device in the remote dictionary service database.
[0010] In one embodiment, updating the second active time of the terminal device in the remote dictionary service database based on the comparison result further includes:
[0011] If the comparison result shows that the first active time is not the last active time among all active times within the current update interval, then the last active time among all active times within the current update interval will be updated to the second active time of the terminal device in the remote dictionary service database.
[0012] In one embodiment, after receiving the message sent by the terminal device, the method further includes:
[0013] If the message type is the second message type, then based on the message reception time, the active time of the terminal device in the application memory and the second active time of the terminal device in the remote dictionary service database are updated respectively.
[0014] In one embodiment, it also includes:
[0015] If a status query command for a terminal device is received, the second active time of the terminal device is obtained from the remote dictionary service database;
[0016] Determine the time difference between the second active time and the current time;
[0017] Determine the lifecycle of the terminal device; wherein the lifecycle is greater than the heartbeat time of the terminal device;
[0018] The time difference is compared with the life cycle to obtain the comparison result;
[0019] Based on the comparison results, the device status of the terminal device is determined and output.
[0020] In one embodiment, obtaining the second active time of the terminal device from the remote dictionary service database includes:
[0021] Determine the device unique identifier ID and the reporting link ID of the terminal device;
[0022] Based on the device ID and reporting link ID of the terminal device, the second active time of the terminal device is obtained from the remote dictionary service database.
[0023] In one embodiment, determining the device status of the terminal device based on the comparison result includes any one of the following:
[0024] If the comparison result is that the time difference is greater than the life cycle, then the device status of the terminal device is determined to be offline.
[0025] If the comparison result indicates that the time difference is less than or equal to the lifecycle, then the device status of the terminal device is determined to be online.
[0026] Secondly, embodiments of this application provide a device information management apparatus, comprising:
[0027] The receiving module is used to receive messages sent by the terminal device;
[0028] The first update module is configured to update the active time of the terminal device in the application memory based on the reception time of the message if the message type is a first message type, thereby obtaining a first active time; wherein, the first message type is any message type other than the second message type among all message types; the second message type is a message type indicating that the device is online;
[0029] The second update module is used to compare the first active time with other active times among all active times within the current update interval, and update the second active time of the terminal device in the remote dictionary service database according to the comparison results.
[0030] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the device information management method described in the first aspect.
[0031] Fourthly, embodiments of this application provide a storage medium, which is a computer-readable storage medium including a computer program. When the computer program is executed by a processor, it implements the device information management method described in the first aspect.
[0032] The device information management method, apparatus, electronic device, and storage medium provided in this application embodiment determine the type of the message after receiving it from a terminal device. When the message type is a first message type indicating that the device is not online, the active time of the terminal device in the application memory is updated based on the message reception time to obtain a first active time. Furthermore, the first active time is compared with other active times among all active times within the current update interval, and the second active time of the terminal device in the remote dictionary service database is updated according to the comparison results. This avoids updating the information about the terminal device status in the remote dictionary service database every time device information reported by the terminal device is received, thus avoiding resource waste in the Netty-Redis cluster and improving the data processing efficiency of the Netty-Redis cluster. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a flowchart illustrating the device information management method provided in an embodiment of this application;
[0035] Figure 2 This is a schematic diagram of the functional modules of an embodiment of the device information management device of this application;
[0036] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0038] The device information management method, apparatus, electronic device, and storage medium provided in this application will be described in detail below with reference to embodiments. These embodiments are for illustrative purposes only and should not be construed as limiting the scope of this application.
[0039] In the description of the embodiments of this application, it should be noted that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application. In addition, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0040] In the description of the embodiments of this application, it should be noted that, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms in the embodiments of this application based on the specific circumstances.
[0041] In the embodiments of this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "on top of," and "over" the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.
[0042] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the embodiments of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0043] Figure 1 This is a flowchart illustrating the device information management method provided in an embodiment of this application. (Refer to...) Figure 1 This application provides a device information management method, which may include:
[0044] Step 100: Receive the message sent by the terminal device;
[0045] It should be noted that the execution subject of the device information management method provided in this application embodiment can be a server or computer device, such as a mobile phone, tablet computer, laptop computer, handheld computer, vehicle electronic device, wearable device, ultra-mobile personal computer (UMPC), netbook or personal digital assistant (PDA), etc.
[0046] The terminal devices mentioned in this application may include, but are not limited to, claw machines, rocking cars, smart vending machines, massage chairs, etc.
[0047] It should be noted that in this application, each terminal device can access the Internet of Things by accessing Software as a Service (SAAS) through a communication box, thereby realizing network management.
[0048] After being connected to the Internet of Things (IoT), each terminal device can report information to the connected server periodically or irregularly by sending messages.
[0049] The message types in this application may include at least a first message type and a second message type. The first message type refers to any message type other than the second message type. The specific message content of the first message type is not limited.
[0050] The second message type is the message type that indicates the device is online, such as login message A1, key information message AL, etc.
[0051] Therefore, the server can receive messages sent by the terminal device, determine the type of the received message, and identify whether the message is of the first message type or the second message type.
[0052] The content of this application message may include online information, key information, basic information, startup result, heartbeat, semaphore, etc.
[0053] Step 200: If the message type is the first message type, then based on the message reception time, update the active time of the terminal device in the application memory to obtain the first active time;
[0054] If the message type is determined to be the first message type, it means that the message was not sent when the terminal device came online. Therefore, the active time of the terminal device in the application memory is updated only based on the message reception time. Specifically, the message reception time can be used as the new active time of the terminal device in the application memory, and the new active time of the terminal device in the application memory is called the first active time.
[0055] It should be noted that this application can update the active time in application memory simultaneously, and also associate the updated active time with the device's unique identifier (ID) and the reporting link ID at the time of reporting. The device ID can be, for example, equipment$UniqueCode, and the reporting link ID can be, for example, channelId.
[0056] It should be noted that the application memory refers to the memory on the server.
[0057] Step 300: Compare the first active time with other active times among all active times within the current update interval, and update the second active time of the terminal device in the remote dictionary service database according to the comparison results.
[0058] After obtaining the first active time, it can be determined whether the current time is the update time. If so, all active times of the terminal device within the current update interval are obtained, and the first active time is compared with other active times among all active times within the current update interval to obtain the comparison result.
[0059] One method is to determine whether the current time is an update time by checking whether the interval between the previous update time and the current time reaches the preset update interval. If it does, the current time is determined to be an update time; otherwise, it is determined not to be an update time.
[0060] It should be noted that in this application, a preset update interval can be determined based on the lifecycle of the terminal device (also known as the keep-alive time). Therefore, the server can obtain the preset update interval. The lifecycle of the terminal device is longer than its heartbeat time.
[0061] In some embodiments, the preset update interval is less than half the lifespan of the terminal device.
[0062] For example, if the lifecycle of a terminal device is 90 seconds, then the preset update interval is less than 45 seconds.
[0063] It should be noted that the heartbeat intervals of different terminal devices may be the same or different. The heartbeat interval of a terminal device refers to the time during which the terminal device periodically sends a message to the server to inform the server that it is still online.
[0064] It should be noted that the first update time can be the online time of the terminal device, or it can be a pre-set time to start updating the active time of all or a specified portion of the terminal devices.
[0065] After obtaining the comparison results, the second active time of the terminal device in the remote dictionary service database can be updated based on whether the first active time in the comparison results is the last active time among all active times within the current update interval.
[0066] Among them, the second active time of the terminal device in the remote dictionary service database represents the last active time of the terminal device in the remote dictionary service database.
[0067] Among them, the remote dictionary service database is a distributed database that can perform distributed caching of data.
[0068] Understandably, application memory offers faster read speeds compared to Redis databases, but its data structure diversity and concurrency capabilities are inferior. Application memory is private, while Redis may be shared by multiple projects (or servers). If other services require the online status of devices, it's clearly impractical to allow them to directly read application memory. By exposing Redis, the status data can be securely and efficiently queried and utilized by multiple services.
[0069] It should be noted that after receiving the message sent by the terminal device, the following is also included:
[0070] Step 400: If the message type is the second message type, then based on the message reception time, update the active time of the terminal device in the application memory and the second active time of the terminal device in the remote dictionary service database respectively.
[0071] If the message type is determined to be the second message type, it means that the terminal device is online. In this case, it is necessary to update the active time of the terminal device in the application memory and the second active time of the terminal device in the remote dictionary service database.
[0072] That is, based on the message reception time, update the active time of the terminal device in the application memory and the second active time of the terminal device in the remote dictionary service database.
[0073] Specifically, the message reception time can be used as the new active time of the terminal device in the application memory, and the message reception time can be updated to the second active time of the terminal device in the remote dictionary service database.
[0074] In some embodiments, this application may update the device status of the terminal device while updating the active time. The device status can be determined based on the difference between the last active time and the current time. If the difference between the last active time and the current time is greater than the lifecycle, the device is determined to be offline; otherwise, it is determined to be online.
[0075] It should be noted that this application can update the active time in the Redis database simultaneously with the updated active time, along with the device ID of the terminal device and the reporting link ID at the time of reporting. This application can also set an online flag for updates to messages of the second message type; the specific form and content of the online flag are not limited.
[0076] The device information management method provided in this application determines the type of the message after receiving it from the terminal device. When the message type is a first message type indicating that the device is not online, the active time of the terminal device in the application memory is updated based on the message reception time to obtain a first active time. The first active time is further compared with other active times among all active times within the current update interval, and the second active time of the terminal device in the remote dictionary service database is updated according to the comparison results. This avoids updating the information about the terminal device status in the remote dictionary service database every time device information reported by the terminal device is received, thus avoiding resource waste in the Netty-Redis cluster and improving the data processing efficiency of the Netty-Redis cluster.
[0077] After implementing the above device information management method, the Redis-setex usage of the Netty-Redis cluster can be reduced by 30%.
[0078] It should be noted that Netty is an open-source Java framework provided by JBoss.
[0079] In one embodiment, updating the second active time of the terminal device in the remote dictionary service database based on the comparison result includes:
[0080] Step 301: If the comparison result shows that the first active time is the last active time among all active times within the current update interval, then update the first active time to the second active time of the terminal device in the remote dictionary service database.
[0081] After obtaining the comparison results, if it is determined that the first active time is the last active time among all active times within the current update interval, then the first active time will be updated to the second active time of the terminal device in the remote dictionary service database.
[0082] It should be noted that updating the second active time of terminal devices in the remote dictionary service database based on the comparison results also includes:
[0083] Step 302: If the comparison result shows that the first active time is not the last active time among all active times within the current update interval, then update the last active time among all active times within the current update interval to the second active time of the terminal device in the remote dictionary service database.
[0084] If the comparison result is determined to be that the first active time is not the last active time among all active times within the current update interval, then the last active time in the application memory within the current update interval is determined, and the last active time in the application memory within the current update interval is updated to the second active time of the terminal device in the remote dictionary service database.
[0085] This embodiment can update the first active time to the second active time of the terminal device in the remote dictionary service database based on the comparison results between the first active time and other active times in the current update interval, or update the last active time in the current update interval to the second active time of the terminal device in the remote dictionary service database. This avoids updating the information about the terminal device status in the remote dictionary service database every time device information reported by the terminal device is received, thus avoiding the waste of Netty-Redis cluster resources and improving the data processing efficiency of Netty-Redis cluster.
[0086] In some embodiments, the device information management method further includes:
[0087] Step 501: If a status query instruction for the terminal device is received, the second active time of the terminal device is obtained from the remote dictionary service database.
[0088] In this application, a user can initiate a status query command for a terminal device on the server to instruct a status query for a specified terminal device. The status query command may include the terminal device's device ID, or it may include both the terminal device's device ID and the reporting link ID.
[0089] Therefore, the server can obtain the device ID of the terminal device, or the device ID of the terminal device and the reporting link ID, from the received status query command.
[0090] After obtaining the device ID of the terminal device, this application can query the second active time of the corresponding terminal device (i.e., the last active time of the terminal device) from the remote dictionary service database based on the device ID of the terminal device.
[0091] It should be noted that if the terminal device loses connection, it may reconnect to another server (the system is usually configured with a load balancer, so it may connect to server A this time and server B the next time).
[0092] When a terminal device experiences a disconnection and reconnection, the remote dictionary service database may contain multiple different second active times for the same terminal device. The device IDs associated with the different second active times are the same, but the reported link IDs are different.
[0093] Generally, once a terminal device connects to a node on a server, its upload and download speeds are relatively stable. However, if network problems occur or the server node switches, frequent disconnections and reconnections may occur.
[0094] Step 502: Determine the time difference between the second active time and the current time;
[0095] In this application, the second active time can be compared with the current time to determine the time difference between the second active time and the current time.
[0096] Specifically, the difference between the current time and the second active time can be calculated to obtain the time difference between the second active time and the current time.
[0097] Step 503: Determine the lifecycle of the terminal device;
[0098] Among them, the lifespan is longer than the heartbeat time of the terminal device;
[0099] In this application, a time value greater than the heartbeat time of the terminal device can be determined as the lifecycle of the terminal device.
[0100] Step 504: Compare the time difference with the lifecycle to obtain the comparison result;
[0101] Furthermore, the time difference is compared with the life cycle to obtain a comparison result where the time difference is greater than the life cycle; or, a comparison result where the time difference is less than or equal to the life cycle.
[0102] Step 505: Based on the comparison results, determine and output the device status of the terminal device.
[0103] After obtaining the comparison results, the device status of the terminal device can be determined as offline or online based on the comparison results, and the determined device status can be output, for example, by displaying it on a monitor.
[0104] It should be noted that if the same terminal device is simultaneously in an offline and online state, the online state of the terminal device will be output.
[0105] It should be further noted that this application periodically cleans up offline records (i.e., device status) in the remote dictionary service database.
[0106] In some embodiments, the device status of the terminal device is determined based on the comparison results, including any one of the following:
[0107] Step 5051: If the comparison result is that the time difference is greater than the life cycle, then the device status of the terminal device is determined to be offline.
[0108] In this application, if the comparison result shows that the time difference is greater than the lifecycle, it means that the time difference between the last active time of the terminal device and the current time has exceeded the keep-alive time, and the device status of the terminal device is determined to be offline.
[0109] Step 5052: If the comparison result shows that the time difference is less than or equal to the lifecycle, then the device status of the terminal device is determined to be online.
[0110] In this application, if the comparison result shows that the time difference is less than or equal to the lifecycle, it means that the time difference between the last active time of the terminal device and the current time is still within the keep-alive time, and the device status of the terminal device is determined to be online.
[0111] In some embodiments, obtaining the second active time of the terminal device from a remote dictionary service database includes:
[0112] Step 5011: Determine the device ID and reporting link ID of the terminal device;
[0113] In this application, the device ID and reporting link ID of the terminal device contained in the status query command can be obtained by parsing the status query command.
[0114] Step 5012: Obtain the second active time of the terminal device from the remote dictionary service database based on the device ID and reporting link ID of the terminal device.
[0115] After obtaining the device ID and reporting link ID of the terminal device, the device ID and reporting link ID of the terminal device can be used as search keywords to index the remote dictionary service database and obtain the second active time of the terminal device in the remote dictionary service database.
[0116] This embodiment can accurately determine and output the device status of the terminal device by obtaining the second active time of the terminal device from the remote dictionary service database.
[0117] In some embodiments, after a terminal device connects to the server, it immediately performs KeepAlive (i.e., updates and resets the Redis database) in addition to going online (A1, AL messages). A1 = Login message, AL = Key information message.
[0118] Other instructions will wait on the server. Within time T1, only the last reported time will be marked (in the application memory). Finally, KeepAlive will be performed again (where the remaining time = 90 seconds + (the time of the last reported instruction of the waiting time - the current time)). If the remaining time is less than or equal to 0, the terminal device is determined to be offline.
[0119] T1 is generally less than the time to live (TTL) / 2 = 45 seconds. This is mainly due to margin issues. For example, if a device reports within the first 45-second period, does not report in the second 45-second period, and then reports in the third period, the device is essentially reporting after a full TTL interval. This can cause actually active devices to be treated as offline. Therefore, T1 needs to be set to a value less than TTL / 2 to avoid the above problem.
[0120] In some embodiments, the following steps are involved:
[0121] S1. The device sends a message to the server.
[0122] S2. The server determines whether the message is an A1 or AL message; A1 = login message, AL = key information message;
[0123] If so, update the last active time of the device in the application's memory and update the device online flag in Redis;
[0124] If not, only update the last active time in the application's memory; the data format during the tagging process is:
[0125] Key = equipment$UniqueCode(Device ID), Value = channelId(Reporting Link ID), last login time, and whether online.
[0126] The last login time and online status are actually correlated. Online status can be calculated using the last login time. At least one of these two parameters is stored in Redis. Data is recorded in memory using a similar format.
[0127] S3. At a certain time interval T1, such as 45s in the example above, update the device online flag in Redis according to the last active time in the application memory. If the last active time in the application memory is less than the TTL, maintain the device online flag; if the last active time in the application memory is more than the TTL, mark the device as offline.
[0128] Furthermore, this application also provides an equipment information management device.
[0129] Reference Figure 2 , Figure 2 This is a schematic diagram of the functional modules of an embodiment of the device information management device of this application.
[0130] The device information management unit includes:
[0131] The receiving module 210 is used to receive messages sent by the terminal device;
[0132] The first update module 220 is used to update the active time of the terminal device in the application memory based on the reception time of the message if the message type is a first message type, thereby obtaining a first active time; wherein, the first message type is a message type other than the second message type among all message types; the second message type is a message type indicating that the device is online;
[0133] The second update module 230 is used to compare the first active time with other active times among all active times within the current update interval, and update the second active time of the terminal device in the remote dictionary service database according to the comparison results.
[0134] The device information management apparatus provided in this application embodiment determines the type of the message after receiving it from the terminal device. When the message type is a first message type indicating that the device is not online, it updates the active time of the terminal device in the application memory based on the message reception time to obtain a first active time. Furthermore, it compares the first active time with other active times among all active times within the current update interval, and updates the second active time of the terminal device in the remote dictionary service database according to the comparison results. This avoids updating the information about the terminal device status in the remote dictionary service database every time device information reported by the terminal device is received, thus avoiding the waste of Netty-Redis cluster resources and improving the data processing efficiency of Netty-Redis cluster.
[0135] In one embodiment, the receiving module 210 is further configured to:
[0136] If a status query command for a terminal device is received, the second active time of the terminal device is obtained from the remote dictionary service database;
[0137] Determine the time difference between the second active time and the current time;
[0138] Determine the lifecycle of the terminal device; wherein the lifecycle is greater than the heartbeat time of the terminal device;
[0139] The time difference is compared with the life cycle to obtain the comparison result;
[0140] Based on the comparison results, the device status of the terminal device is determined and output.
[0141] In one embodiment, the receiving module 210 further includes an acquisition unit, the acquisition unit being used for:
[0142] Determine the device unique identifier ID and the reporting link ID of the terminal device;
[0143] Based on the device ID and reporting link ID of the terminal device, the second active time of the terminal device is obtained from the remote dictionary service database.
[0144] In one embodiment, the receiving module 210 further includes a determining unit, the determining unit being configured to perform any of the following:
[0145] If the comparison result is that the time difference is greater than the life cycle, then the device status of the terminal device is determined to be offline.
[0146] If the comparison result indicates that the time difference is less than or equal to the lifecycle, then the device status of the terminal device is determined to be online.
[0147] In one embodiment, the receiving module 210 is further configured to:
[0148] If the message type is the second message type, then based on the message reception time, the active time of the terminal device in the application memory and the second active time of the terminal device in the remote dictionary service database are updated respectively.
[0149] In one embodiment, the second update module 230 is specifically used for:
[0150] If the comparison result shows that the first active time is the last active time among all active times within the current update interval, then the first active time will be updated to the second active time of the terminal device in the remote dictionary service database.
[0151] In one embodiment, the second update module 230 is further configured to:
[0152] If the comparison result shows that the first active time is not the last active time among all active times within the current update interval, then the last active time among all active times within the current update interval will be updated to the second active time of the terminal device in the remote dictionary service database.
[0153] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call a computer program stored in the memory 330 to execute the steps of a device information management method, such as including:
[0154] Receive messages sent by terminal devices;
[0155] If the message type is the first message type, then based on the message reception time, the active time of the terminal device in the application memory is updated to obtain the first active time; wherein, the first message type is any message type other than the second message type among all message types; the second message type is a message type indicating that the device is online;
[0156] The first active time is compared with other active times among all active times within the current update interval, and the second active time of the terminal device in the remote dictionary service database is updated according to the comparison results.
[0157] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0158] On the other hand, embodiments of this application also provide a storage medium, which is a computer-readable storage medium storing a computer program. The computer program is used to cause a processor to execute the steps of the methods provided in the above embodiments, including, for example:
[0159] Receive messages sent by terminal devices;
[0160] If the message type is the first message type, then based on the message reception time, the active time of the terminal device in the application memory is updated to obtain the first active time; wherein, the first message type is any message type other than the second message type among all message types; the second message type is a message type indicating that the device is online;
[0161] The first active time is compared with other active times among all active times within the current update interval, and the second active time of the terminal device in the remote dictionary service database is updated according to the comparison results.
[0162] The computer-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic storage (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical storage (e.g., CD, DVD, BD, HVD), and semiconductor storage (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).
[0163] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0164] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. An apparatus information management method characterized by comprising: The method comprises the following steps: receiving a message sent by a terminal device; if the type of the message is a first message type, updating the active time of the terminal device in an application memory based on the receiving time of the message to obtain a first active time; wherein the first message type is a message type other than a second message type among all message types; the second message type is a message type indicating that the device is online; comparing the first active time with other active times in all active times within a current update interval time, and updating the second active time of the terminal device in a remote dictionary service database according to the comparison result.
2. The device information management method according to Claim 1, wherein The method of updating the second active time of the terminal device in the remote dictionary service database according to the comparison result comprises the following steps: if the comparison result is that the first active time is the last active time among all active times within the current update interval time, updating the first active time as the second active time of the terminal device in the remote dictionary service database.
3. The device information management method according to Claim 2, characterized by, The method of updating the second active time of the terminal device in the remote dictionary service database according to the comparison result further comprises the following steps: if the comparison result is that the first active time is not the last active time among all active times within the current update interval time, updating the last active time among all active times within the current update interval time as the second active time of the terminal device in the remote dictionary service database.
4. The device information management method according to Claim 1, wherein After receiving the message sent by the terminal device, the method further comprises the following steps: if the type of the message is the second message type, updating the active time of the terminal device in the application memory and the second active time of the terminal device in the remote dictionary service database based on the receiving time of the message, respectively.
5. The device information management method according to Claim 1, wherein The method further comprises the following steps: if a state query instruction of the terminal device is received, obtaining the second active time of the terminal device from the remote dictionary service database; determining the time difference between the second active time and the current time; determining the life cycle of the terminal device; wherein the life cycle is greater than the heartbeat time of the terminal device; comparing the time difference with the life cycle to obtain a comparison result; determining and outputting the device state of the terminal device according to the comparison result.
6. The device information management method according to Claim 5, wherein The method of obtaining the second active time of the terminal device from the remote dictionary service database comprises the following steps: determining the device unique identifier (ID) of the terminal device and the reporting link ID; obtaining the second active time of the terminal device from the remote dictionary service database according to the device ID and the reporting link ID of the terminal device.
7. The device information management method according to Claim 5, wherein Determining the device state of the terminal device according to the comparison result comprises any of the following steps: if the comparison result is that the time difference is greater than the life cycle, determining that the device state of the terminal device is an offline state; if the comparison result is that the time difference is less than or equal to the life cycle, determining that the device state of the terminal device is an online state.
8. An apparatus information management device characterized by comprising: The method comprises the following steps: a receiving module configured to receive a message sent by a terminal device; The first updating module is configured to, if the type of the message is a first message type, update the active time of the terminal device in the application memory based on the receiving time of the message to obtain a first active time, wherein the first message type is a message type other than a second message type among all message types, and the second message type is a message type indicating that a device is online. The second updating module is configured to compare the first active time with other active times in all active times within a current updating interval time respectively, and update a second active time of the terminal device in a remote dictionary service database according to a comparison result.
9. An electronic device comprising a processor and a memory having a computer program stored therein, characterized in that, The computer program is executed by the processor to implement the device information management method in any one of claims 1 to 7.
10. A storage medium, which is a computer-readable storage medium, comprising a computer program, characterized in that, The computer program is executed by the processor to implement the device information management method in any one of claims 1 to 7.
Citation Information
Patent Citations
Internet of things data transmission method and system
CN111970346A
Wireless connection method and electronic device
WO2022237493A1