CN112235370B - Equipment information synchronization method, synchronization device, main equipment and storage medium - Google Patents

Equipment information synchronization method, synchronization device, main equipment and storage medium Download PDF

Info

Publication number
CN112235370B
CN112235370B CN202011052584.9A CN202011052584A CN112235370B CN 112235370 B CN112235370 B CN 112235370B CN 202011052584 A CN202011052584 A CN 202011052584A CN 112235370 B CN112235370 B CN 112235370B
Authority
CN
China
Prior art keywords
target
slave device
master device
slave
master
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
CN202011052584.9A
Other languages
Chinese (zh)
Other versions
CN112235370A (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.)
Wocao Technology Shenzhen Co ltd
Original Assignee
Wocao Technology Shenzhen 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 Wocao Technology Shenzhen Co ltd filed Critical Wocao Technology Shenzhen Co ltd
Priority to CN202011052584.9A priority Critical patent/CN112235370B/en
Publication of CN112235370A publication Critical patent/CN112235370A/en
Application granted granted Critical
Publication of CN112235370B publication Critical patent/CN112235370B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application is applicable to the technical field of communication, and provides a device information synchronization method, a synchronization device, a main device and a storage medium, wherein the method comprises the following steps: periodically checking the target connection state of the master device and the slave device; if the target connection state is an unconnected state, the master device and the slave device are connected; after establishing a connection with the slave device, the master device transmits a target command to the slave device; and the master equipment receives first target reply information and updates equipment information of the slave equipment according to the first target reply information, wherein the first target reply information is information sent by the slave equipment in response to the target command. The method and the device can solve the problem that the master device and the slave device cannot keep long connection at present, so that the master device cannot acquire information of the slave device quickly.

Description

Equipment information synchronization method, synchronization device, main equipment and storage medium
Technical Field
The application belongs to the field of communication, and particularly relates to a device information synchronization method, a synchronization device, a main device and a storage medium.
Background
Currently, some systems may include multiple devices. At this time, one of the devices is generally set as a master device, and the other devices are set as slave devices. The master device connects with the slave device and then forwards the command to the slave device, thereby controlling the slave device.
However, when the master device is not interacting with the slave device, the master device often interrupts the connection with the slave device. Thus, when the master device needs to acquire the information of the slave device, the master device and the slave device need to be reconnected, and the master device cannot acquire the information of the slave device quickly.
Thus, the master device and the slave device cannot maintain a long connection at present, so that the master device cannot quickly acquire information of the slave device.
Disclosure of Invention
The embodiment of the application provides a device information synchronization method, a synchronization device, a master device and a storage medium, which can solve the problem that the master device and a slave device cannot keep long connection at present, so that the master device cannot acquire the information of the slave device quickly.
In a first aspect, an embodiment of the present application provides a device information synchronization method, including:
periodically checking the target connection state of the master device and the slave device;
if the target connection state is an unconnected state, the master device and the slave device are connected;
after establishing a connection with the slave device, the master device transmits a target command to the slave device;
the master device receives first target reply information, and updates device information of the slave device according to the first target reply information, wherein the first target reply information is information sent by the slave device in response to the target command.
In a second aspect, an embodiment of the present application provides an apparatus information synchronization device, including:
the checking module is used for periodically checking the target connection state of the master device and the slave device;
the connection establishment module is used for establishing connection between the master device and the slave device if the target connection state is an unconnected state;
a transmitting module, configured to transmit a target command to the slave device by the master device after the connection is established with the slave device;
the receiving module is configured to receive, by the master device, first target reply information, and update device information of the slave device according to the first target reply information, where the first target reply information is information sent by the slave device in response to the target command.
In a third aspect, an embodiment of the present application provides a host device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect when the processor executes the computer program.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product, which when run on a host device, causes the host device to perform the device information synchronization method according to any one of the first aspects above.
It will be appreciated that the advantages of the second to fifth 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:
the application provides a device information synchronization method, firstly, periodically checking the target connection state of a master device and a slave device. If the target connection state is the unconnected state, the master device establishes connection with the slave device. After establishing a connection with the slave device, the master device sends a target command to the slave device. And then the master device receives the first target reply information, and updates the device information of the slave device according to the first target reply information, wherein the first target reply information is information sent by the slave device in response to the target command. Since in the present application, the master device can periodically check the target connection state of the master device and the slave device. When the target connection state is the unconnected state, the master device establishes a connection with the slave device, so that a long connection is maintained between the master device and the slave device. Since a long connection is maintained between the master device and the slave device, the target command can be directly transmitted when the master device needs to transmit the target command to the slave device, so that the master device can rapidly synchronize the device information of the slave device.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following description will briefly introduce the drawings that are needed in the embodiments or the description of the prior art, it is 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 flow chart of a device information synchronization method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an apparatus information synchronization device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a master 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 device information synchronization method provided by the embodiment of the application can be applied to host devices such as mobile phones, tablet computers, augmented reality (augmented reality, AR)/Virtual Reality (VR) devices, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA) and the like, and the embodiment of the application does not limit the specific types of the host devices.
In order to illustrate the technical solutions described in the present application, the following description is made by specific examples.
Example 1
In the following, a device information synchronization method provided in a first embodiment of the present application will be described, with reference to fig. 1, where the method includes:
step S101, periodically checking the target connection state of the master device and the slave device.
In step S101, the master device refers to a device that can transmit a command to control the slave device. The slave device refers to a device that receives a command transmitted by the master device and then performs a corresponding operation according to the command transmitted by the master device. It should be noted that the slave device may include at least one. The number of slave devices may be selected by the user according to actual situations, and the present application is not specifically limited herein. It should be understood that the master device and the slave device may or may not be the same type of device. The present application is not specifically limited herein.
When the master device and the slave device are devices of the same type (for example, the master device and the slave device are both a sweeper or a curtain), which device is the master device and which device is the slave device between the two devices are opposite. For example, at time a, device a is set as the master device and device b is set as the slave device. At time B, device a is set as the slave device and device B is set as the master device. When the master device and the slave device are devices of the same type, which device is set as the master device and which device is set as the slave device, the user may select or set according to the actual situation, and the application is not specifically limited herein.
When the user sets one device as a master device and at least one device as a slave device, the master device may periodically check the target connection state between the present master device and the slave device.
Step S102, if the target connection state is the unconnected state, the master device and the slave device are connected.
In step S102, if the target connection state is the unconnected state, the master device establishes a connection with the slave device.
In some embodiments, a master device establishes a connection with a slave device, comprising: the master device sends a connection request to the slave device; and if the second target reply information returned by the slave device is received, judging that the master device and the slave device are successfully connected.
In this embodiment, when the master device needs to establish a connection with the slave device, the master device may send a connection request to the slave device, and then periodically check whether the second target reply message returned by the slave device is received. After receiving the connection request sent by the master device, the slave device sends second target reply information to the master device according to the connection request if the slave device is successfully connected with the master device. And if the master device receives the second target reply information, the master device is successfully connected with the slave device. It should be noted that, the content user of the second target reply message may be set according to the actual situation, which is not specifically limited herein.
In other embodiments, if the second target reply message returned from the device is not received, detecting whether a preset event exists; and if the preset event exists, returning to the execution master equipment to send a connection request to the slave equipment.
Because when the master device does not receive the second target reply message returned by the slave device, the master device and the slave device may be still in the connection process, and the connection between the master device and the slave device may also fail. If the master device does not receive the second target reply message returned by the slave device and the master device and the slave device are still in the connection process, the master device directly resends the connection request to the slave device, which results in more time consumption for the connection between the master device and the slave device.
Therefore, when the master device does not receive the second target reply message returned by the slave device, the master device firstly detects whether a preset event exists, if so, the connection failure between the master device and the slave device is indicated, and at the moment, the master device returns to execute the transmission of the connection request to the slave device. If the preset event does not exist, the master device and the slave device are still in the connection process, and at the moment, the master device returns to execute the periodic check whether the second target reply information returned by the slave device is received.
Therefore, in this embodiment, when the master device does not receive the second target reply message returned by the slave device, it is checked whether a preset event exists, and if the preset event exists, the master device returns to execute the sending of the connection request to the slave device, so that the connection time between the master device and the slave device is reduced.
It should be appreciated that the preset event may include an event that breaks a connection of the master device to the slave device (e.g., some devices establish a connection with the master device, which may result in the master device being disconnected from the slave device), a connection time of the master device to the slave device exceeding a preset time, and so on. The preset event user may be selected or set according to the actual situation, which is not limited herein.
In other embodiments, the master device sends a connection request to the slave device, comprising: obtaining reconnection times; if the reconnection times are smaller than or equal to the preset times, after the first preset time interval, the master device sends a connection request to the slave device, and the reconnection times are increased by 1.
In this embodiment, the number of reconnections is acquired first when a connection request is sent to the slave device. If the reconnection times are smaller than or equal to the preset times, after the first preset time interval, the master device sends a connection request to the slave device again, and the reconnection times are increased by 1.
In other embodiments, the master device performs a predetermined error handling operation if the number of reconnections is greater than the predetermined number.
When the reconnection times are larger than the preset times, the connection between the master device and the slave device is possibly wrong. Therefore, when the number of reconnections is greater than the preset number, the master device performs a preset error handling operation. It should be noted that, the preset error handling operation user may be set according to the actual situation. Such as resetting the host system or initializing connection parameters. The present application is not limited herein.
Step S103, after establishing a connection with the slave device, the master device transmits a target command to the slave device.
In step S103, the master device may transmit a target command to the slave device after establishing a connection with the slave device. It should be noted that, for the manner of sending the target command to the master device, the user may set the manner according to the actual situation. For example, the master device may send a target command to the slave device in the form of a message queue. The present application is not limited herein.
In some embodiments, the master device sending a target command to the slave device, comprising: determining a target difference value according to the timestamp of the current time and a target timestamp, wherein the target timestamp is a timestamp corresponding to the time when the first target reply information is received last time; and if the target difference value is greater than the preset threshold value, the master device sends a target command to the slave device.
In this embodiment, the master device periodically transmits a target command to the slave device. And when the master device receives the first target reply information each time, updating the timestamp corresponding to the received first target reply information. And then determining a target difference value according to the timestamp of the current time and the target timestamp, wherein the target timestamp is the timestamp corresponding to the last time the first target reply message is received. If the target difference value is larger than the preset threshold value, the master device needs to acquire the device information of the slave device at the current time. At this time, the master device transmits a target command to the slave device.
In other embodiments, the master device sends a target command to the slave device, comprising: when the master device receives the trigger signal, a target command is sent to the slave device.
In this embodiment, when the master device receives the trigger signal, the master device transmits a target command to the slave device. It should be noted that, the trigger signal may be sent by the control end to the master device (the control end may be an application program or an applet). Or the user directly operates the main device, and the main device receives the trigger signal. The present application is not limited herein.
Step S104, the master device receives the first target reply information, and updates the device information of the slave device according to the first target reply information, wherein the first target reply information is information sent by the slave device in response to the target command.
After the master device transmits the target command to the slave device, the slave device transmits the first target reply message to the master device according to the target command, and the master device receives the first target reply message in step S104. After receiving the first target reply information sent by the slave device, the master device can update the device information of the slave device stored in the master device according to the first target reply information, so that the master device can synchronize to the current device information of the slave device.
The target command is a command to acquire device information of the slave device. The first target reply message is device information of the slave device. For example, if the target command is a command for acquiring the working state of the slave device, the first target reply message is the current working state information of the slave device. The device information of the slave device includes power information of the slave device, operating state information, sensor data, current location information of the slave device, and the like.
It should be noted that, when the master device does not receive the first target reply message after the second preset time interval, a problem occurs in connection between the master device and the slave device. At this time, the master device returns to perform connection establishment with the slave device.
In other embodiments, when the slave device detects that the device information of the slave device changes, the slave device may also actively send the changed device information to the master device.
In summary, the present application provides a device information synchronization method, first, periodically checking a target connection state of a master device and a slave device. If the target connection state is the unconnected state, the master device establishes connection with the slave device. After establishing a connection with the slave device, the master device sends a target command to the slave device. And then the master device receives the first target reply information, and updates the device information of the slave device according to the first target reply information, wherein the first target reply information is information sent by the slave device in response to the target command. Since in the present application, the master device can periodically check the target connection state of the master device and the slave device. When the target connection state is the unconnected state, the master device establishes a connection with the slave device, so that a long connection is maintained between the master device and the slave device. Since a long connection is maintained between the master device and the slave device, the target command can be directly transmitted when the master device needs to transmit the target command to the slave device, so that the master device can rapidly synchronize the device information of the slave device.
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.
Example two
Fig. 2 shows an example of a device information synchronizing apparatus, and for convenience of explanation, only parts relevant to the embodiments of the present application are shown. The apparatus 200 comprises:
the checking module 201 is configured to periodically check a target connection state of the master device and the slave device.
The connection establishment module 202 is configured to establish a connection between the master device and the slave device if the target connection state is an unconnected state.
A sending module 203, configured to send, by the master device, the target command to the slave device after the connection is established with the slave device.
The receiving module 204 is configured to receive, by the master device, the first target reply message, and update device information of the slave device according to the first target reply message, where the first target reply message is information sent by the slave device in response to the target command.
Optionally, establishing the connection module 202 includes:
and the sending unit is used for sending the connection request to the slave device by the master device.
And the judging unit is used for judging that the connection between the master device and the slave device is successful if the second target reply information returned by the slave device is received.
Optionally, establishing the connection module 202 further includes:
and the detection unit is used for detecting whether a preset event exists if the second target reply message returned by the slave equipment is not received.
And the return execution unit is used for returning and executing the master equipment to send a connection request to the slave equipment if the preset event exists.
Optionally, the transmitting unit includes:
and the frequency acquisition subunit is used for acquiring the reconnection frequency.
Accordingly, the transmitting unit is configured to perform:
if the reconnection times are smaller than or equal to the preset times, after the first preset time interval, the master device sends a connection request to the slave device, and the reconnection times are increased by 1.
Optionally, the transmitting unit further includes:
and the error processing operation subunit is used for executing preset error processing operation by the main equipment if the reconnection times are larger than the preset times.
Optionally, the sending module 203 is configured to perform:
determining a target difference value according to the timestamp of the current time and a target timestamp, wherein the target timestamp is a timestamp corresponding to the time when the first target reply information is received last time;
and if the target difference value is greater than the preset threshold value, the master device sends a target command to the slave device.
Optionally, the sending module 203 is configured to perform:
when the master device receives the trigger signal, a target command is sent to the slave device.
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 embodiment of the method of the present application, specific functions and technical effects thereof may be referred to a part of the embodiment of the method, and will not be described herein again.
Example III
Fig. 3 is a schematic diagram of a master device according to a third embodiment of the present application. As shown in fig. 3, the master device 300 of this embodiment includes: a processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the processor 301. The steps of the various method embodiments described above are implemented when the processor 301 executes the computer program 303. Alternatively, the processor 301 may implement the functions of the modules/units in the above-described embodiments of the apparatus when executing the computer program 303.
Illustratively, the computer program 303 may be divided into one or more modules/units, which are stored in the memory 302 and executed by the processor 301 to complete the present application. The one or more modules/units may be a series of instruction segments of a computer program capable of performing a specific function, the instruction segments describing the execution of the computer program 303 in the host device 300. For example, the computer program 303 may be divided into an inspection module, a connection establishment module, a transmission module, and a reception module, each of which specifically functions as follows:
periodically checking the target connection state of the master device and the slave device;
if the target connection state is an unconnected state, the master device and the slave device are connected;
after establishing a connection with the slave device, the master device transmits a target command to the slave device;
and the master equipment receives first target reply information and updates equipment information of the slave equipment according to the first target reply information, wherein the first target reply information is information sent by the slave equipment in response to the target command.
The host device may include, but is not limited to, a processor 301, a memory 302. It will be appreciated by those skilled in the art that fig. 3 is merely an example of a host device 300 and is not intended to limit the host device 300, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the host device may further include an input-output device, a network access device, a bus, etc.
The processor 301 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware cards, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 302 may be an internal storage unit of the main device 300, for example, a hard disk or a memory of the main device 300. The memory 302 may be an external storage device of the main device 300, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided in the main device 300. Further, the memory 302 may also include both an internal storage unit and an external storage device of the main device 300. The memory 302 is used to store the computer program and other programs and data required by the host device. The memory 302 described above may also be used to temporarily store data that has been output or is to be output.
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.
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/host device and method may be implemented in other manners. For example, the apparatus/host device embodiments described above are merely illustrative, e.g., the division of modules or elements described above is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., multiple elements 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 above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over 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.
In addition, each functional unit in each embodiment of the present application 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. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units described above, 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 each of the above-described method embodiments, or may be implemented by a computer program to instruct related hardware, where the above-described 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 above-described method embodiments. The computer program comprises computer program code, and the computer program code can be in a source code form, an object code form, an executable file or some intermediate form and the like. The computer readable medium may include: any entity or device capable of carrying the computer program code described above, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable medium described above can be appropriately increased or decreased according to the requirements of the jurisdiction's legislation and the patent practice, for example, in some jurisdictions, the computer readable medium does not include electrical carrier signals and telecommunication signals according to the legislation and the patent practice.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; 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 (7)

1. A device information synchronization method, comprising:
periodically checking the target connection state of the master device and the slave device;
if the target connection state is an unconnected state, the master device and the slave device are connected;
after establishing a connection with the slave device, the master device transmits a target command to the slave device;
the master device receives first target reply information, and updates device information of the slave device according to the first target reply information, wherein the first target reply information is information sent by the slave device in response to the target command; when the master device does not receive the first target reply message after the second preset time interval, the master device returns to execute connection with the slave device;
the master device establishes a connection with the slave device comprising:
the master device sends a connection request to the slave device;
if the second target reply information returned by the slave device is received, judging that the master device and the slave device are successfully connected;
if the second target reply message returned by the slave device is not received, detecting whether a preset event exists or not;
if the preset event exists, returning to execute the master device to send a connection request to the slave device;
if the preset event does not exist, the master device returns to execute the periodic check whether the second target reply information returned by the slave device is received;
the master device sending a target command to the slave device, comprising:
determining a target difference value according to a timestamp of the current time and a target timestamp, wherein the target timestamp is a timestamp corresponding to the time when the first target reply information is received last time;
if the target difference value is larger than a preset threshold value, the master device sends a target command to the slave device;
the master device receives changed device information actively sent by the slave device when the slave device detects that the device information of the slave device changes.
2. The device information synchronization method of claim 1, wherein the master device transmitting a connection request to the slave device comprises:
obtaining reconnection times;
if the reconnection times are smaller than or equal to the preset times, after a first preset time interval, the master device sends a connection request to the slave device, and the reconnection times are increased by 1.
3. The device information synchronization method of claim 2, further comprising:
and if the reconnection times are larger than the preset times, the main equipment executes preset error processing operation.
4. The device information synchronization method of claim 1, wherein the master device transmitting a target command to the slave device comprises:
and when the master device receives the trigger signal, sending a target command to the slave device.
5. A device information synchronizing apparatus, comprising:
the checking module is used for periodically checking the target connection state of the master device and the slave device;
the connection establishment module is used for establishing connection between the master equipment and the slave equipment if the target connection state is an unconnected state; the device comprises a sending unit, a judging unit, a detecting unit and a return executing unit, wherein the sending unit is used for sending a connection request to the slave device by the master device, the judging unit is used for judging that the master device is successfully connected with the slave device if second target reply information returned by the slave device is received, the detecting unit is used for detecting whether a preset event exists or not if the second target reply information returned by the slave device is not received, the return executing unit is used for returning to execute the master device to send the connection request to the slave device if the preset event exists, and the master device returns to execute the periodic check whether the second target reply information returned by the slave device is received or not if the preset event does not exist;
a sending module, configured to send a target command to the slave device by the master device after the connection is established with the slave device;
the receiving module is used for receiving first target reply information by the master device, updating device information of the slave device according to the first target reply information, wherein the first target reply information is information sent by the slave device in response to the target command, and when the master device does not receive the first target reply information after a second preset time interval, the master device returns to execute connection with the slave device at the moment;
the sending module is configured to perform:
determining a target difference value according to the timestamp of the current time and a target timestamp, wherein the target timestamp is a timestamp corresponding to the time when the first target reply information is received last time;
if the target difference value is larger than a preset threshold value, the master device sends a target command to the slave device;
the master device receives changed device information actively sent by the slave device when the slave device detects that the device information of the slave device changes.
6. A host device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any of claims 1-4 when executing the computer program.
7. A computer readable storage medium storing a computer program, which when executed by a processor implements the method according to any one of claims 1-4.
CN202011052584.9A 2020-09-29 2020-09-29 Equipment information synchronization method, synchronization device, main equipment and storage medium Active CN112235370B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011052584.9A CN112235370B (en) 2020-09-29 2020-09-29 Equipment information synchronization method, synchronization device, main equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011052584.9A CN112235370B (en) 2020-09-29 2020-09-29 Equipment information synchronization method, synchronization device, main equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112235370A CN112235370A (en) 2021-01-15
CN112235370B true CN112235370B (en) 2023-04-28

