Data communication method and device, equipment and storage medium
After the Bluetooth device is started, it enters the host working mode and scans the client broadcast data packets. The client periodically broadcasts data packets as a peripheral device, which solves the problem of slow communication between the existing Bluetooth device and the client and realizes fast connection-free data transmission and The ability of multi-terminal data transmission.
Patent Information
- Application Number
- CN202411011378.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-10-01
AI Technical Summary
Existing Bluetooth devices and clients need to establish point-to-point connections during the communication process, resulting in slow connections and only one-to-one data communication, which cannot meet the fast data transmission needs between multiple clients and Bluetooth devices.
After startup, the Bluetooth device enters the host working mode as a central device, scans and verifies the client broadcast data packets within the preset range, and the client periodically broadcasts data packets as a peripheral device to quickly send data to the Bluetooth device without establishing a connection. data.
Through the combination of host and slave working modes, data can be quickly sent between the client and the Bluetooth device without establishing a Bluetooth connection, which improves communication efficiency and security and supports data transmission between multiple clients and Bluetooth devices.
Smart Images

Figure CN118741433A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a data communication method, device, equipment and storage medium. Background Art
[0002] In the fields of Internet, security and indoor navigation, there are a large number of users who need to send application data to devices with their mobile phones. For example, mobile phones send data to parking lot entrance and exit devices, access control devices, parking lot indoor guidance devices or indoor guidance devices. At present, common ways for user clients to communicate with devices include Bluetooth BLE, NFC, UWB, etc., and Bluetooth is currently the most widely used communication method. All devices have built-in Bluetooth communication modules.
[0003] However, for the client to send application data to the Bluetooth device, a point-to-point Bluetooth communication channel needs to be established. During the connection process, the client, as the central device, needs to go through multiple handshakes (5-RTT) with the Bluetooth device to establish a communication channel. 5-RTT includes broadcasting, scanning, linking, parameter negotiation, and service discovery. The communication connection process is relatively slow. In addition, the client and the Bluetooth device establish a one-to-one Bluetooth communication channel, which means that the Bluetooth device and the client can only conduct one-to-one data communication. Summary of the invention
[0004] Based on this, it is necessary to provide a data communication method, device, equipment and storage medium to solve at least one of the above technical problems.
[0005] The present invention provides a data communication method, which is applied to a Bluetooth device. After the Bluetooth device is started, it enters a host working mode as a central device. The host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range, including:
[0006] Scan and obtain data packets broadcast by any client within the preset range;
[0007] Verifying any of the data packets;
[0008] Wherein, after running the application program, the client enters a slave working mode as a Bluetooth peripheral device, and the slave working mode refers to a mode of periodically broadcasting data packets.
[0009] Optionally, according to a data communication method provided by the present invention, the data packet includes a device identification, a verification code and a timestamp;
[0010] The checking of any of the data packets comprises:
[0011] For any of the above packets:
[0012] Parsing the data packet;
[0013] If the device identification obtained by parsing matches the device identification of the Bluetooth device, the legitimacy of the data packet is verified based on the verification code and the timestamp;
[0014] If the device identification does not match the device identification of the Bluetooth device, the data packet is discarded.
[0015] Optionally, according to a data communication method provided by the present invention, the data packet includes a control code;
[0016] After the data packet is verified for legitimacy based on the verification code and the timestamp, the method further includes:
[0017] If the verification is successful, a control instruction is generated based on the control code to execute a corresponding instruction operation based on the control instruction.
[0018] Optionally, according to a data communication method provided by the present invention, the executing a corresponding instruction operation based on the control instruction includes:
[0019] In the case where there are multiple control instructions, based on each of the control instructions, the corresponding instruction operation is executed in the order of the timestamps in the data packet.
[0020] Optionally, according to a data communication method provided by the present invention, the executing a corresponding instruction operation based on the control instruction includes:
[0021] When there are multiple control instructions, if the sources of the control instructions belong to the same client, the types of the control instructions are the same, and the interval between the timestamps associated with the control instructions is less than the preset time interval, then one control instruction is retained to execute the corresponding instruction operation.
[0022] Optionally, according to a data communication method provided by the present invention, before scanning to obtain a data packet broadcast by any client within a preset range, the method further includes:
[0023] Determine the current state of the Bluetooth module in the Bluetooth device and determine the scanning period;
[0024] If the current state is in the open state, scanning starts according to the scanning cycle.
[0025] The present invention also provides a data communication method, comprising:
[0026] Any client periodically broadcasts and sends data packets, wherein the client enters a slave working mode as a Bluetooth peripheral device after running the application, and the slave working mode refers to a mode of periodically broadcasting data packets;
[0027] The Bluetooth device scans and obtains data packets broadcast by any of the clients within a preset range, and verifies any of the data packets. After startup, the Bluetooth device enters a host working mode as a central device, and the host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range.
[0028] The present invention also provides a data communication device, which is applied to a Bluetooth device. After the Bluetooth device is started, it enters a host working mode as a central device. The host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range, including:
[0029] A scanning module, used to scan and obtain data packets broadcast by any client within a preset range;
[0030] A verification module, used for verifying any of the data packets;
[0031] Wherein, after running the application program, the client enters a slave working mode as a Bluetooth peripheral device, and the slave working mode refers to a mode of periodically broadcasting data packets.
[0032] The present invention also provides a computer device, comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data communication method when executing the computer-readable instructions.
[0033] The present invention also provides one or more readable storage media storing computer-readable instructions, and the computer-readable instructions implement the above data communication method when executed by a processor.
[0034] The above-mentioned data communication method, device, equipment and storage medium include: scanning and obtaining data packets broadcast by any client within a preset range; verifying any of the data packets; wherein the client enters a slave working mode as a Bluetooth peripheral device after running the application, and the slave working mode refers to a mode of periodically broadcasting data packets; the Bluetooth device enters a host working mode as a central device after startup, and the host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range. The present invention allows the client to periodically broadcast and send data packets by allowing the client to enter a slave working mode as a peripheral device after running the application, and the Bluetooth device enters a host working mode of a central device after startup, and can scan and obtain data packets broadcast by each client within a preset range, so that during the communication process, there is no need to establish a Bluetooth connection between the client and the Bluetooth device, and data can be quickly sent to the Bluetooth device. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0036] Figure 1 It is an interaction diagram of existing data communication between a client and a Bluetooth device provided by the present invention;
[0037] Figure 2 It is one of the flowcharts of the data communication method in one embodiment of the present invention;
[0038] Figure 3 It is a timing interaction diagram of communication between multiple clients and Bluetooth devices provided by an embodiment of the present invention;
[0039] Figure 4 This is a second flow chart of a data communication method in one embodiment of the present invention;
[0040] Figure 5 It is a timing interaction diagram of multiple Bluetooth devices communicating with the same client provided by an embodiment of the present invention;
[0041] Figure 6 This is a third flow chart of a data communication method in one embodiment of the present invention;
[0042] Figure 7 is a structural schematic diagram of a data communication device in one embodiment of the present invention;
[0043] Figure 8 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.
[0046] In the fields of Internet, security and indoor navigation, there are a large number of users who need to send application data to devices with their mobile phones. For example, mobile phones send data to parking lot entrance and exit devices, access control devices, parking lot indoor guidance devices or indoor guidance devices. At present, common ways for user clients to communicate with devices include Bluetooth BLE, NFC, UWB, etc., and Bluetooth is currently the most widely used communication method. All devices have built-in Bluetooth communication modules.
[0047] However, the client needs to establish a point-to-point Bluetooth communication channel to send application data to the Bluetooth device. During the connection process, the client, as the central device, needs to go through multiple handshakes (5-RTT) with the Bluetooth device to establish a communication channel, such as Figure 1 As shown, Figure 1 It is an interaction diagram of existing data communication between the client and the Bluetooth device provided by the present invention. Optionally, 5-RTT includes broadcasting, scanning, linking, parameter negotiation, and service discovery. The communication connection process is relatively slow; and a one-to-one Bluetooth communication channel is established between the client and the Bluetooth device, resulting in the Bluetooth device and the client only being able to perform one-to-one data communication.
[0048] In view of the above problems, the present invention provides the following embodiments. In one embodiment, Figure 2 As shown, Figure 2 1 is one of the flow charts of a data communication method in an embodiment of the present invention. The embodiment of the present invention provides a data communication method, which is applied to a Bluetooth device and includes the following steps:
[0049] Step S11, scanning and acquiring a data packet broadcasted by any client within a preset range;
[0050] Step S12, verifying any data packet.
[0051] It should be noted that the client runs a pre-developed app or WeChat applet, etc., to create a Bluetooth peripheral device, where the creation of a Bluetooth peripheral device refers to simulating or controlling the functions of a Bluetooth peripheral device at the software level, rather than actually manufacturing a physical device. For example, initialize the Bluetooth adapter of the applet, obtain permissions and start the Bluetooth function. Create a Bluetooth peripheral device service. Multiple services and features can be defined in the service. Optionally, these services and features define the functions and data supported by the Bluetooth peripheral device. Add custom services and features to the peripheral device service through the method of the service object. After the service and feature definitions are completed, the method of the service object can be called to start broadcasting the existence and supported services of the Bluetooth peripheral device, so that the client enters the slave working mode as a Bluetooth peripheral device after running the application. Optionally, the slave working mode refers to a mode of periodically broadcasting data packets.
[0052] It should be noted that after the Bluetooth device is started, it enters the host working mode of the central device. The host working mode refers to the mode of scanning Bluetooth broadcasts within a preset range. For example: initializing the Bluetooth adapter. This step ensures that the Bluetooth hardware on the device has been started and enabled. The central device needs to start scanning the surrounding peripheral devices. The scanning operation is implemented by calling the scanning function in the Bluetooth API. These functions usually include setting scanning parameters (such as scanning duration, scanning strategy, etc.) and registering scanning callback functions to handle discovered Bluetooth peripheral devices.
[0053] It should be noted that a Bluetooth device refers to a device with a Bluetooth module function, which can be a hardware device in any field. This embodiment takes parking lot hardware equipment as an example: Bluetooth devices can include hardware devices such as access control equipment, gate controllers, charging piles and indoor guidance equipment.
[0054] In one embodiment, after the client enters the slave working mode as a Bluetooth peripheral device after running the application, the client periodically broadcasts and sends data packets. Optionally, the data packets include information such as the device name, service UUID, manufacturer ID, application data between the client and the Bluetooth hardware, and the application data includes timestamp, control code, control data, verification code and other information. In addition, after the Bluetooth device enters the host working mode of the central device after startup, it scans and obtains the data packets broadcast by any client within a preset range. Optionally: the current state of the Bluetooth module in the Bluetooth device is obtained, wherein when the current state of Bluetooth is turned on, it indicates that the Bluetooth module is in normal working condition and scanning and connection operations can be performed. When the current state of Bluetooth is turning on or off, it indicates that the Bluetooth adapter is starting up or shutting down. At this time, you may need to wait for a while before performing subsequent operations. When the current state of Bluetooth is turned off, it indicates that the Bluetooth module is currently unavailable and scanning and connection operations cannot be performed. If the current state of the Bluetooth module is turned on, scanning starts according to the preset scanning cycle. The scanning cycle refers to performing a scanning operation at regular intervals, combined with Figure 3 , Figure 3 It is a timing interaction diagram of communication between multiple clients and Bluetooth devices provided by an embodiment of the present invention. The Bluetooth device can scan and obtain data packets broadcast by any client within a preset range, and perform verification and other processing on any data packet.
[0055] The embodiment of the present invention, through the above scheme, includes: scanning and obtaining data packets broadcast by any client within a preset range; verifying any data packet; wherein, after running the application, the client enters the slave working mode as a Bluetooth peripheral device, and the slave working mode refers to a mode of periodically broadcasting data packets; after the Bluetooth device is started, it enters the host working mode of the central device, and the host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range. It is realized that the client enters the slave working mode as a peripheral device after running the application, so that the client can periodically broadcast and send data packets, and the Bluetooth device enters the host working mode of the central device after starting, and can scan and obtain the data packets broadcast by each client within the preset range, so that during the communication process, there is no need to establish a Bluetooth connection between the client and the Bluetooth device, and data can be quickly sent to the Bluetooth device.
[0056] like Figure 4 As shown, Figure 4 FIG. 2 is a flow chart of a data communication method in an embodiment of the present invention. In an embodiment of the present invention, verifying any data packet includes:
[0057] For any packet:
[0058] Step S21, parsing the data packet;
[0059] Step S22, if the device identification obtained by the analysis matches the device identification of the Bluetooth device, the legitimacy of the data packet is verified based on the verification code and the timestamp;
[0060] Step S23: If the device identification does not match the device identification of the Bluetooth device, the data packet is discarded.
[0061] In one embodiment, the following steps are performed for any data packet: after the Bluetooth device scans and receives the data packet, it parses the data packet, and then parses the obtained device identification and the device identification of the Bluetooth device. It should be noted that since Bluetooth is a wireless broadcast mode, Bluetooth devices in close range will receive data sent by the same client at the same time. Figure 5 , Figure 5 This is a timing interaction diagram of multiple Bluetooth devices communicating with the same client provided by an embodiment of the present invention. The device name in the Bluetooth broadcast data sent by the client is Bluetooth device 1; Bluetooth device 2 receives the Bluetooth broadcast data. If the device identifier does not match the device identifier of the Bluetooth device, that is, the device name in the data packet is Bluetooth device 1, and the data packet is not the data of Bluetooth device 2, then the data packet is discarded. Bluetooth device 1 receives the broadcast data packet. If the device identifier matches the device identifier of the Bluetooth device, that is, the device name of the data packet is Bluetooth device 1, then the data packet is received; thereby, based on the verification code and timestamp in the data packet, the legitimacy of the data packet is further verified, wherein the timestamp can be used as a serial number for the control machine instruction context interaction, and can also be used to prevent illegal devices from intercepting Bluetooth broadcast packets and then replaying attacks through simulated devices. The verification code is used by the Bluetooth device to verify whether the data sent by the client is legitimate.
[0062] The embodiment of the present invention, through the above scheme, includes: parsing the data packet; if the device identification obtained by the parsing matches the device identification of the Bluetooth device, then based on the verification code and the timestamp, the data packet is verified for legitimacy; if the device identification does not match the device identification of the Bluetooth device, the data packet is discarded. It is achieved that multiple Bluetooth devices in close proximity can simultaneously receive data sent by the same client, the device identification in the data packet can be matched with the device identification of the Bluetooth device itself, so as to receive data with matching device identifications, and the data packet is verified for legitimacy in combination with the verification code and the timestamp, thereby improving the security of data communication between the client and the Bluetooth device.
[0063] In one embodiment of the present invention, after the data packet is verified for legitimacy based on the verification code and the timestamp, the method further includes:
[0064] If the verification is successful, a control instruction is generated based on the control code, so as to execute a corresponding instruction operation based on the control instruction.
[0065] It should be noted that the control code represents an identification code for encoding a control instruction, such as opening a door, closing a door, and reading credential information. If the verification is successful, a control instruction is generated based on the control code, so that the Bluetooth device performs the corresponding instruction operation based on the control instruction; for example: if the control instruction is a gate opening command, the gate is controlled to open; if the control instruction is a door access control command, the door access device is controlled to open. Optionally, in the case of multiple control instructions, the corresponding instruction operation is performed based on each control instruction in the order of the timestamps in the data packet. In the case of multiple control instructions, if the source of each control instruction belongs to the same client, the type of each control instruction is the same, and the interval of the timestamps associated with each control instruction is less than the preset time interval, then one control instruction is retained to perform the corresponding instruction operation, effectively preventing the user from repeatedly triggering by mistake, resulting in the Bluetooth device needing to execute the same instruction multiple times.
[0066] The embodiment of the present invention adopts the above scheme, including: if the verification is successful, a control instruction is generated based on the control code, so as to execute the corresponding instruction operation based on the control instruction. It is realized that the client can quickly send data to the Bluetooth device without Bluetooth connection, so that the control instruction is generated according to the sent control code, and the Bluetooth device executes the corresponding instruction operation based on the control instruction, so as to improve the convenience of operation and user experience.
[0067] In one embodiment, if Figure 6 As shown, Figure 6 This is one of the flow charts of a data communication method in an embodiment of the present invention. The embodiment of the present invention also provides a data communication method, comprising the following steps:
[0068] Step S31, any client periodically broadcasts and sends data packets;
[0069] Step S32, the Bluetooth device scans and obtains a data packet broadcasted by any client within a preset range, and verifies any data packet;
[0070] It should be noted that after running the application, the client enters the slave working mode as a Bluetooth peripheral device. The slave working mode refers to the mode of periodically broadcasting data packets, so that the client can periodically broadcast and send data packets. After starting, the Bluetooth device enters the host working mode of the central device. The host working mode refers to the mode of scanning Bluetooth broadcasts within a preset range, so that the Bluetooth device can scan and obtain data packets broadcast by any client within the preset range, and perform verification and other processing on any data packet. The specific verification process is specifically described above and will not be repeated here.
[0071] The embodiment of the present invention realizes that the client enters the slave working mode as a peripheral device after running the application, so that the client can periodically broadcast and send data packets, and the Bluetooth device enters the host working mode of the central device after startup, and can scan and obtain the data packets broadcast by each client within a preset range, so that during the communication process, there is no need to establish a Bluetooth connection between the client and the Bluetooth device, and data can be sent to the Bluetooth device quickly.
[0072] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0073] In one embodiment, a data communication device is provided, which corresponds one-to-one to the data communication method in the above embodiment. Figure 7 As shown, Figure 7 1 is a schematic diagram of a data communication device in an embodiment of the present invention. The data communication device is applied to a Bluetooth device. After startup, the Bluetooth device enters a host working mode as a central device. The host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range, including:
[0074] A scanning module 41 is used to scan and obtain data packets broadcast by any client within a preset range;
[0075] A verification module 42, used to verify any data packet;
[0076] Among them, after running the application, the client enters the slave working mode as a Bluetooth peripheral device. The slave working mode refers to a mode of periodically broadcasting data packets.
[0077] The verification module 42 is also used for:
[0078] For any packet:
[0079] Parse the data packet;
[0080] If the device identification obtained by parsing matches the device identification of the Bluetooth device, the legitimacy of the data packet is verified based on the verification code and timestamp;
[0081] If the device ID does not match the device ID of the Bluetooth device, the data packet is discarded.
[0082] The data communication device also includes:
[0083] The execution module is used to generate a control instruction based on the control code if the verification is successful, so as to execute a corresponding instruction operation based on the control instruction.
[0084] The execution module is also used to:
[0085] In the case where there are multiple control instructions, the corresponding instruction operations are executed based on each control instruction in the order of the timestamps in the data packet.
[0086] The execution module is also used to:
[0087] When there are multiple control instructions, if the sources of the control instructions belong to the same client, the types of the control instructions are the same, and the interval between the timestamps associated with the control instructions is less than the preset time interval, then one control instruction is retained to execute the corresponding instruction operation.
[0088] The data communication device also includes:
[0089] A determination module, used to determine the current state of the Bluetooth module in the Bluetooth device and determine the scanning period;
[0090] The start scanning module is used to start scanning according to the scanning cycle if the current state is in the open state.
[0091] For the specific definition of the data communication device, please refer to the definition of the data communication method above, which will not be repeated here. Each module in the above data communication device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0092] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, Figure 8 : is a schematic diagram of a computer device in one embodiment of the present invention. The computer device includes a processor, a memory, a network interface and a database connected by a device bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The readable storage medium stores an operating device, a computer-readable instruction and a database. The internal memory provides an environment for the operation of the operating device and the computer-readable instructions in the readable storage medium. The database of the computer device is used to store data involved in the data communication method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instruction is executed by the processor, a data communication method is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0093] In one embodiment, a computer device is provided. The computer device may be a terminal device, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, and a network interface connected through a device bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium. The readable storage medium stores computer-readable instructions. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, a data communication method is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0094] In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor implements the steps of the above-mentioned data communication method when executing the computer-readable instructions. The method includes: scanning and obtaining data packets broadcast by any client within a preset range; verifying any data packet; wherein, after running the application, the client enters a slave working mode as a Bluetooth peripheral device, and the slave working mode refers to a mode of periodically broadcasting data packets; after starting, the Bluetooth device enters a host working mode of the central device, and the host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range.
[0095] In one embodiment, a readable storage medium is provided, the readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by the processor to implement the above-mentioned data communication method steps. It can be understood by a person of ordinary skill in the art that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0096] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0097] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A data communication method, characterized in that: The method is applied to a Bluetooth device, and the Bluetooth device enters a host working mode as a central device after startup. The host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range, including: Scan and obtain data packets broadcast by any client within the preset range; Verifying any of the data packets; Wherein, after running the application program, the client enters a slave working mode as a Bluetooth peripheral device, and the slave working mode refers to a mode of periodically broadcasting data packets.
2. The data communication method according to claim 1, characterized in that: The data packet includes a device identification, a verification code and a timestamp; The checking of any of the data packets comprises: For any of the above packets: Parsing the data packet; If the device identification obtained by parsing matches the device identification of the Bluetooth device, the legitimacy of the data packet is verified based on the verification code and the timestamp; If the device identification does not match the device identification of the Bluetooth device, the data packet is discarded.
3. The data communication method according to claim 2, characterized in that: The data packet includes a control code; After the data packet is verified for legitimacy based on the verification code and the timestamp, the method further includes: If the verification is successful, a control instruction is generated based on the control code to execute a corresponding instruction operation based on the control instruction.
4. The data communication method according to claim 3, characterized in that: The executing a corresponding instruction operation based on the control instruction includes: In the case where there are multiple control instructions, based on each of the control instructions, the corresponding instruction operation is executed in the order of the timestamps in the data packet.
5. The data communication method according to claim 3, characterized in that: The executing a corresponding instruction operation based on the control instruction includes: When there are multiple control instructions, if the sources of the control instructions belong to the same client, the types of the control instructions are the same, and the interval between the timestamps associated with the control instructions is less than the preset time interval, then one control instruction is retained to execute the corresponding instruction operation.
6. The data communication method according to claim 1, characterized in that: Before scanning to obtain a data packet broadcast by any client within a preset range, the method further includes: Determine the current state of the Bluetooth module in the Bluetooth device and determine the scanning period; If the current state is in the open state, scanning starts according to the scanning cycle.
7. A data communication method, characterized in that: include: Any client periodically broadcasts and sends data packets, wherein the client enters a slave working mode as a Bluetooth peripheral device after running the application, and the slave working mode refers to a mode of periodically broadcasting data packets; The Bluetooth device scans and obtains data packets broadcast by any of the clients within a preset range, and verifies any of the data packets. After startup, the Bluetooth device enters a host working mode as a central device, and the host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range.
8. A data communication device, characterized in that: The device is applied to a Bluetooth device, and after being started, the Bluetooth device enters a host working mode as a central device. The host working mode refers to a mode of scanning Bluetooth broadcasts within a preset range, including: A scanning module, used to scan and obtain data packets broadcast by any client within a preset range; A verification module, used for verifying any of the data packets; Wherein, after running the application program, the client enters a slave working mode as a Bluetooth peripheral device, and the slave working mode refers to a mode of periodically broadcasting data packets.
9. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executed on the processor, characterized in that: When the processor executes the computer-readable instructions, the data communication method according to any one of claims 1 to 7 is implemented.
10. A readable storage medium having computer readable instructions stored thereon, characterized in that: When the computer-readable instructions are executed by a processor, the data communication method according to any one of claims 1 to 7 is implemented.
