Segmented control execution software implementation method, system, device and storage medium based on linked list database
By introducing segmented control execution software based on linked list database into the device control system, the problem that traditional device control methods cannot achieve complex control actions is solved, and more flexible and efficient equipment control is achieved.
Patent Information
- Application Number
- CN202411844531.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-16
AI Technical Summary
Traditional equipment control methods have single functions and cannot realize complex actions such as delay control, pause control, cancel control and conditional execution of equipment.
The segmented control execution software method based on linked list database is adopted, and dynamic updates of peripheral status and timing loop reading are realized through the communication module, protocol analysis module, message execution module and linked list database module, and complex controls such as delay, pause, and conditional execution are supported.
It improves the flexibility of device control, can respond to user input control instructions faster and better, reduces the malfunction of error messages on the control device, and reduces the hardware resource requirements.
Smart Images

Figure CN119293060B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software control, and in particular to a segmented control execution software implementation method, system, device and storage medium based on a linked list database. Background Art
[0002] The control of external devices usually involves users selecting or inputting information through display and touch devices, and then sending the information to the control board through the interface. The control board executes the control instructions issued by the user and performs dynamic control on the corresponding peripherals.
[0003] For the control of external devices, the control software usually receives instructions, parses instructions, executes instructions, controls devices, returns instructions, and executes in serial order.
[0004] Traditional device control methods have a single function and require immediate return after control. They are unable to achieve delayed control, pause control, cancel control, conditional execution and other actions of the device. Summary of the invention
[0005] The purpose of the present invention is to address the traditional equipment control method, which has a single function and requires immediate return after control, and is unable to achieve delayed control of the equipment, pause control, cancel control, conditional execution and other actions. To address this shortcoming, a segmented control execution software implementation method, system, device and storage medium based on a linked list database are proposed.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] The segmented control execution software implementation method based on the linked list database includes the following steps:
[0008] S1, the communication module receives the message and sends the message to the protocol analysis module;
[0009] S2, the protocol parsing module parses the message and sends the parsed message to the message execution module;
[0010] S3, the message execution module updates the linked list database according to the parsed message content and reads the status of related peripherals at the same time;
[0011] S4, after the message execution module reads the status of the relevant peripherals, it replies a message to the communication module;
[0012] S5. At the same time, according to the updated linked list database, the peripheral status is read in a regular loop.
[0013] As a further preferred embodiment of the present invention, the protocol parsing module parses the message, including:
[0014] S21, the protocol parsing module determines whether the received message is composed of several sub-messages according to the protocol;
[0015] S22. If the received message consists of several sub-messages, split the received message into several sub-messages, and verify the sub-messages one by one;
[0016] S23, read the first byte and the fourth byte in the format of the sub-message, and determine whether they are 0x68; if not, discard the sub-message;
[0017] S24, if yes, read the second byte and the third byte in the format;
[0018] S25, determining whether the second byte and the third byte are equal, if not, discarding the sub-message;
[0019] S26, if they are equal, read the last byte of the sub-message according to the sub-message length represented by the second and third bytes, and determine whether it is 0x16;
[0020] S27, if yes, calculate according to the data in the format to obtain a check code, and determine whether the check code is equal to the second to last byte in the format. If not, discard the sub-message;
[0021] S28. If yes, the sub-message is complete and is sent;
[0022] S29. If the received message is a single message, jump to S23.
[0023] As a further preferred embodiment of the present invention, the updating of the linked list database includes:
[0024] Add, delete or modify linked list database entries for the execution of the relevant peripherals according to the message content, wherein the linked list database entries include configuration information, execution information and execution condition information of the peripherals;
[0025] When a new message comes in, the original information in the linked list database is compared. If the new message is an unexecuted entry in the current linked list database, it will not be added or modified;
[0026] If the new message is an entry that has been executed, a new entry is added to the linked list database;
[0027] If the new message is a newly added entry, a new entry is added to the linked list database.
[0028] As a further preferred embodiment of the present invention, the timing loop reads the peripheral status, including:
[0029] S51, read each entry in the linked list database in sequence;
[0030] S52, determining whether the entry is to be executed with delay;
[0031] S53, if the entry is not delayed for execution, determining whether the entry needs to meet the execution condition;
[0032] S54, if the entry does not need to meet the execution condition, the linked list database calls the control module to execute the control action, deletes the node corresponding to the entry, and reads the next entry;
[0033] S55, determining whether all entries in the linked list database have been read; if all entries have been read, waiting for the traversal delay to end, and then performing a new round of traversal of the linked list database;
[0034] S56, if the entry in the linked list database has not been read completely, read the next entry and jump to S52;
[0035] S57, if the entry needs to meet the execution condition, read the peripheral status corresponding to the execution condition;
[0036] S58, judging whether the state of the peripheral device satisfies the execution condition, if so, the linked list database calls the control module to execute the control action, reads the next entry, and jumps to S55;
[0037] S59, if the state of the peripheral device does not meet the execution condition, read the next entry and jump to S55;
[0038] S510, if the entry is delayed, determine whether the entry is paused, if so, read the next entry and jump to S52;
[0039] S511, if not paused, determine whether the delay time has been reached;
[0040] S512: If the delay time is reached, jump to S53;
[0041] S513: If the delay time has not been reached, the delay time is reduced by one operation cycle time, the next entry is read, and S52 is jumped.
[0042] The segmented control execution software realization system based on the linked list database includes a communication module, a protocol analysis module, an instruction execution module, a linked list database module, a device control module and a timing operation module;
[0043] The communication module includes an underlying driver for realizing the reception and transmission of data and sending messages to the protocol analysis module;
[0044] The protocol parsing module is used to parse the received message and send the parsed message to the instruction execution module;
[0045] The instruction execution module is used to read the parsed message and perform action control and status reading according to different message contents;
[0046] The linked list database module is used to store updated data content;
[0047] The device control module is used to drive specific hardware devices and control peripherals;
[0048] The timing operation module is used to traverse the linked list database at a regular time, read multiple peripheral states, and control the device control module to perform different actions based on different conditions.
[0049] As a further preferred embodiment of the present invention, the parsing of received messages includes discarding messages that do not conform to the agreement and separating multiple messages that are stuck together; the messages that conform to the agreement include inconsistent beginning and end, inconsistent length and verification errors.
[0050] The segmented control execution software is implemented based on a linked list database. The device includes one or more processors and a memory, and the memory is used to store one or more programs. When the one or more programs are executed by the processor, the processor is enabled to implement the segmented control execution software implementation method based on the linked list database.
[0051] A computer storage medium stores at least one program instruction, and the at least one program instruction is used to be loaded and executed by a processor to implement a segmented control execution software implementation method based on a linked list database.
[0052] Compared with the prior art, the segmented control execution software implementation method, system, device and storage medium proposed in the present invention have the following beneficial effects:
[0053] 1. The present invention is applicable to a variety of scenarios, with dynamic database storage, small space occupation, and flexibility and convenience;
[0054] 2. The present invention adopts the method of separating instructions from control, and the device control uses a linked table database to perform addition, deletion, modification and query, which improves the flexibility of device control and can respond to the control instructions input by the user faster and better;
[0055] 3. By setting up the protocol analysis module, error messages can be eliminated to the maximum extent, reducing the malfunction of the control device caused by error messages, and at the same time reducing the number of message retransmissions to improve communication efficiency;
[0056] 4. The instruction execution module does not directly control the operation of the device, but only writes the control content into the linked table database. It is suitable for scenarios where the control device needs to be executed according to other peripherals or device conditions, and the control device needs to delay execution, pause execution, or stop execution;
[0057] 5. By setting the linked list database for dynamic storage, it takes up less space, is flexible and convenient, has low requirements for hardware resources, and is very user-friendly in resource-constrained scenarios. At the same time, the linked list database runs in a millisecond-level timing cycle and has a fast response speed. It uses formatted storage, has strong scalability, and is easy to transplant;
[0058] 6. The device control module adopts a command and control separation mode. The device control uses a linked list database to add, delete, modify and query, which improves the flexibility of device control and can respond to user input control commands faster and better. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a schematic diagram of the process of the present invention;
[0060] Figure 2 It is a schematic diagram of the traversal cycle flow of the present invention. DETAILED DESCRIPTION
[0061] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] The segmented control execution software implementation method, system, device and storage medium based on the linked list database proposed in the present invention are suitable for continuous communication with the host computer, and the control equipment needs conditional execution, delayed execution, suspended execution or stopped execution. The database is dynamically stored, takes up less space, and is flexible and convenient. It includes a communication module that interacts with the host computer, a protocol parsing module, an instruction execution module, an automatic operation module, a linked list database module, and a device control module. The method of separating instructions from control and using a linked list database for device control to add, delete, modify and query is adopted, which improves the flexibility of device control and can respond to control instructions input by users faster and better.
[0063] Embodiment 1: A method for implementing segmented control execution software based on a linked list database comprises the following steps:
[0064] S1. The communication module receives the message and sends it to the protocol parsing module.
[0065] S2. The protocol parsing module parses the message and sends the parsed message to the message execution module.
[0066] The protocol parsing module parses the message, including:
[0067] S21. The protocol parsing module determines whether the received message consists of several sub-messages according to the protocol.
[0068] S22. If the received message consists of several sub-messages, split the received message into several sub-messages, and verify the sub-messages one by one.
[0069] S23. Read the first byte and the fourth byte in the format of the sub-message and determine whether they are 0x68; if not 0x68, discard the sub-message.
[0070] S24. If yes, read the second byte and the third byte in the format.
[0071] S25. Determine whether the second byte is equal to the third byte. If not, discard the sub-message.
[0072] S26. If they are equal, read the last byte of the sub-message according to the sub-message length represented by the second and third bytes, and determine whether it is 0x16.
[0073] S27. If yes, calculate according to the data in the format to obtain a check code, and determine whether the check code is equal to the second to last byte in the format. If not, discard the sub-message.
[0074] S28. If yes, the sub-message is complete and is sent.
[0075] S29. If the received message is a single message, jump to S23.
[0076] The message is transmitted according to the protocol, the format is 0x68 len len 0x68 data[N] cs 0x16, N<=249, with fixed section beginning and end. In one frame of message, the first byte and the fourth byte are fixed to 0x68, the second byte and the third byte are required to be completely equal, representing the length len of the received message, the second to last byte is the lowest byte cs after the accumulation of all the previous bytes, and the last byte is the frame tail of 0x16. After receiving the message, sometimes several frames of messages are put together, and sometimes not enough for a frame of message. The received message needs to be put into a buffer array, and then accessed byte by byte to determine whether the first and fourth bytes are equal and 0x68. If so, determine whether the second and third bytes represent the same frame length. If it continues to find the end byte based on the length to determine whether it is 0x16, if it is, extract a frame of data with a length of len, calculate the addition of all the previous data until the second to last byte, take the lowest byte of the result, and see if it is equal to the second to last byte received. If it is, it is considered that the frame data is complete and there is no error. If there is an error, discard these data until the next frame of correct data begins 0x68 len len 0x68. After traversing the buffer array, there may be one or more frames of correct data, which need to be processed separately in the next step, or there may not be enough data for one frame, which needs to be stored and pieced together with the next received data before the above steps are performed.
[0077] S3. The message execution module updates the linked list database according to the parsed message content and reads the status of related peripherals at the same time.
[0078] The updating of the linked list database includes:
[0079] Add, delete or modify linked list database entries for the execution of the relevant peripherals according to the message content, wherein the linked list database entries include configuration information, execution information and execution condition information of the peripherals;
[0080] When a new message comes in, the original information in the linked list database is compared. If the new message is an unexecuted entry in the current linked list database, it will not be added or modified;
[0081] If the new message is an entry that has been executed, a new entry is added to the linked list database;
[0082] If the new message is a newly added entry, a new entry is added to the linked list database.
[0083] S4. After the message execution module reads the status of the relevant peripherals, it replies with a message to the communication module.
[0084] S5. At the same time, according to the updated linked list database, the peripheral status is read in a regular loop.
[0085] The timing loop reads the peripheral status, including:
[0086] S51. Read each entry in the linked list database in sequence.
[0087] S52: Determine whether the entry is to be executed with delay.
[0088] S53: If the entry is not executed with a delay, determine whether the entry needs to meet the execution condition.
[0089] S54, if the entry does not need to meet the execution condition, the linked list database calls the control module to perform the control action, that is, to execute the control, control the specific device, delete the node corresponding to the entry, and read the next entry.
[0090] S55, determining whether all entries in the linked list database have been read; if all entries have been read, waiting for the traversal delay to end, and then performing a new round of traversal of the linked list database.
[0091] S56: If the entries in the linked list database have not been read completely, read the next entry and jump to S52.
[0092] S57: If the entry needs to meet an execution condition, read the peripheral status corresponding to the execution condition.
[0093] S58, judging whether the state of the peripheral device satisfies the execution condition, if so, the linked list database calls the control module to execute the control action, reads the next entry, and jumps to S55.
[0094] S59: If the state of the peripheral device does not satisfy the execution condition, read the next entry and jump to S55.
[0095] S510: If the entry is delayed in execution, determine whether the entry is paused. If so, read the next entry and jump to S52.
[0096] S511: If not paused, determine whether the delay time has been reached.
[0097] S512: If the delay time is reached, jump to S53.
[0098] S513: If the delay time has not been reached, the delay time is reduced by one operation cycle time, the next entry is read, and S52 is jumped.
[0099] Embodiment 2: A segmented control execution software implementation system based on a linked list database includes a communication module, a protocol parsing module, an instruction execution module, a linked list database module, a device control module and a timing operation module;
[0100] The communication module includes an underlying driver for realizing the reception and transmission of data and sending messages to the protocol analysis module;
[0101] The protocol parsing module is used to parse the received messages and send the parsed messages to the instruction execution module; the parsing of the received messages includes discarding messages that do not comply with the agreement and separating multiple messages that are stuck together; the messages that comply with the agreement include messages that do not match the beginning and the end, do not match the length, and have verification errors.
[0102] The instruction execution module is used to read the parsed message and perform action control and status reading according to different message contents;
[0103] The linked list database module is used to store updated data content;
[0104] The device control module is used to drive specific hardware devices and control peripherals;
[0105] The timing operation module is used to traverse the linked list database at a regular time, read multiple peripheral states, and control the device control module to perform different actions based on different conditions.
[0106] Embodiment 3: Segmented control execution software implementation based on linked list database, the device includes one or more processors and a memory, the memory is used to store one or more programs; when the one or more programs are executed by the processor, the processor is enabled to implement the segmented control execution software implementation method based on the linked list database.
[0107] Embodiment 4: A computer storage medium stores at least one program instruction, and the at least one program instruction is used to be loaded and executed by a processor to implement a segmented control execution software implementation method based on a linked list database.
[0108] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any form, and any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.
Claims
1. A segmented control execution software implementation method based on a linked list database, characterized in that: The following steps are involved: S1, the communication module receives the message and sends the message to the protocol analysis module; S2, the protocol parsing module parses the message and sends the parsed message to the message execution module; S3, the message execution module updates the linked list database according to the parsed message content and reads the status of related peripherals at the same time; S4, after the message execution module reads the status of the relevant peripherals, it replies a message to the communication module; S5. At the same time, according to the updated linked list database, the peripheral status is read in a timed loop; S51, read each entry in the linked list database in sequence; S52, determining whether the entry is to be executed with delay; S53, if the entry is not delayed for execution, determining whether the entry needs to meet the execution condition; S54, if the entry does not need to meet the execution condition, the linked list database calls the control module to execute the control action, deletes the node corresponding to the entry, and reads the next entry; S55, determining whether all entries in the linked list database have been read; if all entries have been read, waiting for the traversal delay to end, and then performing a new round of traversal of the linked list database; S56, if the entry in the linked list database has not been read completely, read the next entry and jump to S52; S57, if the entry needs to meet the execution condition, read the peripheral status corresponding to the execution condition; S58, judging whether the state of the peripheral device satisfies the execution condition, if so, the linked list database calls the control module to execute the control action, reads the next entry, and jumps to S55; S59, if the state of the peripheral device does not meet the execution condition, read the next entry and jump to S55; S510, if the entry is delayed, determine whether the entry is paused, if so, read the next entry and jump to S52; S511, if not paused, determine whether the delay time has been reached; S512: If the delay time is reached, jump to S53; S513: If the delay time has not been reached, the delay time is reduced by one operation cycle time, the next entry is read, and S52 is jumped.
2. The method for implementing segmented control execution software based on linked list database according to claim 1, characterized in that: The protocol parsing module parses the message, including: S21, the protocol parsing module determines whether the received message is composed of several sub-messages according to the protocol; S22. If the received message consists of several sub-messages, split the received message into several sub-messages, and verify the sub-messages one by one; S23, read the first byte and the fourth byte in the format of the sub-message, and determine whether they are 0x68; if not, discard the sub-message; S24, if yes, read the second byte and the third byte in the format; S25, determining whether the second byte and the third byte are equal, if not, discarding the sub-message; S26, if they are equal, read the last byte of the sub-message according to the sub-message length represented by the second and third bytes, and determine whether it is 0x16; S27, if yes, calculate according to the data in the format to obtain a check code, and determine whether the check code is equal to the second to last byte in the format. If not, discard the sub-message; S28. If yes, the sub-message is complete and is sent; S29. If the received message is a single message, jump to S23.
3. The method for implementing segmented control execution software based on linked list database according to claim 1, characterized in that: The updating of the linked list database includes: Add, delete or modify linked list database entries for the execution of the relevant peripherals according to the message content, wherein the linked list database entries include configuration information, execution information and execution condition information of the peripherals; When a new message comes in, the original information in the linked list database is compared. If the new message is an unexecuted entry in the current linked list database, it will not be added or modified; If the new message is an entry that has been executed, a new entry is added to the linked list database; If the new message is a newly added entry, a new entry is added to the linked list database.
4. A segmented control execution software implementation system based on a linked list database, used to implement the segmented control execution software implementation method based on a linked list database according to any one of claims 1 to 3, characterized in that: It includes a communication module, a protocol analysis module, an instruction execution module, a linked list database module, a device control module and a timing operation module; The communication module includes an underlying driver for realizing the reception and transmission of data and sending messages to the protocol analysis module; The protocol parsing module is used to parse the received message and send the parsed message to the instruction execution module; The instruction execution module is used to read the parsed message and perform action control and status reading according to different message contents; The linked list database module is used to store updated data content; The device control module is used to drive specific hardware devices and control peripherals; The timing operation module is used to traverse the linked list database at a regular time, read multiple peripheral states, and control the device control module to perform different actions based on different conditions.
5. The segmented control execution software implementation system based on linked list database according to claim 4 is characterized in that: The parsing of received messages includes discarding messages that do not conform to the agreement and separating multiple messages that are glued together; the messages that conform to the agreement include messages that do not conform to the beginning and the end, do not conform to the length, and have verification errors.
6. A segmented control execution software device based on a linked list database, characterized in that: The device includes one or more processors and a memory, wherein the memory is used to store one or more programs; when the one or more programs are executed by the processor, the processor is enabled to implement the segmented control execution software implementation method based on a linked list database as described in any one of claims 1-3.
7. A computer storage medium, characterized in that: The computer storage medium stores at least one program instruction, and the at least one program instruction is used to be loaded and executed by the processor to implement the segmented control execution software implementation method based on the linked list database as described in any one of claims 1-3.
Citation Information
Patent Citations
Terminal equipment remote software version distribution method and system
CN105763369A
Sensor message data processing method, electronic equipment and storage medium
CN114553978A