Equipment networking method and device, electronic equipment and storage medium
By obtaining the event information of the device and dynamically matching the configuration information, and adjusting the network parameters, the problem of difficult balance of power consumption and performance during the ad hoc networking process is solved, and dynamic network parameter adjustment based on the device status is achieved to achieve low power consumption and high performance balance.
Patent Information
- Application Number
- CN202311353425.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-18
- Publication Date
- 2025-04-18
AI Technical Summary
During the ad hoc networking process, electronic devices need to continuously send broadcasts or scans, resulting in large power consumption. If the frequency is reduced, the probability of devices discovering each other is reduced. In the prior art, broadcast and scanning parameters are fixed, making it difficult to balance performance and power consumption.
By obtaining the event information of the device, dynamically match the corresponding configuration information, adjusting the broadcast and scanning parameters used when forming the network, and dynamically adjusting the network parameters according to the event status.
It realizes dynamic adjustment of networking parameters according to the device status to meet the needs of low power consumption and high performance, and balances the performance and power consumption of electronic devices.
Smart Images

Figure CN119854820A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a device networking method, apparatus, electronic device and storage medium. Background Art
[0002] Self-organizing network technology is a technology that implements multicast transmission in wireless communication networks. By automatically forming appropriate communication groups in the network, multiple devices can receive the same information at the same time, thereby achieving efficient data transmission. Electronic devices that support self-organizing networks generally send broadcasts or scan continuously. Only when two electronic devices collide can they achieve the effect of mutual discovery.
[0003] In the process of self-organizing networking, sending broadcasts or scanning will cause electronic devices to generate greater power consumption. If the number of broadcasts or scans is reduced, the probability of two electronic devices discovering each other will be reduced. In related technologies, the broadcast parameters and scan parameters used by electronic devices are fixed, which makes it difficult to balance the performance and functions of electronic devices. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a device networking method, apparatus, electronic device and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, a device networking method is provided, which is applied to a first device, and the method includes:
[0006] Acquire event information of the first device, where the event information is used to represent a state of an event related to device networking;
[0007] Acquire first configuration information matching the event information, where the first configuration information is used to represent parameters used when the first device is networked with other electronic devices;
[0008] Establishing a network with the second device based on the first configuration information.
[0009] In some embodiments, obtaining event information of the first device includes:
[0010] Detecting events related to device networking;
[0011] When the state of the event changes, the event information is collected.
[0012] In some embodiments, the event information includes at least one of the following: screen on / off status information; user login status information; Bluetooth switch status information; WiFi switch status information.
[0013] In some embodiments, the acquiring first configuration information matching the event information includes:
[0014] The first configuration information matching the event information is obtained from the networking scheduling configuration module through the networking executor.
[0015] In some embodiments, the networking executor includes a first executor and a second executor, the first executor is used to obtain parameters related to the first communication connection, and the second executor is used to obtain parameters related to the second communication connection; the obtaining, through the networking executor, the first configuration information matching the event information from the networking scheduling configuration module includes:
[0016] Determine a target executor matching the event information, the target executor including at least one of the first executor and the second executor;
[0017] The target executor obtains first configuration information matching the event information from the networking scheduling configuration module.
[0018] In some embodiments, the method further comprises:
[0019] The latest configuration information is obtained from the cloud through the networking scheduling configuration module.
[0020] In some embodiments, the networking with the second device based on the first configuration information includes:
[0021] Determine target configuration information based on a first priority and a second priority, where the target configuration information is the first configuration information or the second configuration information, the first priority is a priority of the first configuration information, and the second priority is a priority of the second configuration information currently used by the first device;
[0022] A network is established with the second device based on the target configuration information.
[0023] In some embodiments, the target configuration information includes a first broadcast parameter and a first scan parameter associated with establishing a first communication connection, and a second broadcast parameter and a second scan parameter associated with establishing a second communication connection; and the networking with the second device based on the target configuration information includes:
[0024] Based on the target configuration information, sending broadcast information, the broadcast information at least including a device identification, an account number, service information, an Internet Protocol address, and port information of the first device;
[0025] Based on the broadcast information, a first communication connection and / or a second communication connection is established with the second device.
[0026] In some embodiments, the networking with the second device based on the target configuration information includes:
[0027] Within the preset duration corresponding to the target configuration information, networking is performed with the second device based on the target configuration information.
[0028] In some embodiments, the networking executor includes a scheduler and a worker, and determining the target configuration information based on the first priority and the second priority includes:
[0029] Determining, by the scheduler, the target configuration information based on the first priority and the second priority;
[0030] The networking with the second device based on the target configuration information includes:
[0031] Sending the target configuration information to a preset module through the worker;
[0032] Through the preset module, networking is performed with the second device based on the target configuration information.
[0033] According to a second aspect of an embodiment of the present disclosure, a device networking apparatus is provided, which is configured on a first device, and the apparatus includes:
[0034] an event information acquisition module, configured to acquire event information of the first device, wherein the event information is used to represent a state of an event related to device networking;
[0035] a configuration information acquisition module, configured to acquire first configuration information matching the event information, wherein the first configuration information is used to represent parameters used when the first device is networked with other electronic devices;
[0036] The networking module is configured to establish a network with the second device based on the first configuration information.
[0037] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0038] processor;
[0039] a memory for storing processor-executable instructions;
[0040] The processor is configured to execute the method as described in the first aspect of the embodiment of the present disclosure.
[0041] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method described in the first aspect of the embodiment of the present disclosure.
[0042] The above method of the present disclosure has the following beneficial effects:
[0043] The method provided by the embodiment of the present disclosure obtains event information of a first device, the event information is used to characterize the state of events related to device networking; obtains first configuration information matching the event information, the first configuration information is used to characterize the parameters used when the first device is networked with other electronic devices; and networks with a second device based on the first configuration information. The configuration information used in this method matches the event information, rather than using fixed configuration information. Therefore, the configuration information used in device networking can be dynamically adjusted according to the state of events related to device networking, thereby meeting the requirements of low power consumption and high performance, and achieving a balance between the performance and power consumption of electronic devices.
[0044] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0046] Figure 1 is a flow chart of a device networking method according to an exemplary embodiment;
[0047] Figure 2 is a schematic diagram showing a device networking framework according to an exemplary embodiment;
[0048] Figure 3 is a flow chart of another device networking method according to an exemplary embodiment;
[0049] Figure 4 is a flow chart showing a device networking process according to an exemplary embodiment;
[0050] Figure 5 is a block diagram of a device for processing executable code according to an exemplary embodiment;
[0051] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0052] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0053] The device networking method provided by the embodiment of the present disclosure includes a broadcast process and a scanning process in the device networking process. The parameters used in the broadcast process and the scanning process are briefly described below:
[0054] Broadcasting process:
[0055] BLE (Bluetooth Low Energy) broadcast: BLE broadcast refers to electronic devices periodically sending broadcast packets so that other electronic devices can receive and parse these broadcast packets within their range. BLE broadcast is used for the discovery and quick connection of electronic devices.
[0056] Advertising Interval: The time interval between two consecutive advertising packets. When the advertising interval is short, the speed of device discovery increases, but it also increases power consumption. When the advertising interval is long, power consumption can be saved, but the discovery speed will slow down.
[0057] Advertising Type: Advertising types include different types, for example, advertising types include connectable advertising (used to connect devices), non-connectable advertising (only broadcasting information but not connecting other devices), etc.
[0058] Advertising Data: Advertising data includes device identification information, manufacturer-defined data, etc. These data will be used by other devices to identify the broadcasting device.
[0059] Scanning process:
[0060] BLE scanning: BLE scanning is the process by which an electronic device searches for nearby broadcasting electronic devices and detects their broadcast packets. Scanning can be used to discover nearby BLE devices and establish connections.
[0061] The principle of BLE scanning: The scanning device will periodically monitor the advertising channel to listen for advertising packets from nearby devices. Advertising packets will contain unique identifiers of the devices, which can be used to uniquely identify the devices.
[0062] Scan Window: The scan window is the time during the scan cycle that the scanning device actually monitors the broadcast channel. When the scan window is longer, the broadcast packet can be better detected, but the power consumption will also increase. When the scan window is shorter, the power consumption will be reduced, but it will be difficult to detect the broadcast packet better.
[0063] Scan Interval: The scan interval is the time interval between two scans. When the scan interval is short, the scan frequency can be increased, but the power consumption will increase. When the scan interval is long, the power consumption will be reduced, but the scanning efficiency will be reduced.
[0064] Scan Type: Scan types include active scanning and passive scanning. Active scanning sends requests to obtain more information about the device, while passive scanning only listens to broadcast packets.
[0065] In the related art, the parameters used in the broadcast process and the scanning process are fixed. Based on the fixed parameters, the scanning device continuously monitors the broadcast channel and identifies the identification information in the broadcast packet to determine the nearby devices, which makes it difficult to balance the performance and functions of the electronic device. In view of the problems in the related art, the embodiments of the present disclosure provide a solution for dynamically adjusting the parameters used in the self-organizing network process, thereby achieving a balance between the performance and power consumption of the electronic device.
[0066] In the process of self-organizing network, multiple electronic devices are involved, for example, two, three or more electronic devices may be used to form a self-organizing network. The electronic devices may be mobile phones, tablet computers, laptop computers, Bluetooth headsets, vehicle terminals, smart home devices, etc. The following takes the self-organizing network of the first device and the second device as an example to illustrate the self-organizing network process.
[0067] Figure 1 is a flowchart of a device networking method according to an exemplary embodiment, which is executed by a first device, see Figure 1 , the method comprises the following steps:
[0068] Step S101: Acquire event information of a first device, where the event information is used to represent a state of an event related to device networking.
[0069] Among them, events related to device networking include device screen on / off events, user login events, Bluetooth events, WiFi events, and other events. Different events have different states. For example, the states of device screen on / off events include screen on state and screen off state, the states of user login events include login state and non-logged in state, the states of Bluetooth events include Bluetooth on state and Bluetooth off state, and the states of WiFi events include WiFi on state and WiFi off state. These events and their states are closely related to device networking. For example, when Bluetooth is on, a Bluetooth connection can be established during networking, but when Bluetooth is not on, a Bluetooth connection cannot be established during networking.
[0070] Step S102: Acquire first configuration information matching the event information, where the first configuration information is used to represent parameters used when the first device is networked with other electronic devices.
[0071] In the disclosed embodiment, the event information of the first device is different, and the connection mode of the first device when networking with other electronic devices may be different, or the requirements for the connection speed when establishing the connection may be different. That is to say, under different event information, the first device may be more inclined to improve performance when networking, or it may be more inclined to save power consumption. Therefore, fixed configuration information is not used, but first configuration information matching the event information is obtained. The first configuration information is customized for the event information and can meet the performance and power consumption requirements under the event information. For multiple different event information, each event information has matching configuration information, and the same configuration information can match at least one event information.
[0072] The first configuration information may include broadcast parameters and scan parameters, the broadcast parameters may include broadcast interval, broadcast type and broadcast data, and the scan parameters may include scan window, scan interval and scan type. Optionally, the broadcast parameters may include BLE broadcast parameters and mDNS (Multicast Domain Name System) broadcast parameters, and the scan parameters may include BLE scan parameters and mDNS scan parameters.
[0073] Step S103: Networking with the second device based on the first configuration information.
[0074] After the first configuration information is determined, a network may be formed with a second device based on the first configuration information. The second device is any electronic device among a plurality of electronic devices that may be networked with the first device.
[0075] The method provided by the embodiment of the present disclosure obtains event information of a first device, the event information is used to characterize the state of events related to device networking; obtains first configuration information matching the event information, the first configuration information is used to characterize the parameters used when the first device is networked with other electronic devices; and networks with a second device based on the first configuration information. The configuration information used in this method matches the event information, rather than using fixed configuration information. Therefore, the configuration information used in device networking can be dynamically adjusted according to the state of events related to device networking, thereby meeting the requirements of low power consumption and high performance, and achieving a balance between the performance and power consumption of electronic devices.
[0076] In order to achieve dynamic adjustment, the embodiment of the present disclosure adopts Figure 2 The device networking framework shown in Figure 2 The electronic device includes a networking interface layer, a networking control module, an event detection module, a networking executor, a networking scheduling configuration module, and a cloud configuration update module, wherein the networking executor includes a first executor and a second executor, the first executor includes a first scheduler and a first worker, and the second executor includes a second scheduler and a second worker. The electronic device also includes a first preset module and a second preset module. Optionally, the first executor may be a BLE executor, the first preset module may be a BLE module, the second executor may be an mDNS executor, and the second preset module may be an mDNS module.
[0077] Among them, the networking interface layer is connected to the networking control module, the networking control module is connected to the event detection module and the networking executor, the networking executor is connected to the networking scheduling configuration module, and the networking scheduling configuration module is connected to the cloud configuration update module.
[0078] The networking interface layer is used to provide an interface for networking; the networking control module is used to control the networking process; the event detection module is used to detect whether the event and the status of the event have changed; the networking executor is used to obtain configuration information from the networking scheduling configuration module, and send the obtained configuration information to the corresponding preset module so that the preset module executes the corresponding networking process; the networking scheduling configuration module is used to configure the configuration information corresponding to different event information; the cloud configuration update module is used to update the configuration file, which includes the configuration information corresponding to different event information.
[0079] In some embodiments, the networking interface layer further includes a networking policy control module, which is used to configure a control policy in the networking process. The networking policy control module can be pre-configured or user-defined.
[0080] Combine the following Figure 2 As shown in the block diagram, Figure 3 The embodiment shown illustrates the device networking process:
[0081] Figure 3 is a flowchart of another device networking method according to an exemplary embodiment, which is executed by a first device, see Figure 3 , the method comprises the following steps:
[0082] Step S301, detecting events related to device networking, and collecting event information when the state of the event changes.
[0083] The event information includes at least one of the following: screen on / off status information; user login status information; Bluetooth switch status information; WiFi switch status information.
[0084] In the embodiment of the present disclosure, in order to dynamically adjust the configuration information used in device networking according to the status of events related to device networking, it is necessary to detect events related to device networking in real time during the networking process. If the status of the event remains unchanged, the current configuration information is used to continue networking. If the status of the event changes, it means that the configuration information may need to be changed. Therefore, when the status of the event changes, the event information is collected, and then the matching configuration information can be obtained based on the latest collected event information.
[0085] In some embodiments, in response to starting the networking control module, an event related to device networking is detected through an event detection module, and whether the status of the event has changed is identified through the event detection module. When the status of the event changes, event information is collected, and when the status of the event does not change, event information is not collected.
[0086] Optionally, collecting event information includes: reporting current event information to the networking control module through the event detection module.
[0087] Step S302: obtaining first configuration information matching the event information from the networking scheduling configuration module through the networking executor.
[0088] In some embodiments, the networking executor includes a first executor and a second executor, the first executor is used to obtain parameters related to the first communication connection, and the second executor is used to obtain parameters related to the second communication connection, for example, the first executor is a BLE executor, and the second executor is an mDNS executor. The first configuration information matching the event information is obtained from the networking scheduling configuration module through the networking executor, including: determining a target executor matching the event information, the target executor including at least one of the first executor and the second executor; obtaining the first configuration information matching the event information from the networking scheduling configuration module through the target executor.
[0089] That is, based on the event information, the communication connection that can be established is determined. If it is determined based on the event information that a first communication connection can be established, it is determined that the target executor includes the first executor; if it is determined based on the event information that a second communication connection can be established, it is determined that the target executor includes the second executor; if the first communication connection and the second communication connection are determined based on the event information, it is determined that the target executor includes the first executor and the second executor.
[0090] When the target executor includes a first executor, the first configuration information is obtained from the networking scheduling configuration module through the first executor. In this case, the first configuration information is used to represent the parameters used when the first device establishes a first communication connection with other electronic devices; when the target executor includes a second executor, the first configuration information is obtained from the networking scheduling configuration module through the second executor. In this case, the first configuration information is used to represent the parameters used when the first device establishes a second communication connection with other electronic devices; when the target executor includes a first executor and a second executor, the first configuration information is obtained from the networking scheduling configuration module through the first executor and the second executor. In this case, the first configuration information is used to represent the parameters used when the first device establishes a first communication connection with other electronic devices and the parameters used when establishing a second communication connection.
[0091] Optionally, the networking executor includes a scheduler and a worker, the first executor includes a first scheduler and a first worker, the second executor includes a second scheduler and a second worker, and the target executor obtains first configuration information matching the event information from the networking scheduling configuration module, including: obtaining first configuration information matching the event information from the networking scheduling configuration module through the target scheduler. The target scheduler includes at least one of the first scheduler and the second scheduler.
[0092] Optionally, a target executor matching the event information is determined through a networking control module.
[0093] In some embodiments, the latest configuration information is obtained from the cloud through the networking scheduling configuration module, thereby ensuring that the first configuration information obtained from the networking scheduling configuration module is the latest configuration information. Optionally, the latest configuration information is obtained from the cloud through the cloud configuration update module, and then the latest configuration information is obtained from the cloud configuration update module through the networking scheduling configuration module.
[0094] In addition, in some embodiments, when obtaining configuration information, the preset duration and priority corresponding to the configuration information are also obtained. The preset duration is the duration of networking based on the configuration information. With respect to the priority, the first device may obtain multiple configuration information based on different event information. When there are multiple configuration information, the configuration information with the highest priority is selected as the configuration information used for networking.
[0095] In some embodiments, the configuration information also has corresponding platform information, device type information, and device model information. When the platform of the first device satisfies the platform information, the device type of the first device satisfies the device type information, and the device model of the first device satisfies the device model information, it is determined that the first configuration information can be obtained. Among them, the platform information is used to characterize the platform on which the configuration information can be used, for example, the platform can be an operating system such as Android and iOS; the device type information is used to characterize the device type of the electronic device that can use the configuration information, for example, the device type can be a mobile phone, a tablet computer, etc.; the device signal information is used to characterize the device model of the electronic device that can use the configuration information.
[0096] It should be noted that the configuration information in the embodiments of the present disclosure may be directly parameters related to the communication connection, or may be a pre-configured execution action, which includes parameters related to the communication connection.
[0097] In addition, in some embodiments, an inheritance relationship may be configured in the configuration information, and a parent (root) may be specified to reduce the configuration complexity of the configuration information.
[0098] Step S303: determine the target configuration information based on the first priority and the second priority, where the target configuration information is the first configuration information or the second configuration information, the first priority is the priority of the first configuration information, and the second priority is the priority of the second configuration information currently used by the first device.
[0099] In the embodiment of the present disclosure, the first device currently uses the second configuration information for networking. When the status of the event changes during the networking process, after obtaining the first configuration information, it is necessary to determine whether to continue using the second configuration information or use the first configuration information based on the priority of the first configuration information and the second configuration information.
[0100] When the first priority is higher than the second priority, the target configuration information is determined to be the first configuration information; when the second priority is higher than the first priority, the target configuration information is determined to be the second configuration information.
[0101] In some embodiments, the target configuration information is determined by the scheduler based on the first priority and the second priority.
[0102] Step S304: Networking with the second device based on the target configuration information.
[0103] After the target configuration information is determined, the network can be formed with the second device based on the target configuration information. When the target configuration information is the first configuration information, the process of forming a network based on the second configuration information is interrupted, and the network is formed with the second device again based on the first configuration information. When the target configuration information is the second configuration information, the network is continued to be formed with the second device based on the second configuration information.
[0104] In some embodiments, the target configuration information is sent to the preset module through the worker; and the preset module is networked with the second device based on the target configuration information. The preset module may be a Bluetooth module, a local area network module, or other module for establishing a communication connection. Optionally, when the target configuration information is obtained through the first scheduler, the target configuration information is sent to the first preset module through the first worker, and the network is networked with the second device based on the target configuration information through the first preset module; when the target configuration information is obtained through the second scheduler, the target configuration information is sent to the second preset module through the second worker, and the network is networked with the second device based on the target configuration information based on the second preset module.
[0105] In some embodiments, within the preset duration corresponding to the target configuration information, networking is performed with the second device based on the target configuration information. When the preset duration ends, if networking is not completed, networking is performed with the second device based on configuration information with a lower priority.
[0106] In some embodiments, the target configuration information includes a first broadcast parameter and a first scanning parameter related to establishing a first communication connection, and a second broadcast parameter and a second scanning parameter related to establishing a second communication connection; networking with the second device based on the target configuration information includes: based on the target configuration information, sending broadcast information, the broadcast information includes at least the device identification, account, service information, Internet Protocol (IP) address and port information of the first device; based on the broadcast information, establishing a first communication connection and a second communication connection with the second device.
[0107] In other embodiments, the target configuration information includes a first broadcast parameter and a first scanning parameter related to establishing a first communication connection; networking with the second device based on the target configuration information includes: sending broadcast information based on the target configuration information, the broadcast information including at least a device identification, account number and service information of the first device; and establishing a first communication connection with the second device based on the broadcast information.
[0108] In other embodiments, the target configuration information includes a second broadcast parameter and a second scan parameter related to establishing a second communication connection; networking with the second device based on the target configuration information includes: based on the target configuration information, sending broadcast information, the broadcast information includes at least the device identification, account, service information, Internet Protocol address and port information of the first device; based on the broadcast information, establishing a second communication connection with the second device.
[0109] The first communication connection may be a BLE connection, and the second communication connection may be a local area network connection.
[0110] The method provided by the embodiment of the present disclosure uses configuration information that matches event information instead of fixed configuration information. Therefore, the configuration information used in device networking can be dynamically adjusted according to the state of events related to device networking, thereby meeting the requirements of low power consumption and high performance, and achieving a balance between the performance and power consumption of electronic devices. In addition, in this way, various scheduling strategies for services in different scenarios and different devices can be met. For example, powered devices can be more performance-oriented.
[0111] In some embodiments, the low power consumption feature of BLE is fully utilized, and BLE is used to assist in LAN networking. For example, when the device screen is off, the BLE broadcast carries the device ID, account ID, IP address, port information and other information of the first device. When the second device scans the BLE broadcast, it extracts the IP address and port information of the first device, and then the first device and the second device establish a LAN connection to complete the networking, thereby realizing device networking in the device screen off state. When the device screen is on, the BLE broadcast may also carry the IP address and port information. When the second device and the first device are in the same LAN, the first device and the second device can establish a LAN connection, thereby realizing BLE networking on the LAN link. This method supports LAN networking of screen-off devices with low power consumption when the device screen is off, and supports networking support for screen-off devices in device interconnection scenarios to meet some requirements when the device screen is off, such as accessing files of the screen-off device, or other interactions with the screen-off device. The following is through Figure 4 The embodiment shown illustrates the BLE-assisted LAN networking process:
[0112] Figure 4 is a flowchart showing a device networking process according to an exemplary embodiment, see Figure 4 , performed by the first device and the second device, the method comprises the following steps:
[0113] Step S401: The first device sends BLE broadcast information based on the target configuration information. The BLE broadcast information includes the device identification, account number, service information, IP address and port information of the first device.
[0114] The target configuration information includes a broadcast interval, a broadcast type, and broadcast data. The first device can periodically send BLE broadcast information based on the target configuration information.
[0115] Step S402: The second device receives BLE broadcast information and performs BLE scanning.
[0116] When performing BLE scanning, it is determined whether the first device and the second device can form an ad hoc network. If so, step S403 is executed, otherwise the process ends.
[0117] In some embodiments, the same account device self-organizing network technology is used. The same account device self-organizing network technology is a technology that uses the same account information of the user on different devices to automatically form a network between these devices. Therefore, for the second device, the second device identifies the BLE broadcast information sent by other devices with the same account as the second device from the received BLE broadcast information.
[0118] Step S403: The second device establishes a LAN connection with the first device according to the IP address and port information, and / or the second device establishes a BLE connection with the first device according to the device identification, account, and service information.
[0119] In the disclosed embodiment, LAN networking and BLE networking are implemented simultaneously.
[0120] Step S404: The first device performs identity authentication with the second device.
[0121] After establishing the connection, the first device and the second device can use digital certificates to perform identity authentication to ensure the legitimacy of the connection. In addition, identity authentication can prevent malicious devices from joining the self-organizing network of the first device and the second device, thereby ensuring the security of data exchange.
[0122] Step S405: The first device exchanges device information with the second device.
[0123] After the connection is established and the identity authentication is completed, the first device and the second device can exchange information with each other, for example, they can exchange device types, functions supported by the devices, device status, etc., so as to coordinate the cooperation between the first device and the second device and share resources and data.
[0124] Step S406: The first device is disconnected from the second device and resources are released.
[0125] After the collaboration between the first device and the second device ends, the BLE connection and / or the local area network connection may be disconnected, thereby releasing resources and saving power consumption.
[0126] In some embodiments, the first device or the second device may send a specific instruction to the other end to notify the other end to disconnect.
[0127] In the method provided by the embodiment of the present disclosure, the BLE broadcast includes information for establishing a BLE connection and information for establishing a local area network connection. Since the overhead and success rate caused by the BLE connection are lower than those of the local area network connection, if the local area network connection is available, the BLE connection is replaced by the local area network connection, which can reduce the BLE resource overhead and improve the success rate and performance of the BLE network. In addition, by carrying the IP address and port information in the BLE broadcast information, combining the respective characteristics of the BLE network and the local area network, adjusting the original connection method (i.e., the method of establishing a BLE connection through the BLE broadcast information), the networking of the device in the off-screen state is achieved, the overhead of the BLE link is reduced, and the performance and success rate of the BLE network are improved.
[0128] Figure 5 is a block diagram of an apparatus for processing executable code according to an exemplary embodiment, which is configured in a first device, see Figure 5 , the device comprises:
[0129] An event information acquisition module 501 is configured to acquire event information of a first device, where the event information is used to represent a state of an event related to device networking;
[0130] The configuration information acquisition module 502 is configured to acquire first configuration information matching the event information, where the first configuration information is used to represent parameters used when the first device is networked with other electronic devices;
[0131] The networking module 503 is configured to establish a network with the second device based on the first configuration information.
[0132] In some embodiments, the event information acquisition module 501 is configured to:
[0133] Detecting events related to device networking;
[0134] When the status of an event changes, event information is collected.
[0135] In some embodiments, the event information includes at least one of the following: screen on / off status information; user login status information; Bluetooth switch status information; WiFi switch status information.
[0136] In some embodiments, the configuration information acquisition module 502 includes a networking executor;
[0137] The networking executor is configured to obtain first configuration information matching the event information from the networking scheduling configuration module.
[0138] In some embodiments, the networking executor includes a first executor and a second executor, the first executor is used to obtain parameters related to the first communication connection, and the second executor is used to obtain parameters related to the second communication connection; the networking executor is configured to:
[0139] Determine a target executor matching the event information, the target executor including at least one of a first executor and a second executor;
[0140] The first configuration information matching the event information is obtained from the networking scheduling configuration module through the target executor.
[0141] In some embodiments, the apparatus further comprises:
[0142] The networking scheduling configuration module is configured to obtain the latest configuration information from the cloud.
[0143] In some embodiments, the networking module 503 is configured to:
[0144] Determine target configuration information based on the first priority and the second priority, where the target configuration information is the first configuration information or the second configuration information, the first priority is the priority of the first configuration information, and the second priority is the priority of the second configuration information currently used by the first device;
[0145] A network is established with the second device based on the target configuration information.
[0146] In some embodiments, the target configuration information includes a first broadcast parameter and a first scanning parameter associated with establishing a first communication connection, and a second broadcast parameter and a second scanning parameter associated with establishing a second communication connection; the networking module 503 is configured to:
[0147] Based on the target configuration information, sending broadcast information, the broadcast information at least including a device identifier, an account number, service information, an Internet Protocol address, and port information of the first device;
[0148] Based on the broadcast information, a first communication connection and / or a second communication connection is established with the second device.
[0149] In some embodiments, the networking module 503 is configured to:
[0150] Within the preset duration corresponding to the target configuration information, networking is performed with the second device based on the target configuration information.
[0151] In some embodiments, the networking executor includes a scheduler and a worker;
[0152] A scheduler configured to determine target configuration information based on the first priority and the second priority;
[0153] A worker, configured to send target configuration information to a preset module;
[0154] The preset module is configured to establish a network with the second device based on the target configuration information.
[0155] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0156] An embodiment of the present disclosure further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the device networking method in the above embodiment.
[0157] Figure 6 is a block diagram of an electronic device 600 according to an exemplary embodiment.
[0158] Reference Figure 6 , the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .
[0159] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0160] The memory 604 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0161] The power supply component 606 provides power to the various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.
[0162] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0163] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.
[0164] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0165] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the electronic device 600, the relative positioning of the components, such as the display and keypad of the electronic device 600, and the sensor assembly 614 can also detect the position change of the electronic device 600 or a component of the electronic device 600, the presence or absence of contact between the user and the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and the temperature change of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0166] The communication component 616 is configured to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0167] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0168] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by a processor 620 of an electronic device 600 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0169] The embodiments of the present disclosure also provide a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the device networking method in the above embodiments.
[0170] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0171] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A device networking method, applied to a first device, characterized in that: The method comprises: Acquire event information of the first device, where the event information is used to represent a state of an event related to device networking; Acquire first configuration information matching the event information, where the first configuration information is used to represent parameters used when the first device is networked with other electronic devices; Establishing a network with a second device based on the first configuration information.
2. The method according to claim 1, characterized in that The acquiring event information of the first device includes: Detecting events related to device networking; When the state of the event changes, the event information is collected.
3. The method according to claim 2, characterized in that The event information includes at least one of the following: screen on / off status information; user login status information; Bluetooth switch status information; WiFi switch status information.
4. The method according to claim 1, characterized in that: The acquiring first configuration information matching the event information includes: The first configuration information matching the event information is obtained from the networking scheduling configuration module through the networking executor.
5. The method according to claim 4, characterized in that The networking executor includes a first executor and a second executor, the first executor is used to obtain parameters related to the first communication connection, and the second executor is used to obtain parameters related to the second communication connection; The acquiring, through the networking executor, the first configuration information matching the event information from the networking scheduling configuration module includes: Determine a target executor matching the event information, the target executor including at least one of the first executor and the second executor; The target executor obtains first configuration information matching the event information from the networking scheduling configuration module.
6. The method according to claim 4 or 5, characterized in that: The method further comprises: The latest configuration information is obtained from the cloud through the networking scheduling configuration module.
7. The method according to claim 1, characterized in that The networking with the second device based on the first configuration information includes: Determine target configuration information based on a first priority and a second priority, where the target configuration information is the first configuration information or the second configuration information, the first priority is a priority of the first configuration information, and the second priority is a priority of the second configuration information currently used by the first device; A network is established with the second device based on the target configuration information.
8. The method according to claim 7, characterized in that The target configuration information includes a first broadcast parameter and a first scan parameter related to establishing a first communication connection, and a second broadcast parameter and a second scan parameter related to establishing a second communication connection; and the networking with the second device based on the target configuration information includes: Based on the target configuration information, sending broadcast information, the broadcast information at least including a device identification, an account number, service information, an Internet Protocol address, and port information of the first device; Based on the broadcast information, a first communication connection and / or a second communication connection is established with the second device.
9. The method according to claim 7, characterized in that: The networking with the second device based on the target configuration information includes: Within the preset duration corresponding to the target configuration information, networking is performed with the second device based on the target configuration information.
10. The method according to claim 7, characterized in that The networking executor includes a scheduler and a worker, and the determining of the target configuration information based on the first priority and the second priority includes: Determining, by the scheduler, the target configuration information based on the first priority and the second priority; The networking with the second device based on the target configuration information includes: Sending the target configuration information to a preset module through the worker; Through the preset module, networking is performed with the second device based on the target configuration information.
11. A device networking apparatus, characterized in that: Configured in a first device, the apparatus comprises: an event information acquisition module, configured to acquire event information of the first device, wherein the event information is used to represent a state of an event related to device networking; a configuration information acquisition module, configured to acquire first configuration information matching the event information, wherein the first configuration information is used to represent parameters used when the first device is networked with other electronic devices; The networking module is configured to establish a network with the second device based on the first configuration information.
12. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 10.
13. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as claimed in any one of claims 1 to 10.