Family

ID=74119633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011052584.9A Active CN112235370B (en) 2020-09-29 2020-09-29 Equipment information synchronization method, synchronization device, main equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112235370B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114490454B (en) * 2021-12-29 2023-07-18 广州河东科技有限公司 Method and device for self-adaptive driving of equipment serial port and serial port equipment
CN114422559A (en) * 2021-12-31 2022-04-29 深圳海翼智新科技有限公司 Device control method and device, electronic device and storage medium
CN115190044B (en) * 2022-06-28 2023-08-08 平安银行股份有限公司 Device connection state checking method, device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022451A (en) * 2006-02-14 2007-08-22 杭州华为三康技术有限公司 Connection state synchronizing method in data communication and applied communication node thereof
WO2012147176A1 (en) * 2011-04-27 2012-11-01 富士通株式会社 Program, information processing device, and monitoring method
CN103518418A (en) * 2012-09-27 2014-01-15 华为终端有限公司 Connecting method between Bluetooth devices and device
CN107995051A (en) * 2017-12-29 2018-05-04 国网安徽省电力有限公司 Secondary equipment of intelligent converting station visualized O&M module information interactive system and method
CN110677767A (en) * 2019-10-31 2020-01-10 歌尔科技有限公司 Wireless headset control method and system and TWS headset
CN111193769A (en) * 2019-11-25 2020-05-22 泰康保险集团股份有限公司 Method, system, device, electronic equipment and storage medium for recovering long connection

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022451A (en) * 2006-02-14 2007-08-22 杭州华为三康技术有限公司 Connection state synchronizing method in data communication and applied communication node thereof
WO2012147176A1 (en) * 2011-04-27 2012-11-01 富士通株式会社 Program, information processing device, and monitoring method
CN103518418A (en) * 2012-09-27 2014-01-15 华为终端有限公司 Connecting method between Bluetooth devices and device
CN107995051A (en) * 2017-12-29 2018-05-04 国网安徽省电力有限公司 Secondary equipment of intelligent converting station visualized O&M module information interactive system and method
CN110677767A (en) * 2019-10-31 2020-01-10 歌尔科技有限公司 Wireless headset control method and system and TWS headset
CN111193769A (en) * 2019-11-25 2020-05-22 泰康保险集团股份有限公司 Method, system, device, electronic equipment and storage medium for recovering long connection

