CN113141603B - Data communication method, system, master terminal device and slave terminal device - Google Patents

Data communication method, system, master terminal device and slave terminal device Download PDF

Info

Publication number
CN113141603B
CN113141603B CN202110382170.0A CN202110382170A CN113141603B CN 113141603 B CN113141603 B CN 113141603B CN 202110382170 A CN202110382170 A CN 202110382170A CN 113141603 B CN113141603 B CN 113141603B
Authority
CN
China
Prior art keywords
communication
terminal equipment
instruction
slave
slave terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110382170.0A
Other languages
Chinese (zh)
Other versions
CN113141603A (en
Inventor
肖仁杰
庄严
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Minew Technologies Co ltd
Original Assignee
Shenzhen Minew Technologies Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Minew Technologies Co ltd filed Critical Shenzhen Minew Technologies Co ltd
Priority to CN202110382170.0A priority Critical patent/CN113141603B/en
Publication of CN113141603A publication Critical patent/CN113141603A/en
Application granted granted Critical
Publication of CN113141603B publication Critical patent/CN113141603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application is applicable to the technical field of Bluetooth communication application, and provides a data communication method, a system, a master terminal device and a slave terminal device, wherein the method comprises the following steps: establishing a communication connection with a slave device; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for instructing the slave terminal equipment to execute operation tasks corresponding to the instructions; if the instruction contains the preset processing identifier, before the communication connection is disconnected, receiving state information fed back by the slave terminal equipment after the operation task is completed according to the preset processing identifier. According to the method and the device, the problem that in the multi-instruction communication process, the master terminal device and the slave terminal device occupy more time to cause low communication efficiency because of the need of establishing a plurality of connections can be solved, the communication time is greatly saved, and the communication efficiency is improved.

Description

Data communication method, system, master terminal device and slave terminal device
Technical Field
The application belongs to the technical field of Bluetooth communication application, and particularly relates to a data communication method, a data communication system, master terminal equipment and slave terminal equipment.
Background
The electronic price tag is also called as an electronic shelf tag (Electronic Shelf Label, ESL), is an electronic display device with an information receiving and transmitting function, and is mainly applied to electronic tags for displaying commodity information in supermarkets, convenience stores, pharmacies and the like. The electronic shelf label is generally placed on a shelf to replace the traditional electronic display device of the paper price label, each electronic shelf label is in wired or wireless communication with a database at a server end through gateway equipment, and the latest commodity information is displayed through a screen on the electronic shelf label.
At present, the bluetooth gateway is used as a master terminal device for communication, the electronic price tag is used as a slave terminal device for communication, when the master terminal device sends different instructions to the slave terminal device, the master terminal device needs to establish a communication connection with the slave terminal device every time when issuing the instructions, then the communication connection is disconnected, and the next instruction is sent to reestablish the communication connection. Therefore, the establishment of multiple connections in the communication process takes more time, and the communication efficiency is reduced.
Disclosure of Invention
The embodiment of the application provides a data communication method, a data communication system, a master terminal device and a slave terminal device, which can solve the problem that in the process of multi-instruction communication, the master terminal device and the slave terminal device need to establish a plurality of connections and occupy more time to cause communication efficiency.
In a first aspect, an embodiment of the present application provides a data communication method, applied to a master device, where the method includes:
establishing a communication connection with a slave device; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for indicating the slave terminal equipment to identify a preset processing identifier and execute an operation task corresponding to the instructions; and if the instruction comprises the preset processing identifier, before the communication connection is disconnected, receiving state information fed back after the slave terminal equipment completes the operation task.
In a possible implementation manner of the first aspect, the communication packet includes a communication header field and a communication data field, the communication data field including a plurality of the instructions; the sending a communication packet to the slave device includes:
and sending a communication header field and a communication data field to the slave terminal equipment, wherein the communication header field is used for indicating the slave terminal equipment to judge whether the communication packet is the last communication packet or not.
In a possible implementation manner of the first aspect, the method further includes:
and after the last communication packet is sent, and the slave terminal equipment recognizes all instructions and sends out a response, disconnecting the communication connection with the slave terminal equipment.
In a second aspect, an embodiment of the present application provides a data communication method, applied to a slave device, where the method includes:
establishing communication connection with a main terminal device; receiving a communication packet sent by the main terminal equipment, and identifying preset processing identifiers of a plurality of instructions in the communication packet; if the instruction contains the preset processing identifier, before the communication connection is disconnected, executing an operation task corresponding to the instruction and feeding back state information to the main terminal equipment after the operation task is completed.
In a possible implementation manner of the second aspect, the communication packet includes a communication header field and a communication data field, and the communication data field includes a plurality of the instructions; the method further comprises the steps of:
receiving a communication header field and a communication data field sent by the master terminal device; judging whether the communication packet is the last communication packet according to the communication header field; analyzing the instruction in the communication data field, and judging whether the instruction contains the preset processing identifier or not.
In a possible implementation manner of the second aspect, the method further includes:
after receiving the last communication packet, respectively analyzing a plurality of instructions in each communication packet; if the instruction does not contain the preset processing identifier, storing the instruction; and after the communication connection with the main terminal equipment is disconnected, executing the operation task corresponding to the instruction which does not contain the preset processing identifier.
In a third aspect, embodiments of the present application provide a data communication system, the system including:
the master terminal equipment is used for establishing communication connection with the slave terminal equipment and sending a communication packet to the slave terminal equipment;
The slave end equipment is used for establishing communication connection with the master end equipment, receiving a communication packet sent by the master end equipment, executing an operation task corresponding to the instruction before the communication connection is disconnected if the instruction contains a preset processing identifier, and feeding back state information to the master end equipment after the operation task is completed.
In a fourth aspect, embodiments of the present application provide a master device, where the master device includes a wireless transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, where the wireless transceiver is configured to communicate data with a slave device, and where the processor implements the method when executing the computer program.
In a fifth aspect, embodiments of the present application provide a slave device comprising a wireless transceiver for data communication with a master device, a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the method when executing the computer program.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program that when executed by a processor implements the method.
In a seventh aspect, embodiments of the present application provide a computer program product, which, when run on a terminal device, causes the terminal device to perform the method of any one of the first or second aspects above.
It will be appreciated that the advantages of the second to seventh aspects may be found in the relevant description of the first aspect, and are not described here again.
Compared with the prior art, the embodiment of the application has the beneficial effects that: through the embodiment of the application, the master terminal equipment and the slave terminal equipment are in communication connection; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for instructing the slave terminal equipment to execute operation tasks corresponding to the instructions; if the instruction comprises a preset processing identifier, before the communication connection is disconnected, receiving state information fed back by the slave terminal equipment after the operation task is completed according to the preset processing identifier; according to the method and the device for processing the multi-instruction data communication, in the process of the multi-instruction data communication between the master terminal device and the slave terminal device, the slave terminal device analyzes and judges the instruction based on the preset processing identification in the multi-instruction, the slave terminal device can complete the operation task to be executed immediately and feed back in one communication connection, multiple communication connection is not required to be established, time occupied by establishing multiple communication connection is saved, and communication efficiency is improved; has stronger usability and practicability.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required for the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic system architecture diagram of an application scenario provided in an embodiment of the present application;
FIG. 2 is a flow chart of a data communication method according to an embodiment of the present application;
fig. 3 is a schematic flow chart of a data communication method according to another embodiment of the present application;
fig. 4 is a schematic data structure of a communication packet corresponding to a communication protocol according to an embodiment of the present application;
FIG. 5 is an exemplary diagram of an interaction flow provided by an embodiment of the present application;
fig. 6 is a schematic structural diagram of a master device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a slave device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The electronic price tag is a new generation multistable electronic display device which is placed on a shelf, can replace the traditional paper price tag and is provided with a liquid crystal display screen, and the working state of the electronic price tag comprises the operation tasks of establishing connection, data communication, executing drawing brushing, price changing and the like. The electronic price tag is used as slave terminal equipment, multiple times of connection is required to be established with the master terminal equipment, different instructions sent by the master terminal equipment in the established multiple times of connection process are received, and operation tasks corresponding to the different instructions are sequentially executed.
For example, a graph brushing operation task and a lighting operation task are carried out, a gateway is used as a main terminal device to establish Bluetooth connection with an electronic price tag, an instruction for graph brushing is issued to the electronic price tag, then Bluetooth connection with the electronic price tag is disconnected, and the electronic price tag executes the graph brushing operation task; and then the gateway equipment establishes Bluetooth connection with the electronic price tag, gives a lighting instruction to the electronic price tag, and then disconnects the Bluetooth connection with the electronic price tag, and the electronic price tag executes the lighting operation task.
In order to process multiple instructions faster, time required by multiple connection is saved, after the master terminal device establishes communication connection with the slave terminal device, the master terminal device issues multiple instructions, and after the slave terminal device notifies the master terminal device of completion of receiving, the communication connection is disconnected. For example, when the electronic price tag needs to be brushed, lighted and read, the gateway device may establish a bluetooth connection with the electronic price tag, and then issue an instruction to the electronic price tag to brush the graph, light and read the electronic price tag at one time. After the slave device notifies the master device of the completion of reception, the slave device notifies the master device of the completion of reception. The master device disconnects from the slave device, the slave device stores a plurality of instructions, and then the operation tasks of the plurality of instructions are sequentially executed.
However, if some instructions require online processing, such as reading the state of the slave device, then a bluetooth connection needs to be established again and then the slave device reverts to the state of the master device. Thus, some time is still wasted in the data communication process, and the communication efficiency is low.
Referring to fig. 1, a system architecture diagram of an application scenario provided in an embodiment of the present application is shown. The system includes as a master device 11 and a slave device 12, the master device 11 may be a gateway device and the slave device 12 may be an electronic price tag. The master device 11 establishes a communication connection with the slave device, which may be a bluetooth connection. After the primary communication connection is established, the master terminal device sends a communication packet to the slave terminal device according to a data format specified by a preset communication protocol. In a communication connection, the number of the issued communication packets depends on the total number of bytes of data required to be sent to the slave end by the master end and the maximum number of bytes issued each time, which is specified by a communication protocol; the number of bytes of the different instructions may also be different and each communication packet may include a plurality of instructions. So that the master device can issue multiple instructions to the slave device over a single communication connection. The slave terminal device receives the communication packet, can judge whether the communication packet is the last communication packet according to the identifier in the communication packet, analyzes all instructions in all the communication packets after receiving the last communication packet, judges whether the instructions contain preset processing identifiers, executes an operation task corresponding to the instructions and feeds back an execution result to the master terminal device if the instructions contain the preset processing identifiers. After the slave end device analyzes all the instructions and executes all the operation tasks corresponding to the instructions with the preprocessing identifiers, the master end device and the slave end device are disconnected. After the connection is disconnected, the slave terminal equipment executes the received operation task corresponding to the instruction which does not contain the preset processing identifier.
Through the embodiment of the application, in the primary communication connection process, the operation which needs to be executed immediately is completed and the feedback is carried out, so that the time of communication connection is saved, secondary connection is not needed, and the communication efficiency is improved.
The following describes the flow steps of the data communication method provided in the present application through specific embodiments.
Referring to fig. 2, a flow chart of a data communication method according to an embodiment of the present application is shown. The main implementation of the method may be the main end device 11 (gateway device) in fig. 1, including the following steps:
in step S201, the master device establishes a communication connection with the slave device.
In some embodiments, the master device may be a bluetooth gateway device and the slave device may be an electronic price tag device. The master device and the slave device may establish a bluetooth communication connection.
In addition, the master terminal device can also establish communication connection with a plurality of slave terminal devices, namely, the Bluetooth gateway device establishes Bluetooth communication connection with a plurality of electronic price tags, and data communication is carried out through the Bluetooth module.
In step S202, the master device sends a communication packet to the slave device, where the communication packet includes a plurality of instructions, and the instructions are used to instruct the slave device to identify a preset processing identifier and execute an operation task corresponding to the instructions.
In some embodiments, after the master device establishes a communication connection with the slave device, a plurality of instructions are sent to the slave device at once in the form of a communication packet. In a single communication connection, the master device may also send multiple communication packets to the slave device according to the total number of bytes that need to be sent and the maximum number of bytes that can be sent per communication packet. For example, the master device needs to transmit 1000 bytes of data to the slave device, and the number of bytes of the communication packet that can be transmitted at a time is 200, then in one communication connection, the master device can transmit five communication packets to the slave device.
In some embodiments, the communication packet is data in a transmission format conforming to a predetermined communication protocol. The preset communication protocol is a format of transmission data formulated for transmitting a plurality of instructions at one connection. The communication packet may include a plurality of instructions, for example, the number of bytes of the instruction is 50, the number of bytes of the instruction is 80, and the maximum number of bytes of the communication packet may be 200 at a time, so that the content of the plurality of instructions may be included when the communication packet is transmitted at a time.
After the master device sends the last data packet to the slave device, the slave device starts to analyze each instruction in the received communication packet in turn, and identifies whether the instruction contains a preset processing identifier. The preset processing identifier may be an online processing identifier indicating that the slave device performs an operation task in the current communication connection state, for example, a corresponding number is set in a specific data bit in an instruction of the communication packet, which is used to indicate that the current instruction needs online processing, or other identifiers may be reserved. Each instruction corresponds to an operation task, and the master terminal device instructs the slave terminal device to execute the operation task corresponding to the instruction by sending the instruction to the slave terminal device. For example, the bluetooth gateway device sends a command for brushing the image, a command for lighting the lamp, a command for reading the state of the electronic price tag, and the like to the electronic price tag, and the electronic price tag is taken as a slave end, so that the operation tasks of brushing the image, lighting the lamp and reading the current running state of the electronic price tag are executed.
In addition, for different instructions, based on whether the instructions contain preset processing identifiers, the slave terminal equipment determines whether to execute the operation task corresponding to the instructions in the current connection state or execute the operation task of the instructions after the current connection is disconnected.
In some embodiments, the master device sends a communication packet to the slave device, comprising:
the master device sends a communication header field and a communication data field to the slave device, where the communication header field is used to instruct the slave device to determine whether the communication packet is the last communication packet.
In some embodiments, the communication packet includes a communication header field and a communication data field, the communication data field including a plurality of instructions.
As shown in fig. 4, a data structure diagram of a communication packet corresponding to a communication protocol according to an embodiment of the present application is shown. The communication packet includes a communication header field and a communication data field; the communication header field comprises a total number of communication packets field and a current packet label field; the communication data field corresponds to the content of the corresponding plurality of instructions. As shown in fig. 4, the instruction includes an instruction header field and an instruction data field, and the instruction header includes an instruction data total length field and a preset process identification field.
The communication header field is of a fixed length, and the slave device can determine whether all issued instructions have been received by checking whether the current packet number of the current communication packet is equal to the total number of the communication packets, and determining whether the received current communication packet is the last data packet. If the communication packet received by the slave terminal device is not the last communication packet, continuing to receive the communication packet sent by the master terminal device; if the slave device receives the last data packet, the slave device starts to parse the data from the first instruction. The instruction header field is also a fixed length, which contains the total length of the instruction data and a preset processing identifier. In the process of analyzing data by the slave terminal equipment, determining the position of each instruction according to the total length of the instruction data, after analyzing the first instruction, finding a second instruction adjacent to the first instruction according to the offset of the total length of the instruction data, and determining whether the current instruction needs online processing according to the preprocessing identification of the instruction header. If the instruction needs to be processed online, the slave device immediately processes the instruction in the current connection state, and an operation task corresponding to the instruction is executed.
It should be noted that, the data format of the communication packet corresponding to the communication protocol provided in fig. 4 is only illustrative and is not limited to the data format of the communication protocol; for example: the communication header may also be marked with a data encryption flag, the total length of the communication data, etc. The length of each field can be set according to the requirement, and the sequence of the total number field of the communication packets in the communication header and the current packet label can be defined from the beginning and the end, and the method is not limited herein; and the order of the total instruction data length field and the preset processing identification field in the instruction header may be defined by convention, and is not particularly limited herein. Because the communication header field and the instruction header field are both of fixed length, in the process of analyzing the instruction by the slave device, the first instruction can be determined according to the fixed length of the communication header field and the instruction header field, and the position of the next instruction can be determined according to the total length field of the instruction data.
In step S203, if the instruction includes the preset processing identifier, the master device receives the status information fed back after the slave device completes the operation task before the communication connection is disconnected.
In some embodiments, after the master device sends the last communication packet to the slave device, the slave device determines that the last communication packet is received according to the total number of communication packets in the communication header field and the current packet label, and then the slave device parses the first command, and determines whether the command needs to be processed in the connection state according to the preset processing identifier of the command. If the instruction comprises an online processing identifier or the preset processing identifier field is a valid bit, the slave terminal equipment immediately executes an operation task corresponding to the instruction and feeds back own state information to the master terminal equipment in the connection state.
The status information may be execution result information of the slave device after executing the operation task, or may be current running information of the slave device itself, etc.
In some embodiments, the data communication method further comprises:
after the master device finishes sending the last communication packet, and the slave device recognizes all the instructions and sends out a response, the master device disconnects the communication connection with the slave device.
In some embodiments, the slave device determines, according to the communication header, that the current communication packet is the last data packet received, and identifies the instruction of the communication packet after completing the receiving task. If the instruction contains a preset processing identifier or data in a preset processing identifier field is valid, the instruction is immediately processed, and an operation task corresponding to the instruction is executed, for example, the instruction is an instruction for reading the state of the slave terminal equipment, the slave terminal equipment immediately acquires the current running information of the slave terminal equipment, and feeds back the current running information to the master terminal equipment based on the current communication connection. If the instruction does not contain the preset processing identifier or the data in the preset processing identifier field is invalid, the slave terminal equipment judges that the current instruction does not need on-line processing and stores the current instruction. After all the instructions are analyzed, all the operation tasks corresponding to the instructions needing on-line processing are executed, and state information of the operation tasks which are executed on-line processing is fed back to the master terminal device in the current connection state, the master terminal device and the slave terminal device are disconnected.
In addition, after the slave terminal equipment and the master terminal equipment are disconnected, the slave terminal equipment processes other instructions which do not contain preset processing identifiers or are invalid in the preset processing identifier field, and corresponding operation tasks are executed. For example, the instruction of drawing and the instruction of lighting are set to be invalid in a field which does not contain a preset processing identifier or a preset processing identifier, and after the communication connection is disconnected, the slave device executes the corresponding drawing operation task and the corresponding lighting operation task.
For example, if operations of drawing, lighting and reading the electronic price tag are required, the gateway device may first establish bluetooth connection with the electronic price tag, and then issue instructions of drawing, lighting and reading the electronic price tag to the electronic price tag at one time, where each instruction has an online processing flag, and after the electronic price tag receives the instructions, the gateway device determines whether to process the instructions online or process the instructions after disconnecting the bluetooth connection according to the online processing flag of each instruction. The instruction for reading the state of the electronic price tag can be online processing, and the other two instructions can be processed after the Bluetooth connection is disconnected. Therefore, when the Bluetooth is connected, the electronic price tag returns the state of the electronic price tag to the gateway, then the Bluetooth is disconnected, and then the instruction of brushing the graph and the instruction of lighting the lamp are sequentially executed.
Through the embodiment of the application, the master terminal equipment and the slave terminal equipment are in communication connection; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for instructing the slave terminal equipment to execute operation tasks corresponding to the instructions; if the instruction comprises a preset processing identifier, before the communication connection is disconnected, receiving state information fed back by the slave terminal equipment after the operation task is completed according to the preset processing identifier; according to the method and the device for processing the multi-instruction data communication, in the process of the multi-instruction data communication between the master terminal device and the slave terminal device, the slave terminal device analyzes and judges the instruction based on the preset processing identification in the multi-instruction, the slave terminal device can complete the operation task required to be executed immediately and feed back in one communication connection, multiple communication connection is not required to be established, and the time occupied by establishing multiple communication connection is saved; the flexibility of processing instructions of the system is improved, and whether the instructions are processed online can be determined according to the requirement of each instruction; the method can also execute the instruction needing on-line processing in time without waiting for feedback information to the main terminal equipment after secondary communication connection, thereby saving time and improving communication efficiency.
Referring to fig. 3, another embodiment of the present application provides a flowchart of a data communication method, where the execution subject of the method may be the slave device 12 (electronic price tag) in fig. 1. Based on the same principle as the embodiment in fig. 2, the method flow comprises the following steps:
in step S301, the slave device establishes a communication connection with the master device.
In step S302, the slave device receives the communication packet sent by the master device, and identifies preset processing identifiers of a plurality of instructions in the communication packet.
Step S303, if the instruction includes a preset processing identifier, before the communication connection is disconnected, the slave device executes an operation task corresponding to the instruction and feeds back status information to the master device after the operation task is completed.
In some embodiments, the data communication method further comprises:
the slave terminal equipment receives the communication header field and the communication data field sent by the master terminal equipment; the slave terminal equipment judges whether the communication packet is the last communication packet according to the communication header field; the slave terminal device analyzes the instruction in the communication data field and judges whether the instruction contains a preset processing identifier.
In some embodiments, the communication packet includes a communication header field and a communication data field, the communication data field including a plurality of the instructions.
In some embodiments, the data communication method further comprises:
after receiving the last communication packet, the slave terminal device respectively analyzes a plurality of instructions in each communication packet; if the instruction does not contain the preset processing identifier, storing the instruction; after the communication connection with the master device is disconnected, the slave device executes an operation task corresponding to an instruction which does not contain a preset processing identifier.
Through the embodiment of the application, the master terminal equipment and the slave terminal equipment are in communication connection; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for instructing the slave terminal equipment to execute operation tasks corresponding to the instructions; if the instruction comprises a preset processing identifier, before the communication connection is disconnected, receiving state information fed back by the slave terminal equipment after the operation task is completed according to the preset processing identifier; according to the method and the device for processing the multi-instruction data communication, in the process of the multi-instruction data communication between the master terminal device and the slave terminal device, the slave terminal device analyzes and judges the instruction based on the preset processing identification in the multi-instruction data communication, the slave terminal device can complete the operation task which needs to be executed immediately in one communication connection and feeds back the operation task, multiple communication connection is not required to be established, time occupied by establishing multiple communication connection is saved, and communication efficiency is improved.
Referring to fig. 5, an exemplary diagram of an interaction flow provided in an embodiment of the present application, corresponding to the system architecture in fig. 1, is presented to introduce a process for implementing the interaction flow of each device in an actual application scenario in the embodiment of the present application. Based on the same implementation principle as in fig. 2 and 3, a detailed description is omitted here. The interactive flow comprises the following steps:
1. the method comprises the steps that communication connection is established between a master terminal device and a slave terminal device;
2. the method comprises the steps that a master terminal device sends a communication packet to a slave terminal device, wherein the communication packet comprises a plurality of instructions;
3. the slave terminal equipment identifies whether the received current communication packet is the last communication packet; if the current communication packet is the last communication packet, analyzing an instruction in the communication packet, and judging whether the instruction contains a preset processing identifier or not; if the instruction does not contain the preset processing identifier, the instruction is stored.
In addition, the slave device sets a variable of the index of the current communication packet (starting from 0, and adding 1 after receiving one communication packet). When receiving a communication packet, the slave terminal device judges whether the label of the received current communication packet is consistent with the variable of the index of the current communication packet; if the error codes are inconsistent, the error codes are returned to the master device immediately, so that the correctness of the transmitted data is ensured.
4. If the instruction contains a preset processing identifier, executing an operation task corresponding to the instruction and feeding back state information to the main terminal equipment;
5. after the slave terminal equipment analyzes all the instructions, the master terminal equipment receives the state information fed back by the operation task corresponding to the instructions containing the preset processing identification, and the master terminal equipment is disconnected with the slave terminal equipment;
6. and the slave terminal equipment executes the operation task corresponding to the instruction which does not contain the preset processing identifier.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic of each process, and should not limit the implementation process of the embodiment of the present application in any way.
Through the embodiment of the application, the master terminal equipment and the slave terminal equipment are in communication connection; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for instructing the slave terminal equipment to execute operation tasks corresponding to the instructions; if the instruction comprises a preset processing identifier, before the communication connection is disconnected, receiving state information fed back by the slave terminal equipment after the operation task is completed according to the preset processing identifier; according to the method and the device for processing the multi-instruction data communication, in the process of the multi-instruction data communication between the master terminal device and the slave terminal device, the slave terminal device analyzes and judges the instruction based on the preset processing identification in the multi-instruction data communication, the slave terminal device can complete the operation task which needs to be executed immediately in one communication connection and feeds back the operation task, multiple communication connection is not required to be established, time occupied by establishing multiple communication connection is saved, and communication efficiency is improved.
Corresponding to the data communication method of the above embodiments, the embodiments of the present application further provide a data communication device, where the device includes:
the first connection unit is used for establishing communication connection with the slave terminal equipment;
the sending unit is used for sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for indicating the slave terminal equipment to identify a preset processing identifier and execute an operation task corresponding to the instructions;
and the first receiving unit is used for receiving the state information fed back after the slave terminal equipment finishes the operation task before the communication connection is disconnected if the instruction comprises the preset processing identifier.
Corresponding to the data communication method described in the other embodiment, an embodiment of the present application further provides a data communication apparatus, including:
the second connection unit is used for establishing communication connection with the main terminal equipment;
the second receiving unit is used for receiving the communication packet sent by the main terminal equipment and identifying preset processing identifiers of a plurality of instructions in the communication packet;
and the data processing unit is used for executing the operation task corresponding to the instruction before the communication connection is disconnected and feeding back the state information to the main terminal equipment after the operation task is completed if the instruction contains the preset processing identifier.
Through the embodiment of the application, the master terminal equipment and the slave terminal equipment are in communication connection; sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for instructing the slave terminal equipment to execute operation tasks corresponding to the instructions; if the instruction comprises a preset processing identifier, before the communication connection is disconnected, receiving state information fed back by the slave terminal equipment after the operation task is completed according to the preset processing identifier; according to the method and the device for processing the multi-instruction data communication, in the process of the multi-instruction data communication between the master terminal device and the slave terminal device, the slave terminal device analyzes and judges the instruction based on the preset processing identification in the multi-instruction, the slave terminal device can complete the operation task required to be executed immediately and feed back in one communication connection, multiple communication connection is not required to be established, and the time occupied by establishing multiple communication connection is saved; the flexibility of processing instructions of the system is improved, and whether the instructions are processed online can be determined according to the requirement of each instruction; the method can also execute the instruction needing on-line processing in time without waiting for feedback information to the main terminal equipment after secondary communication connection, thereby saving time and improving communication efficiency.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
The embodiment of the application also provides a data communication system, which comprises: the master terminal device is used for establishing communication connection with the slave terminal device and sending a communication packet to the slave terminal device, wherein the communication packet comprises a plurality of instructions; the slave terminal equipment is used for establishing communication connection with the master terminal equipment, receiving a communication packet sent by the master terminal equipment, executing an operation task corresponding to the instruction before the communication connection is disconnected if the instruction contains a preset processing identifier, and feeding back state information to the master terminal equipment after the operation task is completed.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps that may implement the various method embodiments described above.
Embodiments of the present application provide a computer program product which, when run on a mobile terminal, causes the mobile terminal to perform steps that may be performed in the various method embodiments described above.
Fig. 6 is a schematic structural diagram of a master device 6 according to an embodiment of the present application. As shown in fig. 6, the master device 6 of this embodiment includes: at least one processor 60 (only one shown in fig. 6), a memory 61 and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, the processor 60 implementing the steps in any of the various data communication method embodiments described above when executing the computer program 62. The master end device 6 further comprises a wireless transceiver 63, wherein the wireless transceiver 63 is adapted to communicate data with the slave end device.
The master device 6 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The master device 6 may include, but is not limited to, a processor 60, a memory 61. It will be appreciated by those skilled in the art that fig. 6 is merely an example of the master device 6 and is not meant to be limiting as to the master device 6, and may include more or fewer components than shown, or may combine certain components, or may include different components, such as input-output devices, network access devices, etc.
The processor 60 may be a central processing unit (Central Processing Unit, CPU), the processor 60 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 61 may in some embodiments be an internal storage unit of the master device 6, such as a hard disk or a memory of the master device 6. The memory 61 may also be an external storage device of the host device 6 in other embodiments, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the host device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the master device 6. The memory 61 is used for storing an operating system, application programs, boot loader (BootLoader), data, other programs, etc., such as program codes of the computer program. The memory 61 may also be used for temporarily storing data that has been output or is to be output.
Fig. 7 is a schematic structural diagram of a slave device 7 according to an embodiment of the present application. As shown in fig. 7, the slave device 7 of this embodiment includes: at least one processor 70 (only one shown in fig. 7), a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, the processor 70 implementing the steps in any of the various data communication method embodiments described above when executing the computer program 72; the slave device 7 further comprises a wireless transceiver 73, wherein the wireless transceiver 73 is adapted to communicate data with the master device.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other manners. For example, the apparatus/device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A method of data communication, applied to a host device, the method comprising:
establishing a communication connection with a slave device; the master terminal equipment is gateway equipment, and the slave terminal equipment is an electronic price tag;
Sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of instructions, and the instructions are used for indicating the slave terminal equipment to identify a preset processing identifier and execute an operation task corresponding to the instructions;
judging whether the instruction contains a preset processing identifier or not; the preset processing identifier is an online processing identifier for indicating the slave terminal equipment to execute an operation task in the current communication connection state;
if the instruction contains the preset processing identifier, before the communication connection is disconnected, the slave terminal device executes an operation task corresponding to the instruction and feeds back an execution result to the master terminal device, and the master terminal device receives state information fed back after the slave terminal device completes the operation task; after the connection is disconnected, the slave terminal equipment executes the received operation task corresponding to the instruction which does not contain the preset processing identifier.
2. The method of claim 1, wherein the communication packet comprises a communication header field and a communication data field, the communication data field comprising a plurality of the instructions;
the sending a communication packet to the slave device includes:
and sending a communication header field and a communication data field to the slave terminal equipment, wherein the communication header field is used for indicating the slave terminal equipment to judge whether the communication packet is the last communication packet or not.
3. The method of claim 1, wherein the method further comprises:
and after the last communication packet is sent, and the slave terminal equipment recognizes all instructions and sends out a response, disconnecting the communication connection with the slave terminal equipment.
4. A method of data communication, for application to a slave device, the method comprising:
establishing communication connection with a main terminal device; the master terminal equipment is gateway equipment, and the slave terminal equipment is an electronic price tag;
receiving a communication packet sent by the main terminal equipment, and identifying preset processing identifiers of a plurality of instructions in the communication packet;
judging whether the instruction contains a preset processing identifier or not; the preset processing identifier is an online processing identifier for indicating the slave terminal equipment to execute an operation task in the current communication connection state;
if the instruction contains the preset processing identifier, before the communication connection is disconnected, the slave terminal device executes an operation task corresponding to the instruction and feeds back state information to the master terminal device after the operation task is completed, and the master terminal device receives the state information fed back by the slave terminal device after the operation task is completed; after the connection is disconnected, the slave terminal equipment executes the received operation task corresponding to the instruction which does not contain the preset processing identifier.
5. The method of claim 4, wherein the communication packet comprises a communication header field and a communication data field, the communication data field comprising a plurality of the instructions; the method further comprises the steps of:
receiving a communication header field and a communication data field sent by the master terminal device;
judging whether the communication packet is the last communication packet according to the communication header field;
analyzing the instruction in the communication data field, and judging whether the instruction contains the preset processing identifier or not.
6. The method of claim 4, wherein the method further comprises:
after receiving the last communication packet, respectively analyzing a plurality of instructions in each communication packet;
if the instruction does not contain the preset processing identifier, storing the instruction;
and after the communication connection with the main terminal equipment is disconnected, executing the operation task corresponding to the instruction which does not contain the preset processing identifier.
7. A data communication system, the system comprising:
the master terminal equipment is used for establishing communication connection with the slave terminal equipment and sending a communication packet to the slave terminal equipment, wherein the communication packet comprises a plurality of communication instructions; the master terminal equipment is gateway equipment, and the slave terminal equipment is an electronic price tag;
The slave terminal equipment is used for establishing communication connection with the master terminal equipment, receiving a communication packet sent by the master terminal equipment and judging whether the instruction contains a preset processing identifier or not; the preset processing identifier is an online processing identifier for indicating the slave terminal equipment to execute an operation task in the current communication connection state; if the instruction comprises a preset processing identifier, before the communication connection is disconnected, the slave terminal device executes an operation task corresponding to the instruction, and after the operation task is completed, state information is fed back to the master terminal device, and the master terminal device receives the state information fed back by the slave terminal device after the operation task is completed; after the connection is disconnected, the slave terminal equipment executes the received operation task corresponding to the instruction which does not contain the preset processing identifier.
8. A master device comprising a wireless transceiver for data communication with a slave device, a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 3 when executing the computer program.
9. A slave device comprising a wireless transceiver for data communication with a master device, a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the method of any one of claims 4 to 6 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the method of any one of claims 1 to 3 or 4 to 6.
CN202110382170.0A 2021-04-09 2021-04-09 Data communication method, system, master terminal device and slave terminal device Active CN113141603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110382170.0A CN113141603B (en) 2021-04-09 2021-04-09 Data communication method, system, master terminal device and slave terminal device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110382170.0A CN113141603B (en) 2021-04-09 2021-04-09 Data communication method, system, master terminal device and slave terminal device

Publications (2)

Publication Number Publication Date
CN113141603A CN113141603A (en) 2021-07-20
CN113141603B true CN113141603B (en) 2023-05-30

Family

ID=76810714

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110382170.0A Active CN113141603B (en) 2021-04-09 2021-04-09 Data communication method, system, master terminal device and slave terminal device

Country Status (1)

Country Link
CN (1) CN113141603B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110139260A (en) * 2019-05-21 2019-08-16 深圳云里物里科技股份有限公司 A kind of data processing method and relevant apparatus of Bluetooth communication
CN110166967A (en) * 2019-05-30 2019-08-23 深圳云里物里科技股份有限公司 A kind of data communications method of electronic shelf label, system and associated component
CN111031521A (en) * 2019-10-21 2020-04-17 北京无线体育俱乐部有限公司 Information display method and system, mobile terminal, server device and electronic device
CN111866838A (en) * 2020-08-07 2020-10-30 上海商米科技集团股份有限公司 Electronic price tag system and communication method thereof

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5842800B2 (en) * 2012-12-20 2016-01-13 カシオ計算機株式会社 Control system, information processing apparatus, terminal apparatus, control method, and control program
US20180184377A1 (en) * 2016-12-23 2018-06-28 Intel Corporation Method for extending wur packet to multiple devices/technologies and enable wur packet aggregation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110139260A (en) * 2019-05-21 2019-08-16 深圳云里物里科技股份有限公司 A kind of data processing method and relevant apparatus of Bluetooth communication
CN110166967A (en) * 2019-05-30 2019-08-23 深圳云里物里科技股份有限公司 A kind of data communications method of electronic shelf label, system and associated component
CN111031521A (en) * 2019-10-21 2020-04-17 北京无线体育俱乐部有限公司 Information display method and system, mobile terminal, server device and electronic device
CN111866838A (en) * 2020-08-07 2020-10-30 上海商米科技集团股份有限公司 Electronic price tag system and communication method thereof

Also Published As

Publication number Publication date
CN113141603A (en) 2021-07-20

Similar Documents

Publication Publication Date Title
CN109766082B (en) Method and device for application program page jump
CN111414374B (en) Block chain transaction concurrent processing method, device and equipment
CN110875850A (en) Firmware upgrading method and system, readable storage medium and terminal equipment
CN115834739B (en) Method for receiving variable-length data frames in SPI (serial peripheral interface) communication of intelligent fusion terminal of transformer area
US20200260277A1 (en) Method for wireless access authentication
CN103959669A (en) Wireless configuration for a computing device
CN112070456B (en) Method for issuing task, terminal equipment, robot and storage medium
CN115134236A (en) Intelligent network card management method, device, equipment and readable medium
CN115905095A (en) USB drive-free communication method, device, electronic equipment and storage medium
EP4095686A2 (en) Method for switching skin of mini-program page, and electronic device
CN108965403B (en) Operation and maintenance monitoring connection establishing method and terminal equipment
CN113141603B (en) Data communication method, system, master terminal device and slave terminal device
CN114745452B (en) Equipment management method and device and electronic equipment
CN116738745A (en) Communication method, device, equipment and medium of electromagnetic transient simulation system
CN112422485A (en) Communication method and device of transmission control protocol
CN116009893A (en) Method, device, equipment and storage medium for upgrading software
CN111126983B (en) Order receiving connection method based on sales terminal, sales terminal and sales equipment
CN110995754B (en) Method, device and equipment for managing data message indexes
CN107632896A (en) A kind of data processing method, data processing equipment and communication apparatus
CN108595245B (en) Java card peripheral access method and Java card virtual machine
CN114648410A (en) Stock staring method, apparatus, system, device and medium
CN109976778B (en) Software updating method and system of vehicle electronic product, upper computer and storage medium
CN114650615B (en) Control method and device of intelligent sales terminal, terminal equipment and storage medium
CN111064728B (en) Method, device and equipment for packing and unpacking data message
CN110995755B (en) Method, device and equipment for configuring data message

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant