Intelligent device switching connection method and device
By switching the connection method of smart devices and flexibly migrating smart devices according to the load pressure and rental resource consumption of the cloud server, the problem of high dependence on third-party servers and low resource utilization in smart homes is solved, and efficient use of resources is achieved. and cost savings.
Patent Information
- Application Number
- CN202411008379.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-26
AI Technical Summary
Smart homes have fixed cloud server endpoints when they leave the factory, causing their communication to rely too much on third-party servers, resulting in low resource utilization and high costs.
By switching the connection method through smart devices, smart devices can be flexibly migrated to different cloud servers according to the load pressure and rental resource consumption of the cloud server, reducing dependence on third-party servers, improving resource utilization and saving service costs.
It enables flexible switching of smart devices between cloud servers, improves resource utilization and user experience, and reduces service costs.
Smart Images

Figure CN118555303B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of wireless communication networks, and in particular to a method and apparatus for switching connections of smart devices. Background Art
[0002] With the development of the Internet and cloud computing, cloud servers, as a virtualization technology, aggregate the resources of multiple physical servers to form a computing resource pool, providing elastic, scalable and on-demand computing services, making the use of cloud servers in smart homes increasingly important. Smart homes usually connect to the corresponding cloud servers based on the cloud server endpoints to report device status and receive control instructions from the cloud servers.
[0003] At present, smart homes have been set up with cloud server endpoints by cloud server manufacturers when they leave the factory. The cloud server endpoint cannot be changed, and smart homes can only be connected to specific cloud servers (also called third-party cloud servers). The communication of smart homes is too dependent on third-party servers, resulting in inefficient use of resources and high costs. Summary of the invention
[0004] The present application proposes a method and apparatus for switching connections of smart devices, which can flexibly migrate the cloud servers to which smart devices are connected according to the load pressure of the cloud servers and the actual rental resource consumption, thereby reducing the dependence between smart homes and third-party servers, improving resource utilization, and saving service costs.
[0005] In a first aspect, an embodiment of the present application provides a method for switching connection of a smart device, which is applied to a server of a connection system, wherein the connection system includes an application server and a smart device, wherein the application server and the smart device are in communication connection, and the method includes:
[0006] Acquire a device serial number and first information from a smart device, where the first information is information obtained by encrypting the device serial number by the smart device;
[0007] determining whether the identity of the smart device is correct based on an activation program, the device serial number and the first information, the activation program being used to decrypt the first information;
[0008] If the identity of the smart device is correct, determining a first target cloud server based on a total load and a cumulative number of connections of at least one cloud server;
[0009] Connecting the first target cloud server to the smart device;
[0010] periodically determining whether the first target cloud server satisfies a first switching condition, where the first switching condition is used to indicate that a preset rental resource consumption of the first target cloud server is higher than a preset rental resource consumption;
[0011] If the first target cloud server meets the first switching condition, disconnecting the connection between the first target cloud server and the smart device;
[0012] The smart device is connected to a second target cloud server, so that the smart device switches to connect to the at least one cloud server.
[0013] In a second aspect, an embodiment of the present application provides a smart device switching connection device, which is applied to an application server of a connection system, wherein the connection system includes an application server and a smart device, wherein the application server and the smart device are communicatively connected, and the device includes:
[0014] A first acquisition unit, configured to acquire a device serial number and first information from a smart device, where the first information is information obtained by encrypting the device serial number by the smart device;
[0015] a first determining unit, configured to determine whether the identity of the smart device is correct based on an activation program, the device serial number, and the first information, wherein the activation program is used to decrypt the first information;
[0016] A second determination unit, configured to determine a first target cloud server based on a total load and a cumulative number of connections of at least one cloud server if the identity of the smart device is correct;
[0017] A first connecting unit, configured to connect the first target cloud server to the smart device;
[0018] a third determining unit, configured to periodically determine whether the first target cloud server satisfies a first switching condition, wherein the first switching condition is used to indicate that a preset rental resource consumption of the first target cloud server is higher than a preset rental resource consumption;
[0019] a disconnection unit, configured to disconnect the connection between the first target cloud server and the smart device if the first target cloud server meets the first switching condition;
[0020] The second connecting unit is used to connect the smart device to a second target cloud server, so that the smart device switches to connect to the at least one cloud server.
[0021] In a third aspect, an embodiment of the present application provides a server, comprising a processor, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for executing the steps in the method described above.
[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the method described above.
[0023] It can be seen that in this example, the application server can realize the communication between the smart home and the cloud platform with the help of the gateway device. Compared with the existing application server that only communicates with a fixed single server in the cloud platform to realize the mechanism of transmitting and processing the data of the server and the smart device, the application server of this application can also flexibly switch the server in the same cloud platform or switch the server of different cloud platforms based on the load pressure and rental resource consumption of each server in the cloud platform. Specifically, the application server first obtains the device serial number and the first information from the smart device; then determines whether the identity of the smart device is correct based on the activation program, the device serial number and the first information; if the identity of the smart device is correct, determines the first target cloud server based on the total load and cumulative connection volume of at least one cloud server; then connects the first target cloud server to the smart device; then periodically determines whether the first target cloud server meets the first switching condition; if the first target cloud server meets the first switching condition, disconnects the connection between the first target cloud server and the smart device; finally connects the smart device to the second target cloud server, so that the smart device switches to connect to at least one cloud server.
[0024] In this way, the application server confirms whether the identity of the smart device is legitimate based on the device serial number, the encrypted first information, and the activation program, and then selects the target cloud server according to the total load and the cumulative number of connections, and finally switches the connection between the smart device and the target cloud server according to the rental resource consumption. In this way, this solution can flexibly migrate the cloud server to which the smart device is connected according to the load pressure of the cloud server and the actual rental resource consumption, reduce the dependence between the smart home and the third-party server, improve resource utilization, and save service costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0026] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0027] Figure 2 This is another application scenario schematic diagram provided by an embodiment of the present application;
[0028] Figure 3It is a schematic diagram of the composition of a connection system provided in an embodiment of the present application;
[0029] Figure 4 It is a structural block diagram of an application server provided in an embodiment of the present application;
[0030] Figure 5 It is a flowchart of a method for switching connection of a smart device provided in an embodiment of the present application;
[0031] Figure 6 This is a schematic diagram of a process for producing a smart device provided in an embodiment of the present application;
[0032] Figure 7 This is a timing diagram of a smart device connection provided by an embodiment of the present application;
[0033] Figure 8 This is a block diagram of the functional units of a smart device switching connection device provided in an embodiment of the present application;
[0034] Fig. 9 This is a block diagram of the functional units of another smart device switching connection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0037] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0038] In the embodiments of the present application, "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent the following three situations: A exists alone; A and B exist at the same time; B exists alone. Among them, A and B can be singular or plural.
[0039] In the embodiment of the present application, the symbol " / " can indicate that the objects associated with each other are in an "or" relationship. In addition, the symbol " / " can also indicate a division sign, that is, performing a division operation. For example, A / B can indicate A divided by B.
[0040] In the embodiments of the present application, "equal to" can be used in conjunction with greater than, and is applicable to the technical solution adopted when greater than, and can also be used in conjunction with less than, and is applicable to the technical solution adopted when less than. When equal to is used in conjunction with greater than, it is not used in conjunction with less than; when equal to is used in conjunction with less than, it is not used in conjunction with greater than.
[0041] At present, smart homes have been set up with cloud server endpoints by cloud server manufacturers when they leave the factory. The cloud server endpoint cannot be changed, and smart homes can only be connected to specific cloud servers (also called third-party cloud servers). The communication of smart homes is too dependent on third-party servers, resulting in inefficient use of resources and high costs.
[0042] In response to the above problems, an embodiment of the present application provides a method and apparatus for switching connections of a smart device. The embodiment of the present application is described in detail below in conjunction with the accompanying drawings.
[0043] See also Figure 1 , Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1As shown, in this application scenario, an IoT home appliance 101, a control device 102, a router 103, a cloud server 104, and a mobile terminal 105 may be included, wherein the control device 102 is connected to the router 103, and the control device 102 is connected to the IoT home appliance 101; the mobile terminal 105 is connected to the router 103. The control device, the router, the cloud server, and the mobile terminal adopt a wireless transmission method, and the premise of stimulating the wireless transmission channel is that the control device is first connected to the router, that is, the control device performs network configuration, and the control device obtains the service set identifier (SSID) and connection password of the router by certain means, and connects to the router according to the SSID and the connection password, and the mobile terminal 105 is connected to the router 103. After the control device is successfully connected to the router, the control device will report information including the Media Access Control Address (MAC) of the control device and the connected IoT home appliance 101 to the cloud server 104 through the network. The cloud server 104 will establish a binding relationship between "control device 102-cloud server 104-mobile terminal 105", that is, a one-to-one communication relationship is established between the mobile terminal 105 and the control device 102. Therefore, the mobile terminal 105 can send a control instruction to control the IoT home appliance 101 to the control device 102 through the cloud server 104, and the control device 102 controls the IoT home appliance 101 after receiving the control instruction. In particular, the control device can be part of a smart home appliance, which can be connected to the router through the control device and communicate with the mobile terminal through the cloud server.
[0044] See also Figure 2 , Figure 2 This is another application scenario diagram provided by the embodiment of the present application. Figure 2As shown, in this application scenario, an IoT home appliance 101, a smart terminal 202, an application server 203, an MQTT server 204, and a router 103 may be included. The IoT home appliance 101 may include a main control board, a display screen, a Wi-Fi indicator light, a Bluetooth module, and a Wi-Fi module; in the IoT home appliance 101, the display screen is connected to the main control board and the Wi-Fi indicator light respectively, the Bluetooth module is connected to the main control board, and the Bluetooth module is also connected to the smart terminal through Bluetooth communication control network distribution, and the Wi-Fi module is connected to the main control board through a serial port, so that the IoT home appliance 101 is connected to the smart terminal 202 for communication; the smart terminal 202 and the application server 203 are connected in a two-way communication manner for obtaining and controlling the state of the IoT home appliance, and the application server 203 and the MQTT server 204 are connected in a two-way communication manner for transmitting the state data of the IoT home appliance; the router 103 is connected in a communication manner with the MQTT server 204 for reporting the state of the IoT home appliance to the MQTT server; the IoT home appliance 101 is connected to the router 103 for communicating with the MQTT server through the router.
[0045] See also Figure 3 , Figure 3 Schematic diagram of a connection system provided in an embodiment of the present application. Figure 3 As shown, the connection system 30 may include an application server 203 and a smart device 302, the application server 203 and the smart device 302 are in communication connection, and the application server 203 may be Figure 1 The control device 102 in the embodiment of the present invention may be a smart device. Figure 1 and / or Figure 2 In the IoT home appliance device 101, the application server can be used to send or receive data with the smart device, and can also be used to process the data of the cloud server to switch the cloud server to which the smart device is connected. In particular, the application server can be a part of the smart device.
[0046] See also Figure 4 , Figure 4 is a structural block diagram of an application server provided in an embodiment of the present application. Figure 4As shown, the application server 203 may include one or more of the following components: a processor 401, a memory 402, a communication interface 403, and one or more programs 404, wherein the one or more programs 404 are stored in the memory 402 and configured to be executed by the processor, and the one or more programs 404 include functions for executing any of the steps in the following schemes. In a specific implementation, the processor 401 is used to execute any of the steps executed by the electronic device in the following method embodiment, and when performing data transmission such as sending, the communication interface 403 may be selectively called to complete the corresponding operation. The application server 203 may specifically be a server, or a server cluster composed of several servers, or a cloud computing service center. Among them, the processor 401 may include one or more processing cores. The processor 401 uses various interfaces and lines to connect various parts within the entire application server 203, and executes various functions and processes data of the application server 203 by running or executing instructions, programs, code sets or instruction sets stored in the memory 402, and calling data stored in the memory 402. Optionally, the processor 401 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 401 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 401, but may be implemented separately through a communication chip. Among them, the memory 402 may include a random access memory (RAM) or a read-only memory (ROM). The memory 402 can be used to store instructions, programs, codes, code sets, or instruction sets. The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the application server 203 during use, etc.It is understandable that the application server 203 may include more or fewer structural elements than those in the above structural block diagram, which is not limited here.
[0047] The following describes a method for switching connections of a smart device provided in an embodiment of the present application.
[0048] Please participate Figure 5 , Figure 5 1 is a flow chart of a method for switching connection of a smart device provided in an embodiment of the present application. Figure 1 The control devices shown, such as Figure 2 shown, Figure 3 Shown and / or Figure 4 In the application server shown in Figure 5 As shown, the smart device switching connection method includes:
[0049] S501, obtaining a device serial number and first information from a smart device.
[0050] The first information is information obtained by encrypting the device serial number by the smart device.
[0051] Among them, the smart device can be a smart home, such as a smart sofa, a smart washing machine, or a smart doorbell, etc. The device serial number (SN) is globally unique and cannot be repeated. Each smart device has a unique SN.
[0052] Among them, the smart device serial number and the key pair consisting of a private key and a public key during the production process. Figure 6 , Figure 6 This is a schematic diagram of a process for producing a smart device provided by an embodiment of the present application. Figure 6As shown, first generate a key pair, specifically, use an asymmetric encryption algorithm to generate a key pair consisting of a public key and a private key, such as a Rivest-Shamir-Adlema (RSA) algorithm, a digital signature algorithm (DSA), or an elliptic curve cryptography (ECC) algorithm; then store the key pair, specifically, the public key and the private key can be stored in a database; then generate a device SN, specifically, a non-repeatable SN can be generated by a unique identifier, random number generation, or encoding; then store the SN, specifically, the SN can be stored in a database; then use the private key to sign the SN to obtain the SIG, specifically, use the private key to sign the SN through a signature algorithm such as SHA1WithRSA to obtain the signature information SIG, and the first information can be SIG; finally, burn the SN and SIG to the Wi-Fi module, the Wi-Fi module is a part of the smart device, the SN and SIG data are burned into the Wi-Fi module, and the Wi-Fi module firmware can read the SN and SIG.
[0053] S502: Determine whether the identity of the smart device is correct based on the activation program, the device serial number and the first information.
[0054] The activation program is used to decrypt the first information.
[0055] S503: If the identity of the smart device is correct, determine a first target cloud server based on the total load and cumulative connection volume of at least one cloud server.
[0056] S504: Connect the first target cloud server to the smart device.
[0057] The cloud server may be a Message Queuing Telemetry Transport (MQTT) cloud server, which may be used to provide support for the MQTT protocol. The MQTT protocol is a lightweight message transmission protocol, which is particularly suitable for Internet of Things (IoT) devices in low-bandwidth, unreliable network environments.
[0058] The total load may include indicators such as central processing unit (CPU) usage, memory usage, network bandwidth usage and / or current number of connections, and the total load of the cloud server may be obtained by combining the above indicators.
[0059] Among them, the cumulative number of connections can be an important indicator to characterize the carrying capacity of the cloud server, reflecting the total number of connections established by the cloud server since its startup.
[0060] S505: Periodically determine whether the first target cloud server meets a first switching condition.
[0061] S506: If the first target cloud server meets the first switching condition, disconnect the connection between the first target cloud server and the smart device.
[0062] S507: Connect the smart device to the second target cloud server, so that the smart device switches to connect to the at least one cloud server.
[0063] The first switching condition is used to indicate that the preset rental resource consumption of the first target cloud server is higher than the actual rental resource consumption. The rental resource consumption can indicate the amount of money spent on using the cloud server, and the connection between the smart device and the cloud server can be intelligently switched based on the rental resource consumption.
[0064] The frequency of periodically determining whether the first target cloud server meets the first switching condition may be one day or one week.
[0065] It can be seen that in this example, the legality of the smart device is confirmed based on the device serial number, the encrypted first information, and the activation program, and then the target cloud server is selected according to the total load and the cumulative number of connections, and finally the connection between the smart device and the target cloud server is switched according to the rental resource consumption. The cloud server to which the smart device is connected can be flexibly migrated according to the load pressure and rental resource consumption of the cloud server, reducing the dependence between the smart home and the third-party server, improving resource utilization, and saving service costs.
[0066] In a possible embodiment, the periodic determination of whether the first target cloud server satisfies the first switching condition includes: obtaining the storage amount, historical cumulative number of interactions, outbound traffic, and network load used by the smart device in the first target cloud server; calculating the storage amount, the historical cumulative number of interactions, and the outbound traffic based on preset billing rules to obtain the cumulative consumption amount; if the cumulative consumption amount is greater than a preset monthly budget, the first target cloud server satisfies the first switching condition; if the cumulative consumption amount is not greater than the budget, the first target cloud server does not satisfy the first switching condition.
[0067] The historical cumulative number of interactions may indicate the number of interactions between the smart device and the first target cloud server, the outbound traffic may indicate the amount of data that has slipped out of the cloud server, and the network load may indicate the network bandwidth usage of the cloud server. For example, the storage capacity used by the smart device in the first target cloud server may be 500 Gigabytes (GB), the historical cumulative number of interactions may be 10,000, the outbound traffic may be 200 GB, and the network load may be at a normal level, without a high load.
[0068] Among them, the billing rules are generally pre-set, and the cumulative consumption amount can be the sum of the fees based on the storage volume, the historical cumulative interaction coefficient, and the outbound traffic. For example, if the storage fee is 0.1 yuan / GB / month, the storage fee for 500GB is 50 yuan; the fee for each interaction is 0.01 yuan, then the fee for 10,000 interactions is 100 yuan; the fee for outbound traffic is 0.2 yuan / GB, then the fee for 200GB of outbound traffic is 40 yuan. Adding up the above fees, the cumulative consumption amount can be obtained as 190 yuan. By periodically monitoring the storage volume, historical cumulative number of interactions, outbound traffic and network load of the smart device in the first target cloud server, and calculating the cumulative consumption amount of these resources based on the preset billing rules, the use cost of the first cloud server can be effectively evaluated.
[0069] The budget can be a monthly budget or an annual budget, which can be selected according to the user's own preferences. For example, when the budget is a monthly budget of 200 yuan, the above cumulative consumption amount is compared with the monthly budget. The cumulative consumption amount of 190 yuan is less than the monthly budget, which means that the actual rental resource consumption of the first target cloud server is within the user's acceptable range, and the user can continue to use the first target cloud server. If the cumulative consumption amount is greater than or equal to the monthly budget, it means that the actual rental resource consumption of the first target cloud server is too high, and the user can choose another cloud server as the second target cloud server.
[0070] It can be seen that in this example, the cumulative consumption amount is calculated periodically and compared with the budget. The cloud server to which the smart device is connected is flexibly migrated according to the rental resource consumption, which reduces the dependence between the smart home and the third-party cloud server, saves service costs, improves the rationality of cloud server use, improves resource utilization, and enhances user experience.
[0071] In a possible embodiment, after connecting the smart device to the second target cloud server, the method further includes: obtaining the total load and preset load of the second target cloud server; if the total load is greater than the preset load, disconnecting the connection between the second target cloud server and the smart device; and connecting the smart device to a third target cloud server.
[0072] The total load can be the actual workload of the cloud server, which can be measured from multiple dimensions, including CPU usage, memory usage, disk I / O, and network traffic. For example, if the maximum CPU usage is 100% and the current usage is 70%, the CPU load is 70%; if the total memory is 16GB and 12GB is currently used, the memory load is 75%; disk I / O can be the disk usage, and the current disk I / O load can be 80%; if the total bandwidth of the network interface is 1 gigabit per second (Gbps) and the current bandwidth is 0.6Gbps, the network load is 60%; based on the above loads, the total load can be obtained using a simple average method or a weighted average method. For example, the simple average method can calculate the total load. The average value of the load is the total load = (CPU load + memory load + disk I / O load + network load) / 4. According to the above specific values, the total load is 71.25%; the weighted average method can assign a weight to each dimension, that is, the total load = w1×CPU load + w2×memory load + w3×disk I / O load + w4×network load, w1 represents the weight of the CPU, w2 is the weight of the memory load, w3 is the weight of the disk I / O load, w4 is the weight of the network load, and w1+w2+w3+w4=1. When the total load is too high, it may cause the system to respond slowly, and in severe cases, it may cause service interruption or system crash.
[0073] The preset load may represent the maximum workload that the cloud server can bear while ensuring optimal performance. The value of the preset load may be set by the user according to his or her own preferences, or may be determined by the application server according to the hardware capabilities and performance tests of the system. When the total load of the second target cloud server is greater than the preset load, it means that the load of the second target cloud server is too high, and the user needs to select another cloud server as the third target cloud server.
[0074] It can be seen that in this example, after the cloud server is switched according to the rental resource consumption, the total load of the switched cloud server also needs to be judged, so that the cloud server can be switched again when the load is too high, saving service costs, improving the rationality of cloud server use, improving resource utilization, and improving user experience.
[0075] In a possible embodiment, if the identity of the smart device is correct, determining the first target cloud server based on the total load and cumulative load of at least one cloud server includes: obtaining the total load corresponding to each cloud server; determining a reference cloud server according to the total load corresponding to each cloud server; obtaining the upper limit number of client connections and the cumulative connection volume of each reference cloud server; and marking the reference cloud server with the smallest cumulative connection volume among the reference cloud servers whose cumulative connection volume is less than the upper limit number of client connections as the first target cloud server.
[0076] Among them, the total load of the reference cloud server is less than the preset load. The total load can be the maximum workload that the cloud server can withstand while ensuring optimal performance. The value of the preset load can be set by the user according to his or her own preferences, or it can be determined by the application server based on the hardware capabilities and performance tests of the system. The preset load can be the maximum workload that the cloud server can withstand while ensuring optimal performance. The value of the preset load can be set by the user according to his or her own preferences, or it can be determined by the application server based on the hardware capabilities and performance tests of the system. Cloud servers with a total load less than the preset load can be considered to have sufficient resources to handle the additional load, and these cloud servers can be used as reference cloud servers, which can reduce the selection range of cloud servers and speed up the determination of target cloud servers.
[0077] Among them, the client connection upper limit can be the maximum number of client connections that a single cloud server can handle simultaneously, which is determined by factors such as the configuration, resources, and network bandwidth of the cloud server. Exceeding its value may cause the cloud server performance to degrade, the response time to increase, or even service interruption. The cumulative connection volume can be the total number of client connections that have been established on the cloud server, which can reflect the current load of the cloud server. High-performance cloud servers can be screened out by the client connection upper limit and the cumulative connection volume. It should be noted that the first target cloud server can be the reference cloud server with the smallest cumulative connection volume. For example, the total load of cloud server A and cloud server B is less than the preset load, and the cumulative connection volume of cloud server A is 40, and the cumulative connection volume of cloud server B is 30, then cloud server B can be determined as the first target cloud server.
[0078] It can be seen that in this example, the first target cloud server is selected based on the total load and the cumulative number of connections, so that the first target cloud server not only has a moderate load, but also has sufficient client connection capacity to handle new connections, thereby reducing the dependence between the smart home and the third-party cloud server, ensuring the stable connection of smart devices and the reliability of services, saving service costs, improving the rationality of cloud server use, improving resource utilization, and enhancing user experience.
[0079] In a possible embodiment, connecting the first target cloud server with the smart device includes: sending the device serial number to the first target cloud server; obtaining device basic data from the first target cloud server; sending the device basic data to the smart device, so that the smart device and the first target cloud server are connected based on the device basic data and the device serial number.
[0080] The device basic data is associated with the smart device and may include things, device certificates (or account passwords), and security policies.
[0081] The application server can send the device serial number to the cloud server through a communication protocol, such as Hypertext Transfer Protocol (HTTP). After receiving the device serial number, the cloud server can verify it and generate basic device data based on the device serial number. The cloud server can send the basic device data to the application server through a communication protocol and send the basic device data to the smart device through the application server.
[0082] Among them, the device basic data can be sent to the Wi-Fi module of the smart device, and the Wi-Fi module can use the device basic data to establish a secure connection to the first target cloud server through the Transport Layer Security (TLS) protocol. This connection can realize encrypted data communication between the cloud server and the smart device.
[0083] Please refer to Figure 7 , Figure 7 This is a timing diagram of a smart device connection provided by an embodiment of the present application. Figure 7As shown, in S701, the APP sends the router SSID and connection password to the Wi-Fi module. Specifically, the APP and the Wi-Fi module are both part of a mobile terminal (e.g., a mobile phone). The APP can connect to the router through Bluetooth Low Energy (Bluetooth Low Energy). Energy, BLE) and other communication channels send the SSID and connection password to the Wi-Fi module for network configuration; S702, the Wi-Fi module is connected to the router, specifically, the Wi-Fi module is connected to the router corresponding to the SSID sent by the APP, so that the smart device can access the Internet; S703, the Wi-Fi module calls the activation service interface, specifically, calls the device activation service through an HTTPS request, and the request parameters can include the SN and SIG data burned in the Wi-Fi module; S704, the device activation service verifies the device information and decides the MQTT server endpoint used by the device. Specifically, the activation service verifies the SN and SIG through the public key. A successful verification indicates that the smart device is a legal device. The activation service can determine which MQTT cloud service the smart device is assigned to connect to through certain strategies; S705, the activation service calls to generate basic device data. Specifically, the activation service transmits the SN information to the MQ server endpoint used by the decision-making device TT cloud service, MQTT cloud service prepares the relevant foundation of the device, such as things, device certificates (or account passwords), or security policies, etc.; S706, MQTT cloud service returns the device connection certificate, specifically, returns the generated device connection certificate (or account password) to the activation service; S707, the activation service returns the connection data information, specifically, the activation service returns the device certificate (or account password) and MQTT cloud service endpoint (or account password) to the Wi-Fi module; S708, the Wi-Fi module connects to the relevant MQTT cloud service endpoint through the relevant certificate, specifically, the Wi-Fi module uses the device certificate (or account password) to securely connect to the MQTT cloud service endpoint through TLS; S709, the MQTT cloud service connection is successful, specifically, the MQTT cloud service and the Wi-Fi module are successfully connected; S710, the Wi-Fi module returns the connection to the MQTT cloud service successfully, specifically, the Wi-Fi module sends the device connection success to the APP. It should be noted that the application server in this application includes the activation service.
[0084] It can be seen that in this example, after the first target cloud server is determined, the connection between the first target cloud server and the smart device is established. The cloud server is determined before the connection communication is performed, which improves the rationality of the cloud server application, improves the resource utilization rate, and improves the user experience.
[0085] In a possible embodiment, after connecting the first target cloud server to the smart device, the method also includes: determining whether the first target cloud server meets a second switching condition; if the first target cloud server meets the second switching condition, disconnecting the connection between the first target cloud server and the smart device; and connecting the smart device to a fourth target cloud server.
[0086] The second switching condition includes at least one of the following: the response time of the first target cloud server exceeds a preset threshold; or there is data packet loss in the first target cloud server; or the first target cloud server is down.
[0087] Among them, the second switching condition may indicate that the cloud server is in an abnormal state. The response time of the first target cloud server exceeds the preset threshold, indicating that the cloud server processes the request too slowly, which may affect the data transmission efficiency and user experience; data packet loss may be that the data packet sent from the smart device to the cloud server has not arrived successfully or has not been processed correctly, which may cause the control instruction to be lost or the data transmission to be incomplete; the first target cloud server downtime may indicate that the first target cloud server has completely stopped service and cannot receive or respond to any network request, which will affect the smart devices connected to it. The response time of the first target cloud server can be detected by regularly sending requests to the cloud server and monitoring its response time; or the sending and receiving of data packets can be detected by a network monitoring tool or the smart device itself to detect whether there is data packet loss; or the reachability of the cloud server can be checked by regular Ping tests or using a dedicated monitoring service. If multiple consecutive Pings fail, the cloud server is down. When the first target cloud server meets at least one of the above conditions, it means that the performance of the first target cloud server is low, and other cloud servers can be selected as the fourth target cloud server.
[0088] It can be seen that in this example, after the smart device is connected to the first target cloud server, the status of the first target cloud server can be detected at any time. When there is an abnormality in the first target cloud server, the smart device can be migrated to other cloud servers, which further reduces the dependence between the smart home and the third-party cloud server, saves service costs, improves the rationality of cloud server use, improves resource utilization, and enhances user experience.
[0089] In a possible embodiment, the activation program includes a public key, and the public key corresponds to a private key used to encrypt the first information. The determining whether the identity of the smart device is correct based on the activation program, the device serial number and the first information includes: decrypting the first information based on the public key to obtain second information; comparing the second information with the device serial number to see if they are the same. If the second information is the same as the device serial number, the identity of the smart device is correct.
[0090] Where the public key and private key can be Figure 6 The key pair generated during the production process of the smart device shown in the figure can use the public key to decrypt the first information to obtain the second information, which can be represented by SN1. If SN1!=SN, that is, the second information is different from the device serial number, it means that the identity of the smart device is illegal, and the subsequent process can be terminated; if SN1=SN2, that is, the second information is the same as the device serial number, it means that the identity of the smart device is legal, and the subsequent process can continue.
[0091] It can be seen that in this example, during the transmission of device serial numbers and encrypted information, the identity authentication mechanism can resist potential security threats, such as man-in-the-middle attacks, data tampering, etc. It can ensure the legality of the identity of the smart device, and the cloud server does not need to authenticate the smart device when connecting, so that the smart device can quickly establish a connection with the cloud server, saving service costs, improving the rationality of cloud server use, improving resource utilization, and enhancing user experience.
[0092] It should be noted that the cloud server involved in this application can be a self-developed cloud server, so that smart devices can be freed from deep binding with third-party cloud servers, and the cloud servers to which smart devices are connected can be flexibly migrated according to the load pressure of the cloud server and the consumption of rental resources. This reduces the dependence between smart homes and third-party cloud servers, saves service costs, improves the rationality of cloud server use, improves resource utilization, and enhances user experience.
[0093] For the above embodiments, please refer to Figure 8 , Figure 8 1 is a block diagram of the functional units of a smart device switching connection device provided in an embodiment of the present application. Figure 8As shown, the intelligent device switching connection device 80 includes: a first acquisition unit 801, which is used to acquire a device serial number and a first information from the intelligent device, wherein the first information is information obtained by encrypting the device serial number by the intelligent device; a first determination unit 802, which is used to determine whether the identity of the intelligent device is correct based on an activation program, the device serial number and the first information, wherein the activation program is used to decrypt the first information; a second determination unit 803, which is used to determine a first target cloud server based on a total load and a cumulative connection amount of at least one cloud server if the identity of the intelligent device is correct; a first connection unit 804, which is used to connect the first target cloud server to the intelligent device; a third determination unit 805, which is used to periodically determine whether the first target cloud server meets a first switching condition, wherein the first switching condition is used to indicate that the actual rental resource consumption of the first target cloud server is higher than a preset rental resource consumption; a disconnection unit 806, which is used to disconnect the connection between the first target cloud server and the intelligent device if the first target cloud server meets the first switching condition; and a second connection unit 807, which is used to connect the intelligent device to a second target cloud server, so that the intelligent device switches to connect to the at least one cloud server.
[0094] In a possible embodiment, in terms of periodically determining whether the first target cloud server satisfies the first switching condition, the third determination unit 805 is specifically used to: obtain the storage amount, historical cumulative number of interactions, outbound traffic, and network load used by the smart device in the first target cloud server; calculate the storage amount, the historical cumulative number of interactions, and the outbound traffic based on preset billing rules to obtain the cumulative consumption amount; if the cumulative consumption amount is greater than the preset budget, the first target cloud server satisfies the first switching condition; if the cumulative consumption amount is not greater than the budget, the first target cloud server does not meet the first switching condition.
[0095] In a possible embodiment, if the identity of the smart device is correct, in terms of determining the first target cloud server based on the total load and cumulative load of at least one cloud server, the second determination unit 803 is specifically used to: obtain the total load corresponding to each cloud server; determine a reference cloud server based on the total load corresponding to each cloud server, the total load of the reference cloud server being less than a preset load; obtain the upper limit number of client connections and the cumulative connection volume of each reference cloud server; and mark the reference cloud server whose cumulative connection volume is less than the upper limit number of client connections as the first target cloud server.
[0096] In a possible embodiment, in terms of connecting the first target cloud server with the smart device, the first connection unit 804 is specifically used to: send the device serial number to the first target cloud server; obtain device basic data from the first target cloud server, wherein the device basic data is associated with the smart device; send the device basic data to the smart device, so that the smart device and the first target cloud server are connected based on the device basic data and the device serial number.
[0097] It can be understood that since the method embodiment and the device embodiment are different presentation forms of the same technical concept, the content of the method embodiment part in this application should be synchronously adapted to the device embodiment part and will not be repeated here.
[0098] In the case of an integrated unit, such as Fig. 9 As shown, Fig. 9 This is a functional unit block diagram of another smart device switching connection device provided by an embodiment of the present application. Fig. 9 In the embodiment, the intelligent device switching connection device 80 includes a communication module 811 and a processing module 812. The processing module 812 is used to control and manage the actions of the device, for example, to execute the steps of the first acquisition unit 801, the first determination unit 802, the second determination unit 803, the first connection unit 804, the third determination unit 805, the disconnection unit 806, the second connection unit 807, and / or other processes for executing the technology described herein. The communication module 811 is used to support the interaction between the device and other devices. Fig. 9 As shown, the smart device switching connection device 80 may further include a storage module 813, and the storage module 813 is used to store program codes and data of the device.
[0099] Among them, the processing module 812 can be a processor or a controller, for example, it can be a central processing unit (CPU), a general processor, a digital signal processor (DSP), an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logic boxes, modules and circuits described in combination with the contents disclosed in this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessor, and so on. The communication module 811 can be a transceiver, an RF circuit or a communication interface, etc. The storage module 813 can be a memory. Among them, all relevant contents of each scenario involved in the above method embodiments can be referred to the functional description of the corresponding functional module, which will not be repeated here. The above content quality scoring devices can all execute the above Figure 5 The smart device shown switches the connection method.
[0100] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.
[0101] An embodiment of the present application also provides a computer storage medium, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, part or all of the steps of any method recorded in the above method embodiments are implemented.
[0102] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0103] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0104] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0105] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0106] The above integrated unit implemented in the form of software functional unit can be stored in a computer-readable storage medium. The above software functional unit is stored in a storage medium and includes several instructions for a computer device to execute.
[0107] Part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a volatile memory or a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), sync link DRAM (SLDRAM) and direct memory access RAM (DMARAM), among other media that can store program code.
[0108] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions without departing from the spirit and scope of the present invention, and can make various changes and modifications, including the combination of the above-mentioned different functions and implementation steps, including software and hardware implementation methods, all of which are within the scope of protection of the present invention.
Claims
1. A method for switching connection of a smart device, It is characterized in that An application server applied to a connection system, the connection system comprising an application server and an intelligent device, the application server and the intelligent device being communicatively connected, the method comprising: Acquire a device serial number and first information from a smart device, where the first information is information obtained by encrypting the device serial number by the smart device; determining whether the identity of the smart device is correct based on an activation program, the device serial number and the first information, the activation program being used to decrypt the first information; If the identity of the smart device is correct, determining a first target cloud server based on a total load and a cumulative number of connections of at least one cloud server; Connecting the first target cloud server to the smart device; periodically determining whether the first target cloud server satisfies a first switching condition, where the first switching condition is used to indicate that an actual rental resource consumption of the first target cloud server is higher than a preset rental resource consumption; If the first target cloud server meets the first switching condition, disconnecting the connection between the first target cloud server and the smart device; Connecting the smart device to a second target cloud server so that the smart device switches to connect to the at least one cloud server; The periodically determining whether the first target cloud server meets the first switching condition includes: Obtaining the storage capacity, historical cumulative number of interactions, outbound network traffic, and network load used by the smart device in the first target cloud server; Calculate the storage amount, the historical cumulative number of interactions, and the outbound network traffic based on a preset billing rule to obtain a cumulative consumption amount; If the accumulated consumption amount is greater than the preset budget, the first target cloud server meets the first switching condition; if the accumulated consumption amount is not greater than the budget, the first target cloud server does not meet the first switching condition; After connecting the smart device to the second target cloud server, the method further includes: Obtaining the total load and preset load of the second target cloud server; If the total load is greater than the preset load, disconnecting the connection between the second target cloud server and the smart device; Connecting the smart device to a third target cloud server; Wherein, if the identity of the smart device is correct, determining the first target cloud server based on the total load and cumulative connection volume of at least one cloud server includes: Get the total load corresponding to each cloud server; Determine a reference cloud server according to the total load corresponding to each cloud server, wherein the total load of the reference cloud server is less than a preset load; Get the upper limit and cumulative number of client connections for each reference cloud server; The reference cloud server with the smallest cumulative connection amount among the reference cloud servers whose cumulative connection amount is less than the upper limit of client connections is marked as the first target cloud server.
2. The method according to claim 1, It is characterized in that The connecting the first target cloud server to the smart device includes: Sending the device serial number to the first target cloud server; Acquire basic device data from the first target cloud server, where the basic device data is associated with the smart device; The device basic data is sent to the smart device, so that the smart device and the first target cloud server are connected based on the device basic data and the device serial number.
3. The method according to claim 2, It is characterized in that After connecting the first target cloud server to the smart device, the method further includes: Determine whether the first target cloud server meets a second switching condition, where the second switching condition includes at least one of the following: a response time of the first target cloud server exceeds a preset threshold; or a data packet is lost in the first target cloud server; or the first target cloud server is down; If the first target cloud server meets the second switching condition, disconnecting the connection between the first target cloud server and the smart device; Connect the smart device to the fourth target cloud server.
4. The method according to any one of claims 1 to 3, It is characterized in that The activation program includes a public key, the public key corresponds to a private key used to encrypt the first information, and determining whether the identity of the smart device is correct based on the activation program, the device serial number, and the first information includes: Decrypting the first information based on the public key to obtain second information; The second information is compared with the device serial number to determine whether they are the same. If the second information is the same as the device serial number, the identity of the smart device is correct.
5. A smart device switching connection device, It is characterized in that An application server applied to a connection system, the connection system comprising an application server and an intelligent device, the application server and the intelligent device being communicatively connected, the device comprising: A first acquisition unit, configured to acquire a device serial number and first information from a smart device, where the first information is information obtained by encrypting the device serial number by the smart device; a first determining unit, configured to determine whether the identity of the smart device is correct based on an activation program, the device serial number, and the first information, wherein the activation program is used to decrypt the first information; A second determination unit, configured to determine a first target cloud server based on a total load and a cumulative number of connections of at least one cloud server if the identity of the smart device is correct; A first connecting unit, configured to connect the first target cloud server to the smart device; a third determining unit, configured to periodically determine whether the first target cloud server satisfies a first switching condition, wherein the first switching condition is used to indicate that an actual rental resource consumption of the first target cloud server is higher than a preset rental resource consumption; a disconnection unit, configured to disconnect the connection between the first target cloud server and the smart device if the first target cloud server meets the first switching condition; A second connecting unit, configured to connect the smart device to a second target cloud server, so that the smart device switches to connect to the at least one cloud server; The periodically determining whether the first target cloud server meets the first switching condition includes: Obtaining the storage capacity, historical cumulative number of interactions, outbound network traffic, and network load used by the smart device in the first target cloud server; Calculate the storage amount, the historical cumulative number of interactions, and the outbound network traffic based on a preset billing rule to obtain a cumulative consumption amount; If the accumulated consumption amount is greater than the preset budget, the first target cloud server meets the first switching condition; if the accumulated consumption amount is not greater than the budget, the first target cloud server does not meet the first switching condition; Wherein, after connecting the smart device to the second target cloud server: Obtaining the total load and preset load of the second target cloud server; If the total load is greater than the preset load, disconnecting the connection between the second target cloud server and the smart device; Connecting the smart device to a third target cloud server; Wherein, if the identity of the smart device is correct, determining the first target cloud server based on the total load and cumulative connection volume of at least one cloud server includes: Get the total load corresponding to each cloud server; Determine a reference cloud server according to the total load corresponding to each cloud server, wherein the total load of the reference cloud server is less than a preset load; Get the upper limit and cumulative number of client connections for each reference cloud server; The reference cloud server with the smallest cumulative connection amount among the reference cloud servers whose cumulative connection amount is less than the upper limit of client connections is marked as the first target cloud server.
6. An application server, It is characterized in that The method comprises a processor, a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for executing the steps in the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, It is characterized in that A computer program is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 4.