Also Published As

Publication number Publication date
CN112235370A (en) 2021-01-15

Similar Documents

Publication Publication Date Title
CN112235370B (en) Equipment information synchronization method, synchronization device, main equipment and storage medium
CN110377570B (en) Node switching method and device, computer equipment and storage medium
CN111314945B (en) Test method, system and terminal equipment
CN111338662A (en) Firmware upgrading method and device for slave station and terminal
CN113852563B (en) Message data transmission method and device, terminal equipment and readable storage medium
CN112996020B (en) Bluetooth-based automatic test method and device and Bluetooth test terminal
CN112070456B (en) Method for issuing task, terminal equipment, robot and storage medium
CN110912805B (en) Message reading state synchronization method, terminal, server and system
CN111736866A (en) One-to-one and one-to-many compatible online upgrading method and terminal equipment
CN112615700B (en) Data sending method, gateway, system, electronic equipment and readable storage medium
CN113660547A (en) Vehicle detection method and device, terminal equipment and readable storage medium
CN117290128A (en) 485 bus-based data transmission method, device, equipment and medium
CN110505609B (en) Bluetooth interaction method, bluetooth interaction device and terminal equipment
CN112068414B (en) Multi-system timing method, device, equipment and medium
CN112187937B (en) Unpairing method and device, terminal equipment and storage medium
EP2876970A1 (en) Communication apparatus
CN110876852B (en) Network game data processing method and system for micro-service
CN112566082B (en) Data transmission method, device, equipment and medium
CN113596123A (en) Software downloading method, communication device and storage medium
CN111813596A (en) Chip restarting method and device and computing equipment
CN117033276B (en) Bus communication method, system, electronic device and storage medium
CN113141603B (en) Data communication method, system, master terminal device and slave terminal device
CN114884768B (en) Detection device, system and detection method for bus idle state
CN117251321A (en) Method, device, terminal equipment and medium for detecting abnormality of USB circuit of main board
CN113708938B (en) Token obtaining method, token obtaining device and terminal equipment

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