A device interconnection method and related equipment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]然而BLE等蓝牙广播消息长度受限,长账号ID放入广播消息后挤占了较多有效载荷空间,剩余可用空间不足以携带更多设备互联上下文信息,这使得BLE等蓝牙广播有效信息太少,需要连接后进一步在设备之间进行信息交换以获取更多上下文信息,迫使设备经历“先建连、后交换”的高开销交互流程,从而加大了设备发现与连接阶段的资源(如空口资源)消耗及时间成本
[0042]一种存储介质,所述存储介质承载有一个或多个计算机指令集,所述一个或多个计算机指令集被电子设备执行时,能够使所述电子设备实现如上文提供的任一种应用于第一设备的设备互联方法,和/或任一种应用于第二设备的设备互联方法。
Smart Images

Figure CN122579347A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of near-field connectivity technology, and more particularly to a device interconnection method and related devices. Background Technology
[0002] In near-field multi-device interconnection scenarios, the most common method is for devices with the same account to discover each other via Bluetooth broadcasts such as BLE (Bluetooth Low Energy) and then automatically connect. To ensure uniqueness, the account ID (Identity) is generally quite long, such as the common 16-byte UUID (Universally Unique Identifier).
[0003] However, Bluetooth broadcast messages such as BLE have limited length. Long account IDs taken up a lot of payload space when placed in broadcast messages, leaving insufficient space to carry more device interconnection context information. This results in too little effective information in Bluetooth broadcasts such as BLE, requiring further information exchange between devices after connection to obtain more context information. This forces devices to go through a high-overhead interaction process of "establishing connection first, then exchanging," thereby increasing the consumption of resources (such as air interface resources) and time costs in the device discovery and connection phase. Summary of the Invention
[0004] Therefore, this application discloses the following technical solution:
[0005] A device interconnection method, applied to a first device, the method comprising:
[0006] Obtain the first account identifier and first key information used by the first device to log in to the target application;
[0007] Generate the first random parameter;
[0008] Based on the first account identifier, the first key information and the first random parameter, a first short identifier is generated, the length of the first short identifier being less than the length of the first account identifier;
[0009] Send first near-field broadcast data, the first near-field broadcast data including the first random parameter and the first short identifier;
[0010] The first random parameter is used to generate a verification identifier based on the first random parameter, the second account identifier and the second key information of the second device logging into the target application. The verification identifier is used to match the first short identifier to verify whether the second device and the first device meet the same account condition before the second device and the first device establish an interconnection connection.
[0011] Optionally, based on the first account identifier, the first key information, and the first random parameter, a first short identifier is generated, including:
[0012] Based on the first account identifier, the first key information and the first random parameter, a message authentication operation based on a hash function is performed to obtain the first operation result;
[0013] The result of the first operation is truncated to obtain the first short identifier.
[0014] Optionally, the data length of the first random parameter is a first length, the data length of the first short identifier is a second length, and the sum of the first length and the second length is less than the length of the first account identifier.
[0015] Optionally, the first near-field broadcast data is Bluetooth Low Energy broadcast data, the first random parameter and the first short identifier are carried in the payload of the Bluetooth Low Energy broadcast data, and the remaining part after subtracting the first length and the second length from the length of the first account identifier is used to transmit device interconnection context information, which is used to assist device interconnection.
[0016] Optionally, the method further includes:
[0017] In response to receiving second near-field broadcast data from the second device, collision detection is performed on the short identifiers contained in the first near-field broadcast data and the second near-field broadcast data, respectively.
[0018] If there is an identifier collision event between the first near-field broadcast data and the second near-field broadcast data, update the first random parameter to update the first short identifier and the first near-field broadcast data based on the updated first random parameter, and send the updated first near-field broadcast data;
[0019] The identifier collision event includes short identifiers in different broadcast data whose similarity reaches a threshold.
[0020] Optionally, the method further includes:
[0021] In response to the number of the identifier collision events meeting a preset condition, the length of the first random parameter is adjusted so as to adjust the length of the first short identifier based on the length-adjusted first random parameter.
[0022] Optionally, the method further includes:
[0023] In response to the fulfillment of the recovery condition, the length of the first random parameter is restored, and the length of the first short identifier is restored based on the first random parameter after length recovery.
[0024] A device interconnection method, applied to a second device, the method comprising:
[0025] Receive first near-field broadcast data sent by a first device. The first near-field broadcast data includes a first random parameter and a first short identifier. The first short identifier is generated by the first device based on the first random parameter, a first account identifier of the first device's login target application, and first key information. The length of the first short identifier is less than the length of the first account identifier.
[0026] Based on the second account identifier, second key information, and first random parameter used by the second device to log in to the target application, a verification identifier is generated;
[0027] If the verification identifier matches the first short identifier, it is determined that the second device and the first device meet the same account condition.
[0028] A first device, comprising:
[0029] First communication module;
[0030] The first processor is used for:
[0031] Obtain the first account identifier and first key information used by the first device to log in to the target application;
[0032] Generate the first random parameter;
[0033] Based on the first account identifier, the first key information and the first random parameter, a first short identifier is generated, the length of the first short identifier being less than the length of the first account identifier;
[0034] The first near-field broadcast data is sent through the first communication module. The first near-field broadcast data includes the first random parameter and the first short identifier.
[0035] The first random parameter is used to generate a verification identifier based on the first random parameter, the second account identifier and the second key information of the second device logging into the target application. The verification identifier is used to match the first short identifier to verify whether the second device and the first device meet the same account condition before the second device and the first device establish an interconnection connection.
[0036] A second device, comprising:
[0037] Second communication module;
[0038] The second processor is used for:
[0039] The second communication module receives first near-field broadcast data sent by the first device. The first near-field broadcast data includes a first random parameter and a first short identifier. The first short identifier is generated by the first device based on the first random parameter, the first account identifier of the first device's login target application, and the first key information. The length of the first short identifier is less than the length of the first account identifier.
[0040] Based on the second account identifier, second key information, and first random parameter used by the second device to log in to the target application, a verification identifier is generated;
[0041] If the verification identifier matches the first short identifier, it is determined that the second device and the first device meet the same account condition.
[0042] A storage medium carrying one or more computer instruction sets, which, when executed by an electronic device, enable the electronic device to implement any of the device interconnection methods provided above for a first device and / or any of the device interconnection methods provided above for a second device. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0044] Figure 1 This is a flowchart of a device interconnection method applied to a first device provided in this application;
[0045] Figure 2 This is another flowchart of the device interconnection method applied to the first device provided in this application;
[0046] Figure 3 This is yet another flowchart of the device interconnection method applied to the first device provided in this application;
[0047] Figure 4 This is another flowchart of the device interconnection method applied to the first device provided in this application;
[0048] Figure 5 This is a schematic diagram comparing the payload space occupied by long account IDs in known technologies with that of random numbers and short IDs in the near-field broadcast data in this application.
[0049] Figure 6This is a flowchart of a device interconnection method for a second device provided in this application;
[0050] Figure 7 This application provides an exemplary device interconnection workflow described from the perspective of multiple devices;
[0051] Figure 8 This application provides an exemplary device interconnection workflow described from the perspective of a single device;
[0052] Figure 9 This is a structural diagram of the first device provided in this application;
[0053] Figure 10 This is a structural diagram of the second device provided in this application. Detailed Implementation
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0055] This application provides a device interconnection method and related equipment for near-field multi-device interconnection. The disclosed method includes a device interconnection method applied to a first device and a device interconnection method applied to a second device, wherein the first device and the second device can be various terminal devices with device interconnection requirements, such as personal computers, smart terminals, handheld devices, portable devices, or tablet devices, etc.
[0056] See Figure 1 This is a flowchart illustrating a device interconnection method applied to a first device provided in an embodiment of this application. The method may include the following steps 101 to 104, which are described in detail below.
[0057] Step 101: Obtain the first account identifier and first key information used by the first device to log in to the target application.
[0058] The target application can be an application for device interconnection, for example, such as the device interconnection application SmartConnect.
[0059] The primary account identifier can be, but is not limited to, a UUID. A UUID is essentially a string used to uniquely identify an object in the system, typically consisting of 32 hexadecimal digits, or 16 bytes.
[0060] In this step, it is possible, but not limited to, automatically obtaining the first account identifier such as UUID and the corresponding first key information from the device local area or downloading it from the server when the user opens the target application (such as opening device interconnection software such as Smart Connect), or automatically obtaining the first account identifier such as UUID and the corresponding first key information from the device local area or downloading it from the server after the user logs in to the target application based on the registered username (such as mobile phone number).
[0061] Both username and UUID can be used as identifiers for the target application to log in, but they have fundamental differences in their roles in the application architecture, the objects they are intended to be used for, and how they are used.
[0062] Simply put, usernames are for "people", while UUIDs are for "machines".
[0063] Username-based application login is an explicit login, requiring users to manually enter their username on the login screen—a proactive and conscious human-computer interaction process. UUID-based application login, on the other hand, is an implicit login (silent login). Users typically don't need to manually enter their UUID; the system automatically generates a UUID during initial installation or registration and saves it locally on the device. The next time the application is opened, the program automatically sends this UUID to the server for verification in the background, achieving "seamless login."
[0064] Step 102: Generate the first random parameter.
[0065] Optionally, the first random parameter can be a random number of a predetermined length, such as a 2-byte or 4-byte random number. In practice, a random number generator can be used to generate a random number of the predetermined length as the first random parameter.
[0066] Step 103: Based on the first account identifier, the first key information and the first random parameter, generate a first short identifier, the length of which is less than the length of the first account identifier.
[0067] Optionally, step 103 can be further implemented as follows:
[0068] 1-1: Perform message authentication operation based on hash function based on the first account identifier, the first key information and the first random parameter to obtain the first operation result;
[0069] 1-2: The result of the first operation is truncated to obtain the first short identifier.
[0070] After obtaining the first operation result by performing a message authentication operation based on a hash function on the first account identifier, the first key information, and the first random parameters, a substring of a certain length can be extracted from the entire string of the first operation result based on a predetermined truncation rule, serving as the first short identifier. The truncation rule may include, but is not limited to, constraints on the truncation position and length. The truncation position can be a predetermined position at the beginning, end, or middle of the entire string of the first operation result; there are no restrictions on this, and it can be determined according to the actual application.
[0071] The following is an exemplary calculation formula for generating the first short identifier based on the above processing procedure:
[0072] ;
[0073] .
[0074] The first calculation formula is used to generate a first short identifier with a length of 2 bytes, the second calculation formula is used to generate a first short identifier with a length of 4 bytes, HMAC-SHA256 represents message authentication operation based on hash function, Truncate represents string truncation operation, out represents the generated first short identifier, ID represents the first account identifier, KEY represents the first key information, and rand represents the first random parameter.
[0075] The data length of the first random parameter is the first length, the data length of the first short identifier is the second length, and the sum of the first length and the second length is less than the length of the first account identifier.
[0076] Step 104: Send first near-field broadcast data, which includes the first random parameter and the first short identifier.
[0077] After generating the first short identifier, first near-field broadcast data can be generated based on the first short identifier and the first random parameters, and the first near-field broadcast data can be sent so that other devices in the environment where the first device is located can discover and interconnect the first device based on the first near-field broadcast data.
[0078] Optionally, the first near-field broadcast data can be sent via Bluetooth BLE broadcast, and the first near-field broadcast data can be Bluetooth Low Energy broadcast data.
[0079] The first random parameter and the first short identifier are carried in the payload of the Bluetooth Low Energy Broadcast data. The remaining part after subtracting the first length of the first random parameter and the second length of the first short identifier from the length of the first account identifier is used to transmit device interconnection context information.
[0080] The device interconnection context information is used to assist device interconnection and may include, but is not limited to, one or more of the following: device type, device capabilities, application identifier, service identifier, connection address, connection method, etc. of the first device. It is mainly used for accurate device discovery and device filtering during interconnection. Instead of blindly connecting, it can perform conditional filtering based on information such as service identifier and device type in the first near-field broadcast data, so as to greatly reduce invalid connection attempts and improve the accuracy and efficiency of device discovery and connection.
[0081] The first random parameter in the first near-field broadcast data is used by the second device receiving the first near-field broadcast data to generate a verification identifier based on the first random parameter, the second account identifier of the second device logging into the target application, and the second key information. The verification identifier is used to match with the first short identifier to verify whether the second device and the first device meet the same account condition before the second device establishes an interconnection connection with the first device.
[0082] After receiving the first near-field broadcast data from the first device, the second device can extract the first random parameter and generate a verification identifier based on the first random parameter, the second account identifier and the second key information of the second device logging into the target application. Then, the verification identifier is matched with the first short identifier to verify whether the second device and the first device meet the same account condition. If the same account condition is met, a connection is established between the second device and the first device; otherwise, if the condition is not met, there is no need to interconnect the two devices.
[0083] Optionally, the same account condition can be set to the verification identifier being the same as the first short identifier.
[0084] In summary, the solution of this embodiment generates a first random parameter in the first device, and generates a first short identifier based on the first account identifier, first key information, and the first random parameter used by the first device to log in to the target application. Then, it sends first near-field broadcast data including the first random parameter and the first short identifier. This achieves the reduction of the length of the first account identifier used by the first device to log in to the target application in near-field device interconnection, and data broadcasting based on the reduced short identifier. This processing mechanism has the following beneficial effects:
[0085] 1) Ensuring the accuracy and security of device authentication: Although the broadcast "first short identifier" is no longer the first account identifier used by the first device to log in to the target application, it (the first short identifier) does not exist in isolation. Instead, it is generated based on the first account identifier, the first key information, and the first random parameter, and is carried along with the first random parameter in the first near-field broadcast data. When the second device receives this broadcast data, it can use its own stored second account identifier and second key information, combined with the first random parameter in the broadcast data, to reverse-engineer and achieve matching and verification with the first device. This mechanism ensures that even if the short identifier is physically shorter than the original account identifier, the authentication logic it represents remains complete and rigorous, effectively preventing identity forgery.
[0086] 2) Improve the efficiency of device discovery and interconnection: After converting long account identifiers to short identifiers, more payload space can be reserved in the broadcast data to fill other information, thereby supporting the carrying of more device interconnection context information in the broadcast data. This eliminates the need for devices to go through the high-overhead interaction process of "establishing connection first and then exchanging". It avoids the consumption of resources (such as air interface resources) in the device discovery and connection stage, improves the efficiency of device discovery and connection, and reduces time costs.
[0087] 3) Privacy and security are guaranteed: The first short identifier changes with the first random parameter, which is more secure than fixed privacy information and will not lock a device through broadcast data.
[0088] In an alternative embodiment, see Figure 2 The method flowchart shown, the device interconnection method applied to the first device in this application, may further include the following processing steps 105-106.
[0089] Step 105: In response to receiving the second near-field broadcast data from the second device, perform collision detection on the short identifiers contained in the first near-field broadcast data and the second near-field broadcast data respectively.
[0090] The second near-field broadcast data can be generated by the second device using the same processing logic as the first device in generating the first near-field broadcast data. Specifically, the second device generates a second random parameter, and based on this second random parameter, the second account identifier and second key information used by the second device to log in to the target application, it generates a second short identifier shorter than the second account identifier. This, in turn, generates second near-field broadcast data including the second short identifier and the second random parameter (and potentially the device interconnection context information of the second device). For a more detailed explanation of the generation process, please refer to the above description of the first device generating the first near-field broadcast data; it will not be repeated here.
[0091] After receiving the second near-field broadcast data from the second device, the first device parses the second short identifier in the broadcast data and performs collision detection on the short identifiers contained in the first near-field broadcast data and the second near-field broadcast data respectively.
[0092] The collision detection performed can be further implemented by matching the first short identifier in the first near-field broadcast data and the second short identifier in the second near-field broadcast data to verify whether the similarity between the two reaches a threshold. If the threshold is reached, it indicates that there is an identifier collision event between the first near-field broadcast data and the second near-field broadcast data; otherwise, if the threshold is not reached, there is no identifier collision event.
[0093] The similarity between the first short identifier and the second short identifier reaching the threshold can mean that the first short identifier and the second short identifier are the same, or that the first short identifier and the second short identifier are different, but their similarity is greater than or equal to the set threshold, such as the two having only a few characters with different capitalization.
[0094] Step 106: If there is an identifier collision event between the first near-field broadcast data and the second near-field broadcast data, update the first random parameter to update the first short identifier and the first near-field broadcast data based on the updated first random parameter, and send the updated first near-field broadcast data.
[0095] The identifier collision event includes short identifiers in different broadcast data whose similarity reaches a threshold.
[0096] In the event of a collision between the first and second near-field broadcast data, the first random parameter can be updated. For example, a random number generator can be used to regenerate a random number as the updated first random parameter. Based on this, a first short identifier can be regenerated using short identifier generation logic based on the updated first random parameter to update the current first short identifier. Then, the first near-field broadcast data can be regenerated based on the updated first short identifier and the updated first random parameter. This updated first near-field broadcast data can then be sent via broadcast methods such as BLE Bluetooth broadcasting, enabling other devices in the near-field environment to discover and interconnect with the first device based on the updated first near-field broadcast data.
[0097] The length of the first random parameter is the same before and after the update, for example, both are 2-byte random numbers.
[0098] This embodiment performs collision detection on the near-field broadcast data of different devices using short identifiers. This ensures that each device has a short identifier that can uniquely identify the device, effectively distinguishing different devices. This significantly reduces the probability of devices being misidentified or connected, avoids connecting to the wrong device, and ensures the accuracy of device authentication and interconnection.
[0099] In an alternative embodiment, see Figure 3 The method flowchart, the device interconnection method applied to the first device in this application, may further include the following processing steps:
[0100] Step 107: In response to the number of the identifier collision events meeting a preset condition, adjust the length of the first random parameter to adjust the length of the first short identifier based on the length-adjusted first random parameter.
[0101] The number of collision events being identified meets the preset condition, which means that the number of collision events being identified is greater than or equal to a preset threshold.
[0102] After updating the first random parameter based on the previous embodiment, and then updating the first short identifier of the first device based on the updated first random parameter, there may still be short identifier collision events with other devices in the near field environment. If short identifier collision events still exist, one or more rounds of updating the first short identifier can be performed to overcome the short identifier collision problem in the near field broadcast data of different devices.
[0103] During this process, if the number of collision events meets the preset conditions, such as being greater than or equal to a preset threshold, the length of the first random parameter can be adjusted. That is, when updating the first random parameter, the length of its corresponding string is also changed at the same time.
[0104] Optionally, the length of the first random parameter can be extended / increased. Subsequently, the first short identifier and the first near-field broadcast data can be regenerated based on the first random parameter after the length extension / increase, and the first near-field broadcast data can be sent based on broadcast methods such as BLE Bluetooth broadcast.
[0105] For example, the original 2-byte random number is extended to a 4-byte random number, and the 2-byte short identifier calculation formula is updated to a 4-byte short identifier calculation formula. The 4-byte short identifier calculation formula is used to generate a 4-byte first short identifier based on the 4-byte random number, and to generate and send first near-field broadcast data containing a 4-byte random number and a 4-byte short identifier (which may also include device interconnection context information of the first device).
[0106] This embodiment adjusts the length of the first random number to update the first short identifier and the first near-field broadcast data, which can overcome short identifier collision events with other devices in the near-field environment as quickly and effectively as possible. It avoids the problem that short identifier updates cannot effectively overcome short identifier collision events when the length is not adjusted (such as failing to overcome them after multiple attempts).
[0107] In an alternative embodiment, see Figure 4The method flowchart, applied to the device interconnection method of the first device, may also include the following processing steps:
[0108] Step 108: In response to the fulfillment of the recovery condition, restore the length of the first random parameter, and restore the length of the first short identifier based on the length-recovered first random parameter.
[0109] Optionally, the recovery condition can be set to periodically detect that there is no identifier collision event between the first device and other devices in the environment after adjusting the length of the first random parameter.
[0110] Based on this recovery condition, after adjusting the length of the first random parameter, the system can periodically detect the identification collision between the first device and other devices in the environment based on a timing mechanism. If there is no identification collision event, the length of the first random parameter can be restored. For example, the first random parameter, which has been extended to 4 bytes, can be restored to the default length of 2 bytes.
[0111] In practical applications, the length of the first random parameter can be restored by regenerating the first random parameter with a default length of such as 2 bytes.
[0112] After restoring the length of the first random parameter, the first short identifier and the first near-field broadcast data can be updated synchronously based on the restored length of the first random parameter, and the updated first near-field broadcast data can be sent.
[0113] Optionally, the default length of the first random parameter can be the minimum length among its optional lengths. In this embodiment, the length of the first random parameter is consistent with the length of the first short identifier, for example, both are 2 bytes or both are 4 bytes. The shorter the length of the first random parameter and the shorter the length of the first short identifier, the less payload space the first short identifier and the first random parameter need to occupy in the first near-field broadcast data. However, at the same time, it will increase the probability of identifier collision between devices. Conversely, the longer the length of the first random parameter and the first short identifier, the more payload space they need to occupy in the first near-field broadcast data, and at the same time, it will reduce the probability of identifier collision between devices. In practical applications, the effective payload space occupied by the two in the first near-field broadcast data and the identifier collision events between devices can be dynamically balanced by adjusting or restoring the length of the first random parameter and synchronously updating the first short identifier.
[0114] Taking a random number whose first random parameter is 2 or 4 bytes and a short ID whose first short identifier is 2 or 4 bytes as an example, see [link to example]. Figure 5The present invention provides a comparative diagram showing the effective payload space occupied by long account IDs in known technologies and 2-byte random numbers and short IDs and 4-byte random numbers and short IDs in near-field broadcast data, respectively. Compared with known technologies, the random numbers and short IDs in this application significantly reduce the amount of effective payload space occupied in near-field broadcast data.
[0115] See Table 1, which provides the collision probabilities corresponding to the 2-byte first random parameter / first short identifier and the 4-byte first random parameter / first short identifier.
[0116] Table 1
[0117]
[0118] In Table 1, n represents the number of devices in the near-field environment.
[0119] Under normal usage conditions, a 2-byte first random parameter and a 2-byte first short identifier are generally sufficient to meet the requirements and will not cause identifier collision events. When there are a lot of devices, the first random parameter / first short identifier can be extended to 4 bytes to dynamically avoid identifier collision issues.
[0120] This embodiment restores the length of the first random parameter when the recovery conditions are met. This allows for minimizing the length of the first random parameter and the first short identifier while satisfying collision detection verification and preventing identifier collision events. This saves the payload space occupied by both in the first near-field broadcast data, enabling the first near-field broadcast data to carry more device interconnection context information.
[0121] In an optional embodiment, the first random parameter can be regenerated at regular intervals, and the first short identifier and the first near-field broadcast data can be generated synchronously based on the regenerated first random parameter. This ensures that the first short identifier obtained after account length compression changes randomly at regular intervals, thereby further reducing the possibility of locking a device through broadcast data and further protecting the privacy and security of the device.
[0122] See Figure 6 This is a flowchart illustrating a device interconnection method applied to a second device provided in an embodiment of this application. The method may include the following steps 601 to 603.
[0123] Step 601: Receive the first near-field broadcast data sent by the first device.
[0124] The first near-field broadcast data includes a first random parameter and a first short identifier. The first short identifier is generated by the first device based on the first random parameter, the first account identifier of the first device logging into the target application, and the first key information. The length of the first short identifier is less than the length of the first account identifier.
[0125] After receiving the first near-field broadcast data, the second device can parse the broadcast data to obtain the first random parameter and the first short identifier contained therein.
[0126] Step 602: Generate a verification identifier based on the second account identifier, second key information and first random parameter used by the second device to log in to the target application.
[0127] After obtaining the first random parameter, the second device can perform a message authentication operation based on a hash function using its second account identifier, second key information, and the first random parameter to log in to the target application, and obtain a second operation result. Then, the second operation result is further truncated (for example, the first 2 bytes or the first 4 bytes of the second operation result are truncated) to obtain a verification identifier.
[0128] Step 603: If the verification identifier matches the first short identifier, it is determined that the second device and the first device meet the same account condition.
[0129] Optionally, the same account condition can be set to the verification identifier being the same as the first short identifier.
[0130] After obtaining the verification identifier, it can be matched with the first short identifier. If the two are matched, for example, if the two identifiers are the same, then it is determined that the second device and the first device meet the condition of having the same account.
[0131] If the same account condition is met, the second device can establish a connection with the first device to achieve interconnection between the two devices; otherwise, if the condition is not met, there is no need to interconnect the two devices.
[0132] In this embodiment, after the second device receives the first near-field broadcast data from the first device, it uses its own second account identifier and second key information for logging into the target application, and combines this with the first random parameter in the first near-field broadcast data to perform reverse derivation to achieve matching verification with the first device. This mechanism ensures that even if the short identifier is compressed in physical length, the identity authentication logic it represents remains complete and rigorous, effectively preventing device identity forgery. Simultaneously, by compressing the long account into a short identifier, the space occupied by the broadcast data payload is saved, allowing more payload space to be filled with other information. This avoids the high-overhead interaction process of "establishing a connection first, then exchanging data," preventing resource consumption (such as air interface resources) during device discovery and connection, improving device discovery and connection efficiency, and reducing time costs.
[0133] The following is an application example of the solution proposed in this application.
[0134] In this example, the near-field environment contains three devices. Device A and Device B use the same account, that is, they log in to the target application through the same account identifier (long account). Device C logs in to the target application based on a different account identifier (long account) than Device A / B.
[0135] See also Figure 7 The device interconnection mechanism described from the perspective of multiple devices is shown, and Figure 8 The device interconnection mechanism described from the perspective of a single device is as follows: Each device can generate a corresponding short identifier (represented as id in the figure, such as id1, id2, and id3) based on its account identifier (represented as ID in the figure, such as ID1, ID2), key information (represented as KEY in the figure, such as KEY1, KEY2) and generated random number (represented as rand in the figure, such as rand1, rand2, and rand3). Then, it generates near-field broadcast data based on the generated short identifier and sends the near-field broadcast data via BLE Bluetooth broadcast.
[0136] Each device can then perform tag collision detection and update the random number or extend its length when a tag collision event is detected, in order to dynamically avoid tag collision events between different devices.
[0137] Each device can determine a verification identifier by using its own account identifier and key information used to log in to the target application, combined with random parameters in the received near-field broadcast data. This verification identifier is then matched with a short identifier in the received near-field broadcast data to determine if the device sharing the same account with the source device of the near-field broadcast data meets the same account requirement, and thus whether interconnection with the source device of the near-field broadcast data is necessary. Specifically, devices A and B, since they log in to the target application using the same account identifier, meet the same account requirement and can establish a communication connection. However, device C, since it logs in to the target application using a different account identifier than devices A and B, does not meet the same account requirement and therefore does not need to establish a communication connection with devices A and B.
[0138] In this example, compressing the long account ID length leaves more space in the near-field broadcast data payload for other information, eliminating the need for devices to undergo the high-overhead "connection first, then exchange" interaction process. This avoids resource consumption (such as air interface resources) during device discovery and connection, improves device discovery and connection efficiency, and reduces time costs. Furthermore, the compressed short account ID is based on randomly changing parameters, which is more secure than fixed privacy information and prevents locking a device through broadcast data. Additionally, collision detection and dynamically expanding the random number length can reduce or prevent device connection errors.
[0139] This application also provides a first device, the composition of which is as follows: Figure 9 As shown, it includes a first communication module 901 and a first processor 902.
[0140] The first processor is configured to implement any of the device interconnection methods applied to the first device as provided in the corresponding method embodiments described above.
[0141] In addition, this application embodiment also provides a second device, the composition of which is as follows: Figure 10 As shown, it includes a second communication module 1001 and a second processor 1002.
[0142] Optionally, the first communication module can be a Bluetooth module, such as a Bluetooth module that supports BLE technology.
[0143] The second processor is used to implement any of the device interconnection methods applied to the second device as provided in the corresponding method embodiments above.
[0144] Optionally, the first communication module / second communication module may be, but is not limited to, a near-field communication module such as a Bluetooth module that supports BLE technology.
[0145] The first / second processor can be a central processing unit (CPU), a graphics processing unit (GPU), an application-specific integrated circuit (ASIC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a neural network processor (NPU), a deep learning processor (DPU), or other programmable logic devices.
[0146] Optionally, the electronic device may also include a display device for displaying information.
[0147] Optionally, electronic devices may also include storage resources such as memory, RAM, and cache.
[0148] Optionally, the electronic device may also include an image acquisition device.
[0149] In addition to these components, electronic devices may also include communication interfaces, communication buses, and other parts. Memory, processor, and communication interface communicate with each other through the communication bus.
[0150] Communication interfaces are used for communication between electronic devices and other devices. Communication buses can be Peripheral Component Interconnect (PCI) buses or Extended Industry Standard Architecture (EISA) buses, and can be categorized into address buses, data buses, control buses, etc.
[0151] This application also discloses a storage medium carrying one or more computer instruction sets. When executed by an electronic device, the one or more computer instruction sets enable the electronic device to implement the device interconnection method for a first device and / or the device interconnection method for a second device as provided in any of the above method embodiments.
[0152] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0153] For ease of description, the above systems or devices are described separately as various modules or units based on their functions. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware components.
[0154] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence or the part that makes a creative contribution, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0155] Finally, it should be noted that in this document, relational terms such as first, second, third, and fourth are used to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0156] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A device interconnection method, applied to a first device, the method comprising: Obtain the first account identifier and first key information used by the first device to log in to the target application; Generate the first random parameter; Based on the first account identifier, the first key information and the first random parameter, a first short identifier is generated, the length of the first short identifier being less than the length of the first account identifier; Send first near-field broadcast data, the first near-field broadcast data including the first random parameter and the first short identifier; The first random parameter is used to generate a verification identifier based on the first random parameter, the second account identifier and the second key information of the second device logging into the target application. The verification identifier is used to match the first short identifier to verify whether the second device and the first device meet the same account condition before the second device and the first device establish an interconnection connection.
2. The device interconnection method according to claim 1, wherein generating a first short identifier based on the first account identifier, the first key information, and the first random parameter includes: Based on the first account identifier, the first key information and the first random parameter, a message authentication operation based on a hash function is performed to obtain the first operation result; The result of the first operation is truncated to obtain the first short identifier.
3. The device interconnection method according to claim 1, wherein the data length of the first random parameter is a first length, the data length of the first short identifier is a second length, and the sum of the first length and the second length is less than the length of the first account identifier.
4. The device interconnection method according to claim 3, wherein the first near-field broadcast data is Bluetooth Low Energy broadcast data, the first random parameter and the first short identifier are carried in the payload of the Bluetooth Low Energy broadcast data, and the remaining part after subtracting the first length and the second length from the length of the first account identifier is used to transmit device interconnection context information, the device interconnection context information being used to assist device interconnection.
5. The device interconnection method according to claim 1 further includes: In response to receiving second near-field broadcast data from the second device, collision detection is performed on the short identifiers contained in the first near-field broadcast data and the second near-field broadcast data, respectively. If there is an identifier collision event between the first near-field broadcast data and the second near-field broadcast data, update the first random parameter to update the first short identifier and the first near-field broadcast data based on the updated first random parameter, and send the updated first near-field broadcast data; The identifier collision event includes short identifiers in different broadcast data whose similarity reaches a threshold.
6. The device interconnection method according to claim 5 further includes: In response to the number of the identifier collision events meeting a preset condition, the length of the first random parameter is adjusted so as to adjust the length of the first short identifier based on the length-adjusted first random parameter.
7. The device interconnection method according to claim 6 further includes: In response to the fulfillment of the recovery condition, the length of the first random parameter is restored, and the length of the first short identifier is restored based on the first random parameter after length recovery.
8. A device interconnection method applied to a second device, the method comprising: Receive first near-field broadcast data sent by a first device. The first near-field broadcast data includes a first random parameter and a first short identifier. The first short identifier is generated by the first device based on the first random parameter, a first account identifier of the first device's login target application, and first key information. The length of the first short identifier is less than the length of the first account identifier. Based on the second account identifier, second key information, and first random parameter used by the second device to log in to the target application, a verification identifier is generated; If the verification identifier matches the first short identifier, it is determined that the second device and the first device meet the same account condition.
9. A first device, comprising: First communication module; The first processor is used for: Obtain the first account identifier and first key information used by the first device to log in to the target application; Generate the first random parameter; Based on the first account identifier, the first key information and the first random parameter, a first short identifier is generated, the length of the first short identifier being less than the length of the first account identifier; The first near-field broadcast data is sent through the first communication module. The first near-field broadcast data includes the first random parameter and the first short identifier. The first random parameter is used to generate a verification identifier based on the first random parameter, the second account identifier and the second key information of the second device logging into the target application. The verification identifier is used to match the first short identifier to verify whether the second device and the first device meet the same account condition before the second device and the first device establish an interconnection connection.
10. A second device, comprising: Second communication module; The second processor is used for: The second communication module receives first near-field broadcast data sent by the first device. The first near-field broadcast data includes a first random parameter and a first short identifier. The first short identifier is generated by the first device based on the first random parameter, the first account identifier of the first device's login target application, and the first key information. The length of the first short identifier is less than the length of the first account identifier. Based on the second account identifier, second key information, and first random parameter used by the second device to log in to the target application, a verification identifier is generated; If the verification identifier matches the first short identifier, it is determined that the second device and the first device meet the same account condition.