CN116264677A - Data transmission method and device - Google Patents
Data transmission method and device Download PDFInfo
- Publication number
- CN116264677A CN116264677A CN202111515706.8A CN202111515706A CN116264677A CN 116264677 A CN116264677 A CN 116264677A CN 202111515706 A CN202111515706 A CN 202111515706A CN 116264677 A CN116264677 A CN 116264677A
- Authority
- CN
- China
- Prior art keywords
- peripheral equipment
- peripheral
- target
- equipment
- information
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 244
- 230000005540 biological transmission Effects 0.000 title claims abstract description 107
- 230000002093 peripheral effect Effects 0.000 claims abstract description 553
- 230000003993 interaction Effects 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 12
- 238000010295 mobile communication Methods 0.000 abstract description 2
- 238000004891 communication Methods 0.000 description 12
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 4
- 238000012544 monitoring process Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/03—Protecting confidentiality, e.g. by encryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/04—Key management, e.g. using generic bootstrapping architecture [GBA]
- H04W12/043—Key management, e.g. using generic bootstrapping architecture [GBA] using a trusted network node as an anchor
- H04W12/0431—Key distribution or pre-distribution; Key agreement
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W48/00—Access restriction; Network selection; Access point selection
- H04W48/08—Access restriction or access information delivery, e.g. discovery data delivery
- H04W48/10—Access restriction or access information delivery, e.g. discovery data delivery using broadcasted information
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/30—Connection release
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W8/00—Network data management
- H04W8/22—Processing or transfer of terminal data, e.g. status or physical capabilities
- H04W8/24—Transfer of terminal data
Abstract
The invention relates to the technical field of mobile communication and provides a data transmission method and device. The method comprises the following steps: associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method; determining at least one of a target peripheral device and a peripheral information callback method of the target peripheral device from a plurality of peripheral devices according to the received identification information; and carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment. According to the data transmission method and device, the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method are accurately determined in the plurality of peripheral equipment through the identification information of the peripheral equipment, so that accurate data transmission between an application program and the target peripheral equipment is realized, the accuracy of data transmission in a scene of connecting the plurality of peripheral equipment is effectively solved, and good intelligent experience is provided for a user.
Description
Technical Field
The present invention relates to the field of mobile communications technologies, and in particular, to a data transmission method and apparatus.
Background
The low-power consumption Bluetooth communication technology is used as an important means for establishing connection and data communication between the mobile phone and the peripheral equipment, and the process of establishing connection between the equipment supporting the low-power consumption Bluetooth and the mobile phone requires the management of programmers and the interaction of data. In the communication between the mobile phone and the single low-power consumption Bluetooth device, the accuracy of data transmission and the stability of service logic do not need to be considered.
The problem that needs to be solved is how to manage the connection process, state management and data interaction in the scenario that the mobile phone is connected with a plurality of low-power consumption bluetooth devices, so that the corresponding service can be completed more accurately and stably.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art. Therefore, the invention provides a data transmission method, according to the data transmission method of the embodiment of the invention, the identification information of the peripheral equipment is used for accurately determining the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method in a plurality of peripheral equipment, thereby realizing the accurate transmission of data between the application program and the target peripheral equipment, effectively solving the accuracy of data transmission in the scene of connecting the plurality of peripheral equipment and providing good intelligent experience for users.
The invention also provides a data transmission device.
According to an embodiment of the first aspect of the present invention, a data transmission method includes:
associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information, and at least one of peripheral information and callback methods of the target peripheral equipment;
and carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
According to the data transmission method provided by the embodiment of the invention, the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method are accurately determined in the plurality of peripheral equipment through the identification information of the peripheral equipment, so that the accurate transmission of data between an application program and the target peripheral equipment is realized, the accuracy of data transmission in a scene of connecting the plurality of peripheral equipment is effectively solved, and good intelligent experience is provided for a user.
According to one embodiment of the present invention, the data transmission method further includes:
and associating the identification information of the peripheral equipment with an encryption method and a decryption method of the peripheral equipment.
According to the data transmission method provided by the embodiment of the invention, the security of data transmission in a scene of connecting a plurality of peripheral devices can be ensured by associating the identification information of the peripheral devices with the encryption method and the decryption method of the peripheral devices.
According to one embodiment of the present invention, the determining, according to the received identification information, a target peripheral device from a plurality of peripheral devices, and at least one of peripheral information and callback method of the target peripheral device includes:
receiving first data sent by the target peripheral equipment;
determining the identification information of the target peripheral equipment from the first data, and determining a decryption method of the target peripheral equipment and a data interaction callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the decryption method of the target peripheral equipment is used for decrypting the data to be sent in the first data;
the data interaction callback method of the target peripheral equipment is used for sending the decrypted data to be sent to the application program.
According to the data transmission method provided by the embodiment of the invention, the callback method and the decryption method of the target peripheral equipment are determined through the identification information of the peripheral equipment, and the data sent by the target peripheral equipment is sent to the application program according to the decryption method and the callback method, so that the accuracy and the safety of data transmission between the peripheral equipment and the application program are realized.
According to one embodiment of the present invention, the determining, according to the received identification information, a target peripheral device from a plurality of peripheral devices, and at least one of peripheral information and callback method of the target peripheral device includes:
receiving second data sent by the application program;
determining the identification information of the target peripheral equipment from the second data, and determining an encryption method of the target peripheral equipment and peripheral information of the target peripheral equipment according to the identification information of the target peripheral equipment;
the encryption method of the target peripheral equipment is used for encrypting the data to be sent in the second data;
the peripheral information of the target peripheral equipment is used for sending the encrypted data to be sent to the target peripheral equipment.
According to the data transmission method provided by the embodiment of the invention, the peripheral information and the encryption method of the target peripheral equipment are determined through the identification information of the peripheral equipment, and the data sent by the application program is sent to the application program according to the encryption method and the peripheral information, so that the accuracy and the safety of data transmission between the peripheral equipment and the application program are realized.
According to one embodiment of the present invention, the determining, according to the received identification information, a target peripheral device from a plurality of peripheral devices, and at least one of peripheral information and callback method of the target peripheral device includes:
Receiving third data sent by the target peripheral equipment;
determining the identification information of the target peripheral equipment from the third data, and determining a disconnection callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the disconnection callback method of the target peripheral equipment is used for uploading the disconnection information of the target peripheral equipment to the application program.
According to the data transmission method provided by the embodiment of the invention, the connection with the target peripheral equipment is disconnected through the identification information of the peripheral equipment, and after receiving the information of successful disconnection sent by the target peripheral equipment, the disconnection callback method is called to upload the information of disconnection of the target peripheral equipment to the application program, so that the accuracy of data transmission is ensured.
According to one embodiment of the present invention, the determining, according to the received identification information, a target peripheral device from a plurality of peripheral devices, and at least one of peripheral information and callback method of the target peripheral device includes:
receiving fourth data sent by the target peripheral equipment;
determining the identification information of the target peripheral equipment from the fourth data, and determining a state callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
The state callback method of the target peripheral equipment is used for uploading the state information of the target peripheral equipment to the application program.
According to the data transmission method provided by the embodiment of the invention, the state callback method of the peripheral equipment is determined through the identification information of the peripheral equipment, so that the state callback method is called to accurately upload the state of the peripheral equipment to the application program, and the accurate monitoring of the state of the peripheral equipment is realized.
According to one embodiment of the present invention, the associating the identification information of the peripheral device with the peripheral information of the peripheral device and the callback method includes:
forming a key value pair by taking the identification information of the peripheral equipment as a key and the peripheral information of the peripheral equipment and a callback method as a value;
and storing the key value pairs into a preset equipment pool.
According to the data transmission method provided by the embodiment of the invention, the peripheral information of the peripheral equipment and the callback method are used as values to form the key value pair and are stored in the equipment pool, so that the peripheral information and the callback method of the target peripheral equipment can be directly determined in the equipment pool, and the accuracy of data transmission is ensured.
According to one embodiment of the present invention, the identification information of the peripheral device is determined by:
Determining the peripheral equipment through Bluetooth scanning;
and receiving the broadcast packet data sent by the peripheral equipment, and analyzing the broadcast packet data to determine the identification information of the peripheral equipment.
According to the data transmission method provided by the embodiment of the invention, the unique identifier of the peripheral equipment is determined by analyzing the broadcast data sent by the peripheral equipment, so that the accuracy of the identifier information of the peripheral equipment is ensured.
A data transmission device according to an embodiment of the second aspect of the present invention includes:
the association module is used for associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
the determining module is used for determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information and at least one of peripheral information and callback methods of the target peripheral equipment;
and the transmission module is used for carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
According to the data transmission device provided by the embodiment of the invention, the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method are accurately determined in the plurality of peripheral equipment through the identification information of the peripheral equipment, so that the accurate transmission of data between an application program and the target peripheral equipment is realized, the accuracy of data transmission in a scene of connecting the plurality of peripheral equipment is effectively solved, and good intelligent experience is provided for a user.
An electronic device according to an embodiment of the third aspect of the present invention comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the data transmission method as described in any of the above when executing the program.
A non-transitory computer readable storage medium according to an embodiment of the fourth aspect of the present invention has stored thereon a computer program which, when executed by a processor, implements the steps of the data transmission method as described in any of the above.
The above technical solutions in the embodiments of the present invention have at least one of the following technical effects:
the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method are accurately determined in the plurality of peripheral equipment through the identification information of the peripheral equipment, so that accurate transmission of data between an application program and the target peripheral equipment is realized, the accuracy of data transmission in a scene of connecting the plurality of peripheral equipment is effectively solved, and good intelligent experience is provided for a user.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a data transmission method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a data transmission method according to an embodiment of the present invention;
FIG. 3 is a second flow chart of a data transmission method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data transmission device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in further detail below with reference to the accompanying drawings and examples. The following examples are illustrative of the invention but are not intended to limit the scope of the invention.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flow chart of a data transmission method according to an embodiment of the present invention, and referring to fig. 1, the data transmission method according to an embodiment of the present invention includes the following steps:
and 130, carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
It should be noted that, the execution main body of the data transmission method provided by the present invention may be a mobile electronic device, and the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, a personal digital assistant (personal digital assistant, PDA), or the like, which is not particularly limited. The technical scheme of the invention is described in detail below by taking a mobile phone as an example to execute the data transmission method provided by the embodiment of the invention.
Optionally, in step 110, the identification information of the peripheral device is associated with peripheral information of the peripheral device and a callback method.
When the mobile phone establishes Bluetooth connection with the peripheral equipment, equipment information such as identification information (marked as key) of the peripheral equipment, peripheral equipment information (marked as peripheral) and a callback method of the peripheral equipment are recorded, and the identification information of each peripheral equipment, the peripheral equipment information and the callback method of the peripheral equipment are associated together and stored.
The identification information refers to a unique identification of the peripheral device, for example, may be an address of the peripheral device, such as: a universally unique identification code UUID or a medium access control MAC address.
Optionally, when the mobile phone is used as the central equipment to scan the nearby peripheral equipment, relevant information of the peripheral equipment is stored, the iOS can use the UUID of the peripheral equipment as a unique identifier (marked as a key) of the peripheral equipment, and the Android can use the MAC address of the peripheral equipment as a key.
The peripheral information is parameter information of the peripheral device, and may include, for example: the name of the device, the signal strength of the device, the model of the device, etc.
The callback method is a function registered to the connection layer by the service layer and used for data communication. The callback method may include: a state callback method, a data interaction callback method, a disconnection callback method and the like. By associating the key of the peripheral device with the callback method, the callback method can be stored by taking the key as a unique identifier.
In step 120, a target peripheral device is determined from the plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device.
Based on step 110, the identification information of the peripheral device, the peripheral information, and the callback method of the peripheral device have been associated together. According to Application (APP) or data sent by peripheral equipment, determining the identification information of the peripheral equipment from the data, namely determining the target peripheral equipment, peripheral information of the target peripheral equipment and a callback method from a plurality of peripheral equipment connected with a mobile phone at the same time.
In step 130, data transmission between the target peripheral device and the application program is performed according to at least one of peripheral information of the target peripheral device and a callback method. The data sent by the APP can be sent to the peripheral equipment through the peripheral information of the target peripheral equipment; and the data sent by the target peripheral equipment can be sent to the APP through a callback method of the target peripheral equipment. Thereby realizing the accurate data transmission between the target peripheral equipment and the application program.
For example, fig. 2 is one of the flow charts of the data transmission method provided by the embodiment of the present invention, referring to fig. 2,
When the mobile phone starts Bluetooth scanning, scanning to the equipment A, the equipment B and the equipment C, respectively recording the identification information key and peripheral information peripheral of the equipment, and calling back a callback method callback.
When a connection request is initiated to the equipment A, the key1 of the equipment A, the peripheral1 and the callback1 are associated and stored; similarly, when a connection request is initiated to the equipment B, the key2, the peripheral2 and the callback2 of the equipment B are associated and stored; when a connection request is initiated to the device C, the key3, the peripheral3 and the callback3 of the device C are associated and stored. As shown in table 1:
table 1 associated device information
Device A | key1-peripheral1-callback1 |
Device B | key2-peripheral2-callback2 |
Device C | key3-peripheral3-callback3 |
… | … |
When the mobile phone is connected with a plurality of peripheral devices, the data sent by the peripheral devices are analyzed, the key is determined, the data sent by which device can be determined, the callback can be determined according to the key, the data can be sent to the APP through the callback, and the data transmission between the peripheral devices and the APP is realized.
By analyzing the data sent by the APP, determining the key, which equipment the data is to be sent to, and according to the key, the peripheral can be determined, the data can be sent to the target peripheral through the peripheral, and data transmission between the peripheral and the APP is realized.
According to the data transmission method provided by the embodiment of the invention, the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method are accurately determined in the plurality of peripheral equipment through the identification information of the peripheral equipment, so that the accurate transmission of data between an application program and the target peripheral equipment is realized, the accuracy of data transmission in a scene of connecting the plurality of peripheral equipment is effectively solved, and good intelligent experience is provided for a user.
In one embodiment, the data transmission method provided by the embodiment of the present invention further includes:
and associating the identification information of the peripheral equipment with an encryption method and a decryption method of the peripheral equipment.
Optionally, under the condition that the mobile phone and the peripheral equipment are successfully connected, the mobile phone and the peripheral equipment can carry out key negotiation so as to ensure the accuracy of connection and data transmission. Therefore, when the Bluetooth connection is established between the mobile phone and the peripheral equipment, different keys can be set with different peripheral equipment and recorded, so that the encryption method and decryption method of the peripheral equipment can be obtained.
And the encryption method and the decryption method of the peripheral equipment are associated with the identification information of the peripheral equipment, so that the target peripheral equipment can be determined after the identification information is obtained, and meanwhile, the decryption method and the encryption method of the target peripheral equipment are determined.
According to the data transmission method provided by the embodiment of the invention, the identification information of the peripheral equipment is associated with the encryption method and the decryption method of the peripheral equipment, so that the security of data transmission in a scene of connecting a plurality of peripheral equipment can be ensured.
In one embodiment, determining a target peripheral device from a plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, includes:
receiving first data sent by target peripheral equipment;
determining identification information of the target peripheral equipment from the first data, and determining a decryption method of the target peripheral equipment and a data interaction callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the decryption method of the target peripheral equipment is used for decrypting the data to be transmitted in the first data;
the data interaction callback method of the target peripheral equipment is used for sending the decrypted data to be sent to the application program.
Optionally, after the mobile phone establishes bluetooth connection with the peripheral device, data interaction can be performed.
When the target peripheral equipment sends data to the APP, the data is firstly sent to the mobile phone. After receiving the data sent by the target peripheral equipment, the mobile phone analyzes the data sent by the target peripheral equipment to obtain the identification information of the target peripheral equipment, and can determine the target peripheral equipment, a decryption method of the target peripheral equipment and a data interaction callback method from a plurality of connected peripheral equipment.
And decrypting the received data through a Bluetooth protocol and a decryption method of the target peripheral equipment, and sending the decrypted data to the APP through a data interaction callback method. After the APP receives the data, subsequent business operation can be performed. The APP can also inform the user of the data sent by the target peripheral device in a sound, text or video mode.
According to the data transmission method provided by the embodiment of the invention, the callback method and the decryption method of the target peripheral equipment are determined through the identification information of the peripheral equipment, and the data sent by the target peripheral equipment is sent to the application program according to the decryption method and the callback method, so that the accuracy and the safety of data transmission between the peripheral equipment and the application program are realized.
In one embodiment, determining a target peripheral device from a plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, includes:
receiving second data sent by an application program;
determining the identification information of the target peripheral equipment from the second data, and determining the encryption method of the target peripheral equipment and the peripheral information of the target peripheral equipment according to the identification information of the target peripheral equipment;
The encryption method of the target peripheral equipment is used for encrypting the data to be sent in the second data;
the peripheral information of the target peripheral equipment is used for sending the encrypted data to be sent to the target peripheral equipment.
Optionally, after the mobile phone establishes bluetooth connection with the peripheral device, data interaction can be performed. When the APP issues data to the peripheral equipment, the data is firstly sent to the mobile phone, after the mobile phone receives the data sent by the APP, the identification information of the target peripheral equipment is obtained by analyzing the data sent by the APP, and the target peripheral equipment, the encryption method of the target peripheral equipment and the peripheral information can be determined from a plurality of connected peripheral equipment.
And assembling the data issued by the APP according to the Bluetooth protocol, encrypting the data by using an encryption method, and transmitting the data to the target peripheral equipment according to the peripheral information of the target peripheral equipment.
According to the data transmission method provided by the embodiment of the invention, the peripheral information and the encryption method of the target peripheral equipment are determined through the identification information of the peripheral equipment, and the data sent by the application program is sent to the target peripheral equipment according to the encryption method and the peripheral information, so that the accuracy and the safety of data transmission between the peripheral equipment and the application program are realized.
In one embodiment, determining a target peripheral device from a plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, includes:
receiving third data sent by target peripheral equipment;
determining the identification information of the target peripheral equipment from the third data, and determining a disconnection callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the disconnection callback method of the target peripheral equipment is used for uploading the disconnection information of the target peripheral equipment to the application program.
Optionally, when the mobile phone actively disconnects from the target peripheral device, determining the target peripheral device according to the identification information of the peripheral device, executing a disconnection method, and waiting for a callback notification of successful disconnection.
When a callback of successful passive disconnection sent by the target peripheral equipment is received or the callback of active disconnection of Bluetooth connection of the target peripheral equipment is received, a disconnection callback method of the target peripheral equipment can be determined according to the identification information of the target peripheral equipment, and the disconnection information of the equipment is accurately reported to the APP by calling the disconnection callback method.
And meanwhile, according to the identification information of the target peripheral equipment, the peripheral information and the callback method of the target peripheral equipment, which are stored in advance, are cleared.
According to the data transmission method provided by the embodiment of the invention, the target peripheral equipment is disconnected through the identification information of the peripheral equipment, and after receiving the information of successful disconnection sent by the target peripheral equipment, the disconnection callback method is called to upload the information of disconnection of the target peripheral equipment to the application program, so that the accuracy of data transmission is ensured.
In one embodiment, determining a target peripheral device from a plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, includes:
receiving fourth data sent by target peripheral equipment;
determining the identification information of the target peripheral equipment from the fourth data, and determining a state callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the state callback method of the target peripheral equipment is used for uploading state information of the target peripheral equipment to the application program.
Optionally, in the process of connecting with the peripheral device, the Bluetooth state and the connection state change of the target peripheral device in the connection process can be monitored, and the state information of the peripheral device can be monitored in real time.
According to the data sent by the peripheral equipment, a state callback method of the peripheral equipment is found, and the state of the current peripheral equipment can be reported to the APP by calling the callback method of the peripheral equipment, so that the state of the current equipment can be accurately known.
According to the data transmission method provided by the embodiment of the invention, the state callback method of the peripheral equipment is determined through the identification information of the peripheral equipment, so that the state callback method is called to accurately upload the state of the peripheral equipment to the application program, and the accurate monitoring of the state of the peripheral equipment is realized.
In one embodiment, associating the identification information of the peripheral device with the peripheral information of the peripheral device and the callback method includes:
forming a key value pair by taking the identification information of the peripheral equipment as a key and the peripheral information of the peripheral equipment and a callback method as a value;
and storing the key value pairs into a preset equipment pool.
Optionally, when bluetooth connection is initiated to the external device, creating a device pool, using the identification information of the external device as a key, using the peripheral information of the external device and a callback method as a value, forming a key value pair, and storing the key value pair in the device pool.
According to the data transmission method provided by the embodiment of the invention, the peripheral information of the peripheral equipment and the callback method are used as values to form the key value pair, and the key value pair is stored in the equipment pool, so that the peripheral information and the callback method of the target peripheral equipment can be directly determined in the equipment pool, and the accuracy of data transmission is ensured.
In one embodiment, the identification information of the peripheral device is determined by:
determining peripheral equipment through Bluetooth scanning;
and receiving the broadcast packet data sent by the peripheral equipment, and analyzing the broadcast packet data to determine the identification information of the peripheral equipment.
Optionally, the peripheral device is powered on and is set to a bluetooth broadcast transmission state, so that the peripheral device can be discovered by a bluetooth manager with the mobile phone as a center. Opening an APP, acquiring Bluetooth permission and opening a mobile phone Bluetooth; the mobile phone is used as Bluetooth center equipment, and a service UUID of the peripheral equipment and rules for finding the peripheral equipment are set.
The mobile phone starts Bluetooth scanning to find out nearby peripheral equipment, receives broadcast packet data sent by the peripheral equipment, and can acquire UUID or MAC of a peripheral object, namely identification information of the peripheral equipment by analyzing the peripheral broadcast packet data.
According to the data transmission method provided by the embodiment of the invention, the unique identifier of the peripheral equipment is determined by analyzing the broadcast data sent by the peripheral equipment, so that the accuracy of the identifier information of the peripheral equipment is ensured.
Fig. 2 is a first flow chart of a data transmission method according to an embodiment of the present invention, and fig. 3 is a second flow chart of a data transmission method according to an embodiment of the present invention, and referring to fig. 2 and fig. 3, the data transmission method according to an embodiment of the present invention includes the following steps:
Step 1: when the mobile phone is used as central equipment to scan nearby peripheral equipment, relevant information of the peripheral equipment is stored, the iOS can use a UUID of the peripheral equipment as a unique identifier (marked as key, the key is the same hereinafter), and the Android can use an MAC of the peripheral equipment as the key, and the specific steps are as follows:
1. powering up the Bluetooth device and setting the device in a Bluetooth broadcast transmitting state, so that the device can be found by taking the mobile phone as a central Bluetooth manager;
2. opening an APP, acquiring Bluetooth permission and opening a mobile phone Bluetooth; taking a mobile phone as Bluetooth center equipment, and setting a service UUID of a peripheral and a rule for discovering equipment;
3. starting Bluetooth scanning by the mobile phone to find out nearby peripheral equipment, receiving broadcast packet data sent by the nearby peripheral equipment, analyzing the broadcast packet data, and acquiring UUID or MAC of a peripheral equipment object;
4. and determining target equipment according to the rule of finding the peripheral equipment, recording the peripheral equipment object (marked as peripheral), recording the unique identification key corresponding to the peripheral equipment, and stopping scanning.
Step 2: when equipment and data communication are connected, the state of the Bluetooth connection process between the mobile phone and the peripheral equipment is returned, and the corresponding peripheral equipment is found in the equipment pool through keys for data communication, so that the accuracy of data transmission is achieved, and the method specifically comprises the following steps:
1. According to the peripheral equipment peripheral acquired in the step 1, the central equipment initiates a connection request for the peripheral equipment;
2. creating a device pool, and storing device information such as a peripheral device key and a peripheral device callback method into the device pool by taking the key and the peripheral device as key value pairs;
3. monitoring the Bluetooth state and the change of the connection state in the connection process, finding a state callback method of the target peripheral equipment in the equipment pool according to the key of the peripheral, and calling the callback method to report the state of the target peripheral equipment to an upper layer service;
4. after successful connection, key negotiation is carried out to ensure the safety of Bluetooth connection and data interaction;
5. when the mobile phone receives data sent by the target peripheral equipment, firstly determining a key in the peripheral equipment, determining a callback method and a decryption method of data interaction in equipment information according to the key in the equipment pool, decrypting the data according to a Bluetooth protocol and a decryption method, and reporting the decrypted data to the APP through the data interaction callback method;
when APP needs to issue data to the device, the data is assembled according to Bluetooth protocol, and then the data is encrypted by using encryption method; and finding a peripheral according to the device pool of the incoming key, and transmitting the encrypted data to the target peripheral by the Bluetooth center manager.
Step 3: when the connection of the equipment is disconnected, the corresponding peripheral is required to be found by a key equipment removing pool when the connection of the mobile phone and the peripheral is disconnected, the connection of the corresponding peripheral is canceled, and data is cleared, and the specific steps are as follows:
1. when the mobile phone actively disconnects with the peripheral, finding a peripheral according to the key, executing a disconnection method, and waiting for a callback notification of successful disconnection;
2. when a callback with successful passive disconnection or a callback with active disconnection of the device is received, acquiring a callback method of disconnection in device information in a device pool according to a key of the peripheral, and accurately reporting the device disconnection information to the APP;
3. and clearing the device information in the device pool through the key, and ending the primary device connection.
According to the steps, equipment information such as the peripheral equipment, the state callback method, the data interaction callback method and the disconnection callback method is saved through the unique identification key of the peripheral equipment, so that the callback method of the corresponding equipment information can be accurately found when corresponding services are found, data are reported to an upper service layer, the upper service layer can accurately process the services, and the stability of the APP function is guaranteed. In addition, through the steps, the mobile phone can be ensured to accurately inform specific equipment when the equipment is connected, data transmission and connection are disconnected under the condition of being connected with multiple pieces of equipment, and the upper business logic can be more stable.
Fig. 4 is a schematic structural diagram of a data transmission device according to an embodiment of the present invention. Referring to fig. 4, the data transmission apparatus provided by the present invention includes:
the association module 410 is configured to associate the identification information of the peripheral device with the peripheral information of the peripheral device and a callback method;
a determining module 420, configured to determine a target peripheral device from the plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device;
and the transmission module 430 is configured to perform data transmission between the target peripheral device and the application program according to at least one of peripheral information and callback method of the target peripheral device.
According to the data transmission device provided by the embodiment of the invention, the target peripheral equipment, the peripheral information of the target peripheral equipment and the callback method are accurately determined in the plurality of peripheral equipment through the identification information of the peripheral equipment, so that the accurate transmission of data between an application program and the target peripheral equipment is realized, the accuracy of data transmission in a scene of connecting the plurality of peripheral equipment is effectively solved, and good intelligent experience is provided for a user.
In one embodiment, the data transmission device provided by the embodiment of the present invention further includes:
And the second association module is used for associating the identification information of the peripheral equipment with the encryption method and the decryption method of the peripheral equipment.
In one embodiment, the determining module 420 is specifically configured to:
receiving first data sent by target peripheral equipment;
determining identification information of the target peripheral equipment from the first data, and determining a decryption method of the target peripheral equipment and a data interaction callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the decryption method of the target peripheral equipment is used for decrypting the data to be transmitted in the first data;
the data interaction callback method of the target peripheral equipment is used for sending the decrypted data to be sent to the application program.
In one embodiment, the determining module 420 is specifically configured to:
receiving second data sent by an application program;
determining the identification information of the target peripheral equipment from the second data, and determining the encryption method of the target peripheral equipment and the peripheral information of the target peripheral equipment according to the identification information of the target peripheral equipment;
the encryption method of the target peripheral equipment is used for encrypting the data to be sent in the second data;
the peripheral information of the target peripheral equipment is used for sending the encrypted data to be sent to the target peripheral equipment.
In one embodiment, the determining module 420 is specifically configured to:
receiving third data sent by target peripheral equipment;
determining the identification information of the target peripheral equipment from the third data, and determining a disconnection callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the disconnection callback method of the target peripheral equipment is used for uploading the disconnection information of the target peripheral equipment to the application program.
In one embodiment, the determining module 420 is specifically configured to:
receiving fourth data sent by target peripheral equipment;
determining the identification information of the target peripheral equipment from the fourth data, and determining a state callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the state callback method of the target peripheral equipment is used for uploading state information of the target peripheral equipment to the application program.
In one embodiment, the association module 410 is specifically configured to:
forming a key value pair by taking the identification information of the peripheral equipment as a key and the peripheral information of the peripheral equipment and a callback method as a value;
and storing the key value pairs into a preset equipment pool.
In one embodiment, the identification information of the peripheral device is determined by:
Determining peripheral equipment through Bluetooth scanning;
and receiving the broadcast packet data sent by the peripheral equipment, and analyzing the broadcast packet data to determine the identification information of the peripheral equipment.
Fig. 5 illustrates a physical schematic diagram of an electronic device, as shown in fig. 5, which may include: processor 510, communication interface (Communications Interface) 520, memory 530, and communication bus 540, wherein processor 510, communication interface 520, memory 530 complete communication with each other through communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform the following method:
associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information, and at least one of peripheral information and callback method of the target peripheral equipment;
and carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
Further, the logic instructions in the memory 530 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Further, embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the data transmission method provided by the above-described method embodiments, for example comprising:
associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information, and at least one of peripheral information and callback method of the target peripheral equipment;
and carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
In another aspect, embodiments of the present invention further provide a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor is implemented to perform the data transmission method provided in the above embodiments, for example, including:
associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
Determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information, and at least one of peripheral information and callback method of the target peripheral equipment;
and carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will 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 invention.
The above embodiments are only for illustrating the present invention, and are not limiting of the present invention. While the invention has been described in detail with reference to the embodiments, those skilled in the art will appreciate that various combinations, modifications, or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and it is intended to be covered by the scope of the claims of the present invention.
Claims (12)
1. A data transmission method, comprising:
associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information, and at least one of peripheral information and callback methods of the target peripheral equipment;
And carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
2. The data transmission method according to claim 1, further comprising:
and associating the identification information of the peripheral equipment with an encryption method and a decryption method of the peripheral equipment.
3. The data transmission method according to claim 2, wherein the determining a target peripheral device from among the plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, comprises:
receiving first data sent by the target peripheral equipment;
determining the identification information of the target peripheral equipment from the first data, and determining a decryption method of the target peripheral equipment and a data interaction callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the decryption method of the target peripheral equipment is used for decrypting the data to be sent in the first data;
the data interaction callback method of the target peripheral equipment is used for sending the decrypted data to be sent to the application program.
4. The data transmission method according to claim 2, wherein the determining a target peripheral device from among the plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, comprises:
receiving second data sent by the application program;
determining the identification information of the target peripheral equipment from the second data, and determining an encryption method of the target peripheral equipment and peripheral information of the target peripheral equipment according to the identification information of the target peripheral equipment;
the encryption method of the target peripheral equipment is used for encrypting the data to be sent in the second data;
the peripheral information of the target peripheral equipment is used for sending the encrypted data to be sent to the target peripheral equipment.
5. The data transmission method according to claim 1, wherein the determining a target peripheral device from among the plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, comprises:
receiving third data sent by the target peripheral equipment;
Determining the identification information of the target peripheral equipment from the third data, and determining a disconnection callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the disconnection callback method of the target peripheral equipment is used for uploading the disconnection information of the target peripheral equipment to the application program.
6. The data transmission method according to claim 1, wherein the determining a target peripheral device from among the plurality of peripheral devices according to the received identification information, and at least one of peripheral information and callback method of the target peripheral device, comprises:
receiving fourth data sent by the target peripheral equipment;
determining the identification information of the target peripheral equipment from the fourth data, and determining a state callback method of the target peripheral equipment according to the identification information of the target peripheral equipment;
the state callback method of the target peripheral equipment is used for uploading the state information of the target peripheral equipment to the application program.
7. The method for data transmission according to any one of claims 1 to 6, wherein associating the identification information of the peripheral device with the peripheral information of the peripheral device and a callback method includes:
Forming a key value pair by taking the identification information of the peripheral equipment as a key and the peripheral information of the peripheral equipment and a callback method as a value;
and storing the key value pairs into a preset equipment pool.
8. The data transmission method according to any one of claims 1 to 6, wherein the identification information of the peripheral device is determined by:
determining the peripheral equipment through Bluetooth scanning;
and receiving the broadcast packet data sent by the peripheral equipment, and analyzing the broadcast packet data to determine the identification information of the peripheral equipment.
9. A data transmission apparatus, comprising:
the association module is used for associating the identification information of the peripheral equipment with the peripheral information of the peripheral equipment and a callback method;
the determining module is used for determining target peripheral equipment from a plurality of peripheral equipment according to the received identification information and at least one of peripheral information and callback methods of the target peripheral equipment;
and the transmission module is used for carrying out data transmission between the target peripheral equipment and the application program according to at least one of the peripheral information and the callback method of the target peripheral equipment.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the data transmission method according to any one of claims 1 to 8 when the program is executed by the processor.
11. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the data transmission method according to any one of claims 1 to 8.
12. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the data transmission method according to any one of claims 1 to 8.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111515706.8A CN116264677A (en) | 2021-12-13 | 2021-12-13 | Data transmission method and device |
PCT/CN2022/130346 WO2023109366A1 (en) | 2021-12-13 | 2022-11-07 | Data transmission method and apparatus, and electronic device, storage medium and computer program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111515706.8A CN116264677A (en) | 2021-12-13 | 2021-12-13 | Data transmission method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116264677A true CN116264677A (en) | 2023-06-16 |
Family
ID=86721881
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111515706.8A Pending CN116264677A (en) | 2021-12-13 | 2021-12-13 | Data transmission method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116264677A (en) |
WO (1) | WO2023109366A1 (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3000262B1 (en) * | 2013-05-20 | 2019-05-08 | Ruckus Wireless, Inc. | A method and apparatus for recording information from a plurality of mobile devices in an area |
JP6567939B2 (en) * | 2015-10-05 | 2019-08-28 | 任天堂株式会社 | Information processing system, peripheral device, wireless communication chip, application program, and information processing method |
CN105491135B (en) * | 2015-12-11 | 2018-11-02 | 小米科技有限责任公司 | Establish the method and device of data connection |
CN111935694B (en) * | 2020-10-15 | 2021-03-16 | 飞天诚信科技股份有限公司 | Bluetooth device connection method and device, electronic device and readable storage medium |
-
2021
- 2021-12-13 CN CN202111515706.8A patent/CN116264677A/en active Pending
-
2022
- 2022-11-07 WO PCT/CN2022/130346 patent/WO2023109366A1/en unknown
Also Published As
Publication number | Publication date |
---|---|
WO2023109366A1 (en) | 2023-06-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108632056B (en) | Intelligent equipment network configuration method and system | |
US9894518B2 (en) | Server and method for remotely controlling working of communications terminal, and communications terminal | |
US10952036B2 (en) | Method for regrouping multiple groups and device | |
US8990555B2 (en) | Centralized key management | |
CN109922474B (en) | Method for triggering network authentication and related equipment | |
US20200137672A1 (en) | Handling a ue that is in the idle state | |
CN101208981A (en) | Security parameters for negotiation protecting management frames in wireless networks | |
CN111132305B (en) | Method for 5G user terminal to access 5G network, user terminal equipment and medium | |
US8543688B1 (en) | Generating correlation codes for location information | |
WO2021197489A1 (en) | Communication system, method and apparatus | |
CN104488302A (en) | Wireless connection authentication method and server | |
US20150319618A1 (en) | Communication security processing method, and apparatus | |
CN108243631B (en) | Network access method and equipment | |
WO2018076298A1 (en) | Security capability negotiation method and related device | |
JP6339305B1 (en) | Communication system, parent device, server, child device, communication method, and program | |
EP2139279A1 (en) | Systems and methods for monitoring performance of a communication system | |
CN111093196A (en) | Method for 5G user terminal to access 5G network, user terminal equipment and medium | |
CN116264677A (en) | Data transmission method and device | |
CN108696855B (en) | Information management method, session management function and mobility management function | |
CN102938882A (en) | Method and system changing contact information of mobile phone terminals of others by sending messages | |
CN106664731B (en) | User has found method, user equipment and close to business function entity | |
CN114128329A (en) | Method and apparatus for utilizing open function of wireless communication network | |
CN107770769B (en) | Encryption method, network side equipment and terminal | |
CN112153580B (en) | Method, equipment and system for setting MCPTT group | |
WO2023231939A1 (en) | Service processing method and apparatus, network device and storage medium |
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 |