Connection management system and method, computer equipment and program product
By disconnecting and rebuilding the long connection of the charging pile and updating the mapping relationship in the gateway database, the problem of charging pile loss caused by the shared equipment identification of multiple charging piles is solved, and the accurate issuance of instructions and normal operation of charging piles is achieved.
Patent Information
- Application Number
- CN202411355495.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-03
AI Technical Summary
During the deployment of charging piles for new energy vehicles, multiple charging piles share a device logo, which makes the instructions unable to be issued, resulting in the loss of connection of the charging pile and affecting normal operation.
Through the cloud server, send a disconnection request to the gateway connected to the last connected charging pile, disconnect the long connection, and re-establish the connection through the long connection reconstruction request of the charging pile, update the long connection mapping relationship in the gateway database, and ensure that the instructions can be accurate Posted.
The problem of missing connection of charging piles is solved, the normal operation and user experience of charging piles is ensured, and the failure of issuing instructions caused by the shared equipment identification of multiple charging piles issuing.
Smart Images

Figure CN119071345A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of intelligent driving technology, and in particular to a connection management system, method, computer device and program product. Background Art
[0002] With the popularity of new energy vehicles, more and more new energy charging piles have begun to be used to better meet the charging needs of new energy vehicles. In order to improve the user's charging experience, charging piles are usually connected to charging pile cloud services, so that users can realize the start and stop control of charging piles on mobile phones and other terminals.
[0003] Normally, a charging pile has a unique corresponding device ID, so in theory, the start and stop control of the corresponding charging pile can be achieved using the device ID sent by the terminal. However, in the actual deployment of charging piles, sometimes there is a problem of multiple charging piles sharing a device ID during the use test of the charging piles, which will cause the instructions to be unable to be sent to some charging piles, resulting in the loss of connection of the charging piles, affecting the normal operation of the charging piles. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a connection management system, method, computer device and program product.
[0005] In a first aspect, an embodiment of the present disclosure provides a connection management system, including:
[0006] The cloud server is configured to: when determining that the connection with the first charging pile is lost, send a disconnection request to the first gateway to which the first charging pile was last connected, wherein the disconnection request carries the device identification of the first charging pile; and receive a disconnection response sent by the first gateway;
[0007] The first gateway is configured to: receive the disconnection request sent by the cloud server, and disconnect the long connection with the first charging pile; receive the long connection reestablishment request sent by the first charging pile, and reestablish the long connection with the first charging pile; and rewrite the first long connection mapping relationship of the first charging pile into the gateway database, the first long connection mapping relationship is used to determine the access gateway of the first charging pile, and the first long connection mapping relationship includes the device identifier of the first charging pile and the identifier of the first gateway;
[0008] The first charging pile is configured to: when detecting that the long connection with the first gateway is disconnected, send the long connection reestablishment request to the first gateway.
[0009] In this implementation, when it is determined that the first charging pile is lost, the long connection corresponding to the deleted long connection mapping relationship is actively disconnected by using a long connection disconnection request, and then the long connection mapping relationship is rewritten into the gateway database through a long connection reconstruction request of the first charging pile, thereby solving the problem that instructions cannot be sent to the first charging pile due to multiple charging piles sharing a device identifier, and timely avoiding the occurrence of the first charging pile loss problem.
[0010] In a possible implementation, the cloud server is specifically configured to: when sending a disconnect long connection request to the first gateway to which the first charging pile was last connected, send the disconnect long connection request to each gateway that has a communication connection with the cloud server; the each gateway includes the first gateway to which the first charging pile was last connected.
[0011] In this implementation, since the long connection mapping relationship corresponding to the device identifier of the first charging pile no longer exists in the gateway database, by sending a disconnection request to each gateway, it can be ensured that the first gateway that has a long connection with the first charging pile can receive the request and disconnect the long connection with the first charging pile in time.
[0012] In a possible implementation manner, the connection management system further includes a second gateway;
[0013] The second gateway is configured to: receive a long connection request sent by a second charging pile, establish a long connection with the second charging pile, and write a second long connection mapping relationship of the second charging pile into a gateway database, wherein the second long connection request carries a device identifier of the second charging pile, and the device identifiers of the second charging pile and the first charging pile are the same;
[0014] The loss of connection with the first charging pile is caused by that the first long connection mapping relationship of the first charging pile stored in the gateway database is overwritten by the second long connection mapping relationship of the second charging pile, wherein the first long connection mapping relationship and the second long connection mapping relationship include the same device identifier.
[0015] In this implementation, since the device identification of the second charging pile is consistent with that of the first charging pile, when the second long connection mapping relationship corresponding to the second charging pile is written into the gateway database, the first long connection mapping relationship corresponding to the first charging pile will be overwritten, resulting in the loss of connection of the first charging pile.
[0016] In a possible implementation manner, the cloud server is further configured to: when sending a downlink instruction to the first charging pile, query the second long connection mapping relationship including the device identification of the first charging pile from the gateway database; according to the second long connection mapping relationship, send a downlink instruction of the first charging pile to the second gateway, wherein the downlink instruction carries the device identification of the first charging pile;
[0017] The second gateway is further configured to: receive the downlink instruction sent by the cloud server, and send the downlink instruction to the second charging pile having the same device identifier as the first charging pile.
[0018] In this implementation, since the device identification of the first charging pile is consistent with that of the second charging pile, and the first long connection mapping relationship of the first charging pile has been overwritten by the long connection mapping relationship of the second charging pile, the downlink instructions for the first charging pile will be accurately sent to the second charging pile via the second gateway.
[0019] In a possible implementation, the system further includes:
[0020] The second gateway is further configured to: when the second charging pile is offline, delete the second long connection mapping relationship stored in the gateway database;
[0021] The cloud server is further configured to: when sending a downlink instruction to the first charging pile, if a long connection mapping relationship corresponding to the device identifier of the first charging pile cannot be found in the gateway database, determine that the connection with the first charging pile is lost.
[0022] In this implementation, when the second charging pile is offline, the second long connection mapping relationship is deleted, which will result in the gateway database not having any long connection mapping relationship related to the device identification of the first charging pile, thereby causing the first charging pile to lose connection.
[0023] In a possible implementation, the cloud server is further configured to: receive uplink information reported by the first charging pile or a control instruction sent by a receiving terminal, wherein the control instruction is used to instruct usage control of the first charging pile; and generate a downlink instruction matching the uplink information or the control instruction.
[0024] In this implementation manner, the cloud server can generate a downlink instruction for the first charging pile in a timely manner according to the reporting information of the terminal or the first charging pile.
[0025] In a possible implementation manner, when the first gateway disconnects the long connection with the first charging pile, the first gateway is specifically configured as follows:
[0026] When the initiation time of the request to disconnect the long connection is later than the online time of the device corresponding to the first charging pile, the long connection with the first charging pile is disconnected.
[0027] In this implementation, the first gateway actively disconnects the long connection with the first charging pile only when the initiation time of the disconnection request is later than the device online time, thereby avoiding the problem of deleting the newly created long connection mapping relationship corresponding to the first charging pile.
[0028] In a second aspect, an embodiment of the present disclosure provides a connection management method, which is applied to a first gateway, including:
[0029] Receiving a disconnection request sent by a cloud server, the disconnection request carrying a device identifier of the first charging pile, the disconnection request being sent by the cloud server when determining that the cloud server has lost connection with the first charging pile;
[0030] Disconnecting the long connection with the first charging pile;
[0031] Receiving a long connection reestablishment request sent by the first charging pile, and reestablishing a long connection with the first charging pile;
[0032] The first long connection mapping relationship of the first charging pile is rewritten into the gateway database, where the first long connection mapping relationship is used to determine the access gateway of the first charging pile, and the first long connection mapping relationship includes the device identifier of the first charging pile and the identifier of the first gateway.
[0033] In this implementation mode, the first gateway utilizes the obtained disconnect long connection request to first disconnect the long connection with the first charging pile, and then rebuilds the long connection with the first charging pile by responding to the long connection reconstruction request of the first charging pile, and rewrites the first long connection mapping relationship of the first charging pile into the gateway database. This allows the cloud server to re-communicate with the first charging pile based on the re-written first long connection mapping relationship, thereby solving the problem of loss of connection with the first charging pile.
[0034] In a third aspect, the embodiment of the present disclosure further provides a connection management method, which is applied to a cloud server, comprising:
[0035] When it is determined that the connection with the first charging pile is lost, sending a disconnection request to the first gateway to which the first charging pile was last connected, wherein the disconnection request carries a device identifier of the first charging pile;
[0036] Receiving a disconnection long connection response sent by the first gateway;
[0037] When sending a downlink instruction to the first charging pile, the first long connection mapping relationship of the first charging pile is queried from the gateway database, the first gateway for re-establishing a long connection with the first charging pile is determined, and communication with the first charging pile is carried out through the first gateway, wherein the first long connection mapping relationship includes the device identification of the first charging pile and the identification of the first gateway.
[0038] In this implementation, when it is determined that the connection with the first charging pile is lost, by sending a disconnection request, the long connection mapping relationship between the first gateway and the first charging pile can be disconnected, so as to facilitate the subsequent re-establishment of the long connection between the first gateway and the first charging pile, and the first long connection mapping relationship of the first charging pile can be rewritten into the gateway database. By using the rewritten first long connection mapping relationship in the gateway database, the downlink instruction can be accurately sent to the first charging pile, and the communication with the first charging pile can be completed again.
[0039] In a fourth aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the steps in the above-mentioned second aspect, or any possible implementation of the second aspect are executed; or, when the machine-readable instructions are executed by the processor, the steps in the above-mentioned third aspect, or any possible implementation of the third aspect are executed.
[0040] In a fifth aspect, an optional implementation of the present disclosure further provides a computer program product, which, when run, executes the steps of the above-mentioned second aspect, or any possible implementation of the second aspect; or, the computer program product, when run, executes the above-mentioned third aspect, or any possible implementation of the third aspect.
[0041] For a description of the effects of the above-mentioned connection management method, computer device, and computer program product, please refer to the description of the above-mentioned connection management system, which will not be repeated here.
[0042] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0044] Figure 1 An interactive schematic diagram of a communication method in the prior art provided by an embodiment of the present disclosure is shown;
[0045] Figure 2 A schematic diagram showing a gateway access for multiple charging piles sharing the same device identifier provided by an embodiment of the present disclosure is shown;
[0046] Figure 3 A schematic diagram of a second charging pile after being offline provided by an embodiment of the present disclosure is shown;
[0047] Figure 4 A schematic diagram of the structure of a connection management system provided by an embodiment of the present disclosure is shown;
[0048] Figure 5 A schematic diagram of a process of disconnecting and reestablishing a long connection provided by an embodiment of the present disclosure is shown;
[0049] Figure 6a A specific implementation flow chart of saving a persistent connection object provided by an embodiment of the present disclosure is shown;
[0050] Figure 6b A specific implementation flow chart of a connection management method provided by an embodiment of the present disclosure is shown;
[0051] Figure 6c A specific implementation flow chart of another connection management method provided by an embodiment of the present disclosure is shown;
[0052] Figure 7 A flow chart of a connection management method applied to a first gateway provided by an embodiment of the present disclosure is shown;
[0053] Figure 8 A flow chart of a connection management method applied to a cloud server provided by an embodiment of the present disclosure is shown;
[0054] Fig. 9 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0055] The terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that shown or described herein.
[0056] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0057] Through research, it is found that the communication between the charging pile and the cloud server can be realized by using the long connection established between the charging pile and any of the multiple gateways corresponding to the cloud server. For example, after the user initiates a control instruction for the charging pile at the terminal, the cloud server can determine the gateway corresponding to the charging pile according to the unique identifier of the charging pile, and send the control instruction to the charging pile through the gateway, thereby realizing the control of the charging pile. However, in the actual deployment of charging piles, there may be a problem that multiple charging piles share a device identifier. For example, after the charging pile A is normally deployed and the charging pile A establishes a long connection with the corresponding gateway A, the long connection mapping relationship between the device identifier W of the charging pile A and the gateway A will be stored in the gateway database, so that communication with the charging pile A can be achieved through the gateway A. Later, charging pile B was temporarily deployed in the testing phase. Charging pile B used the same device identifier W as charging pile A. After charging pile B also established a long connection with the corresponding gateway B, the long connection mapping relationship between the device identifier and the gateway stored in the gateway database was updated to include the long connection mapping relationship between device identifier W and gateway B. In this way, communication with charging pile B can be achieved through gateway B, and communication with charging pile A can no longer be achieved through gateway A. Even if charging pile B is offline later, because the mapping relationship between charging pile A's device identifier and gateway A no longer exists in the gateway database, charging pile A cannot be contacted, resulting in the loss of connection of charging pile A.
[0058] That is, this will cause the command to be unable to be sent to the charging pile in normal use, causing the charging pile to lose connection, affecting the normal operation and use of the charging pile.
[0059] Based on the above research, the present disclosure provides a connection management system, method, computer device and program product. When it is determined that the first charging pile is disconnected, the cloud server actively sends a disconnection request to the first gateway to which the first charging pile was last connected, so that the first gateway can use the obtained disconnection request to disconnect the long connection first to disconnect the long connection between the first charging pile. The first gateway then rebuilds the long connection with the first charging pile in response to the long connection reconstruction request of the first charging pile and rewrites the first long connection mapping relationship of the first charging pile into the gateway database, so that the cloud server can achieve re-communication with the first charging pile according to the rewriting of the first long connection mapping relationship, thereby solving the problem of the first charging pile being disconnected. In the entire technical solution, the long connection corresponding to the deleted long connection mapping relationship is actively disconnected by using the disconnection request of the long connection, and then the long connection mapping relationship is rewritten into the gateway database by the long connection reconstruction request of the first charging pile, thereby solving the problem that the instruction cannot be sent to the first charging pile due to the sharing of a device identifier by multiple charging piles, and timely avoiding the occurrence of the loss of connection of the first charging pile.
[0060] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0061] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0062] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0063] To facilitate understanding of this embodiment, a connection management method disclosed in an embodiment of the present disclosure is first introduced in detail. The executor of the connection management method provided in the embodiment of the present disclosure is generally a terminal device or other processing device with certain computing capabilities, wherein the terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a personal digital assistant (PDA), a handheld device, a computer device, etc.; in some possible implementations, the connection management method may be implemented by a processor calling computer-readable instructions stored in a memory.
[0064] To facilitate understanding of the connection management system and method provided in the embodiments of the present application, the application scenarios of the connection management system and method provided in the embodiments of the present application are first described below:
[0065] In the prior art, usually, for any charging pile, communication with the cloud server can be achieved by accessing a gateway managed by the charging pile cloud service (i.e., the cloud server). Figure 1 FIG. 1 is an interactive diagram of a communication method of the prior art provided by an embodiment of the present application. Figure 1 In the example, taking the charging pile as the first charging pile, the first charging pile initiates a long connection establishment request to any gateway managed by the cloud server (such as the first gateway). After the first gateway is authenticated, it can establish a long connection with the first charging pile. And, if the long connection is successfully established, the long connection mapping relationship between the device identifier of the first charging pile and the identifier of the first gateway can be stored in the gateway database as a route selection when the instruction is issued. At the same time, the first gateway will also send this long connection mapping relationship to the cloud server, and the cloud server can then store the long connection mapping relationship in the cloud service database to achieve data backup and for background display. In addition, after the first gateway establishes a long connection with the first charging pile, the information that the first charging pile is online can also be sent to the cloud server.
[0066] When the user needs to use the first charging pile, a control instruction for the first charging pile can be initiated at the terminal. The terminal will send the control instruction to the cloud server. The cloud server queries the gateway database through the device identification of the first charging pile, and can find the long connection mapping relationship between the first charging pile and the first gateway. Then the cloud server can send the control instruction to the first gateway. After receiving the control instruction, the first gateway uses the long connection between the first charging pile and the first charging pile to forward the control instruction to the first charging pile. After receiving the control instruction, the first charging pile can respond to the control instruction, thereby realizing control of the first charging pile. At the same time, the first charging pile can return a response receipt to the first gateway to indicate a successful response message.
[0067] However, if for some reason multiple charging piles share the same device ID, the mapping relationship between the device ID and the gateway established earlier will be overwritten by the mapping relationship between the device ID and the gateway established later, resulting in a problem of disconnection of a charging pile. Figure 2As shown, it is a schematic diagram of a plurality of charging piles sharing the same device identifier and accessing a gateway provided by an embodiment of the present application, wherein the plurality of charging piles may include a first charging pile and a second charging pile, and the shared device identifier may be "12345678". Specifically, after the first charging pile establishes a long connection with the first gateway, the first gateway may store the long connection mapping relationship between the device identifier and the identifier of the first gateway in the gateway database. The mapping relationship between the device identifier and the identifier of the first gateway may be as follows:
[0068] {
[0069] "deviceID": "12345678"
[0070] "gateway": "First Gateway"
[0071] }
[0072] Thereafter, if the second charging pile that shares the same device identifier as the first charging pile establishes a long connection with the second gateway, the second gateway can store the long connection mapping relationship between the second gateway identifier and the device identifier of the second charging pile in the gateway database. At this time, the long connection mapping relationship corresponding to the first charging pile stored in the gateway database will be overwritten by the long connection mapping relationship corresponding to the second charging pile. At the same time, the long connection mapping relationship corresponding to the first charging pile stored in the cloud service database will also be overwritten by the long connection mapping relationship corresponding to the second charging pile.
[0073] The second gateway may be the same as the first gateway or different from the first gateway, which is not specifically limited here. The mapping relationship corresponding to the second charging pile may be as follows:
[0074] {
[0075] "deviceID": "12345678"
[0076] "gateway": "Second gateway"
[0077] }
[0078] Then, when the cloud server sends instructions to the device identifier "12345678", since the gateway database only stores the long connection mapping relationship corresponding to the second charging pile, all instructions will be sent to the second charging pile via the second gateway. Although the first charging pile is online, it cannot receive any instructions from the cloud server and is in a lost state.
[0079] Further, such as Figure 3As shown, it is a schematic diagram of a second charging pile after going offline provided by an embodiment of the present disclosure. Among them, after the second charging pile goes offline, the second gateway will clear the long connection mapping relationship between the device identification of the second charging pile and the identification of the second gateway stored in the gateway database. Similarly, the long connection mapping relationship corresponding to the second charging pile stored in the cloud service database will also be cleared accordingly. That is, the mapping relationship corresponding to the device identification will become empty (i.e. {empty}). At this time, even if the long connection between the first charging pile and the first gateway still exists, since the long connection mapping relationship corresponding to the first charging pile no longer exists in the gateway database and the cloud service database, the cloud server cannot determine the gateway to which the first charging pile is connected, resulting in the inability to issue instructions sent to the device identification "12345678", resulting in the first charging pile being in a disconnected state.
[0080] In order to solve the problem of charging piles losing connection due to multiple charging piles sharing one device identifier, a connection management system in an embodiment of the present application is proposed to solve the problem of charging piles losing connection.
[0081] like Figure 4 , which is a schematic diagram of a connection management system provided by an embodiment of the present disclosure, including a cloud server 41, a first gateway 42 and a first charging pile 43. The cloud server 41 is configured to: when determining that the connection with the first charging pile is lost, send a disconnection request to the first gateway to which the first charging pile was last connected, wherein the disconnection request carries the device identification of the first charging pile; and receive a disconnection response sent by the first gateway.
[0082] Here, the first charging pile 43 is disconnected because the first long connection mapping relationship between the device identification of the first charging pile 43 and the first gateway 42 is deleted in the gateway database 46, and at this time, there is no long connection mapping relationship related to the device identification of the first charging pile 43 in the gateway database 46, so the cloud server 41 cannot determine the gateway connected to the first charging pile 43, so that the instructions for the device identification sent to the first charging pile 43 cannot be issued, causing the problem of the first charging pile 43 being disconnected. The phenomenon of the first charging pile 43 being disconnected can be detected by the following process: Since the long connection between the first charging pile 43 and the first gateway 42 exists, the first charging pile 43 can continuously report the working status of the charging pile through the first gateway 42, so the cloud server 41 will also respond to the uplink message, but since the long connection mapping relationship between the device identification of the first charging pile 43 and the gateway in the gateway database 46 is lost, the cloud server 41 cannot find which gateway to send the downlink response message to the first charging pile 43, and then throws an exception of "no device connection", thereby detecting the problem of device disconnection.
[0083] The first gateway 42 may be the access gateway to which the first charging post 43 was most recently connected. There is a long connection between the gateway and the first charging post 43 , but the long connection mapping relationship between the two is not stored in the gateway database 46 .
[0084] The above-mentioned disconnection request for a long connection is an instruction for instructing to disconnect the long connection corresponding to the device identifier, and the disconnection request for a long connection includes the device identifier of the first charging pile 43 that needs to disconnect the long connection and the device online time of the first charging pile 43 corresponding to the device identifier. Among them, the device online time can be generated according to the timestamp when the first charging pile 43 initiates a long connection establishment request to the first gateway 42. For example, when the first charging pile 43 initiates a long connection establishment request to the first gateway 43 (the request is sent before the first charging pile loses connection), a long connection object can be generated and saved in the memory corresponding to the gateway service. Among them, the data structure of the long connection object can be a map data structure, which can include a key-value pair (key-value), wherein the key is a long connection identifier (ID), the value is a long connection object, and the data structure of the long connection object can include a device identifier, a long connection id, the gateway Internet Protocol (IP) connected to the charging pile, and the device online time of the first charging pile.
[0085] After the first gateway 42 receives the persistent connection establishment request (the request is sent before the connection with the first charging pile 43 is lost), if the first charging pile 43 is authenticated, a persistent connection with the first charging pile 43 is established. If the first charging pile 43 is not authenticated, a persistent connection with the first charging pile 43 is not established, and the persistent connection object stored in the memory is deleted.
[0086] The disconnection long connection response is fed back to the cloud server 41 by the first gateway 42 after responding to the disconnection long connection request and disconnecting the long connection with the first charging pile 43. The first long connection mapping relationship is used to indicate the long connection mapping relationship between the identifier of the first gateway 42 and the device identifier of the first charging pile 43.
[0087] During specific implementation, if the cloud server 41 is able to receive the uplink communication information reported by the first charging pile 43 corresponding to the device identifier, the cloud server 41 can further determine whether there is a long connection mapping relationship related to the device identifier of the first charging pile 43 among the various long connection mapping relationships stored in the gateway database 46. If not, it can be determined that a downlink instruction cannot be sent to the first charging pile 43, that is, it can be determined that the first charging pile 43 is in a disconnected state. Therefore, according to the device identifier of the first charging pile 43, a request to disconnect the long connection can be sent to the first gateway 42 to which the first charging pile 43 was last connected.
[0088] In an optional embodiment, when the cloud server 41 determines that the first charging pile 43 is online but in a disconnected state, the cloud server can automatically initiate a disconnection request for the device identification of the first charging pile 43 and send it to the first gateway 42. Alternatively, the cloud server 41 can also generate a prompt message and feedback it to the operator. After obtaining the prompt message, the operator can determine that the first charging pile 43 may be in a disconnected state, and click the disconnect long connection button in the background to initiate a disconnection request for the device identification of the first charging pile 43. Then, the cloud server can respond to the operator's click operation and send a disconnection request to the first gateway 42 according to the device identification of the first charging pile 43.
[0089] The first gateway 42 is configured to: receive a request to disconnect the long connection sent by the cloud server 41, and disconnect the long connection with the first charging pile 43; receive a request to reestablish the long connection sent by the first charging pile 43, and re-establish the long connection with the first charging pile 43; and rewrite the first long connection mapping relationship of the first charging pile 43 into the gateway database 46, the first long connection mapping relationship is used to determine the access gateway of the first charging pile 43, and the first long connection mapping relationship includes the device identification of the first charging pile 43 and the identification of the first gateway 42.
[0090] The first charging post 43 is configured to send a persistent connection reestablishment request to the first gateway 42 when detecting that the persistent connection with the first gateway 42 is disconnected.
[0091] Here, the long connection reestablishment request is a long connection establishment request initiated by the first charging pile, which is used to request to establish a long connection with the gateway. The long connection reestablishment request can be initiated by the first charging pile after detecting that the long connection with the gateway is disconnected. Exemplarily, the long connection reestablishment request can be actively initiated to the first gateway by the communication board controller in the first charging pile after detecting that the long connection with the first gateway is disconnected.
[0092] In specific implementation, the first gateway 42 can receive a disconnection request for a long connection and respond to the request, disconnect the long connection between the first charging pile corresponding to the device identifier in the request, and generate a disconnection response for indicating successful disconnection and send it to the cloud server 41 if the disconnection is successful. After the first gateway disconnects the long connection between the first charging pile and the first charging pile, the communication board controller in the first charging pile 43 can detect that the long connection between the first gateway and the long connection is disconnected, and actively generate a long connection reconstruction request and send the long connection reconstruction request to the first gateway 42. Then, the first gateway 42 can generate a long connection object corresponding to the device identifier in response to the long connection reconstruction request, and use the current timestamp as the device online time in the new long connection object, and use the new long connection object to update the long connection object stored in the memory. At the same time, the first charging pile 43 can be authenticated, and if the authentication is passed, the long connection between the first charging pile 43 and the first charging pile 43 can be reestablished. On the contrary, if the authentication fails, the new long connection object stored in the memory needs to be deleted.
[0093] After the first gateway 42 re-establishes the long connection with the first charging pile 43 , the first long connection mapping relationship between the device identifier of the first charging pile 43 and the identifier of the first gateway 42 may be re-written into the gateway database 46 .
[0094] Optionally, after the first charging pile 43 detects that the long connection with the first gateway 42 is disconnected, the first charging pile 43 may initiate a long connection reconstruction request to a third gateway, wherein the third gateway may include but is not limited to the first gateway 42 and the second gateway described later, as long as it is any gateway managed by the cloud server 41, and is not limited here. The above is only explained by initiating a long connection reconstruction request to the first gateway 42. In specific implementation, the first charging pile 43 may initiate a long connection reconstruction request to any gateway managed by the cloud server 41 to achieve the reconstruction of the long connection.
[0095] After the first long connection mapping relationship of the first charging pile 43 is rewritten into the gateway database 46, the cloud server 41 can restore the communication with the first charging pile 43 based on the first long connection mapping relationship. Then, the cloud server 41 can receive the control instruction for the first charging pile 43 initiated from the terminal 47 or receive the uplink information sent by the first charging pile 43 using the re-established long connection, and generate a downlink instruction for the first charging pile 43 according to the control instruction or the uplink information, and the downlink instruction can be a downlink control instruction or a downlink response instruction. Among them, the terminal 47 can be any smart device used by the user, such as a mobile phone, a tablet computer, etc. The downlink control instruction is used to control the first charging pile, and the downlink response instruction is a response to the uplink communication information sent by the first charging pile 43. Then, when sending a downlink instruction to the first charging pile 43, the cloud server 41 can query the first long connection mapping relationship of the first charging pile 43 from the gateway database 46 according to the device identification of the first charging pile 43, and determine the first gateway 42 that re-establishes a long connection with the first charging pile 43 according to the first long connection mapping relationship, and communicate with the first charging pile 43 through the first gateway 42. For example, the downlink instruction is sent to the first charging pile 43 through the first gateway 42 .
[0096] It is understandable that if the long connection reconstruction request initiated by the first charging pile 43 is for other gateways except the first gateway 42, after the long connection reconstruction is successful, the long connection mapping relationship between the identifier of the other gateway and the device identifier of the first charging pile 43 can be used as the first long connection mapping relationship and rewritten into the gateway database 46. Wherein, when the first long connection mapping relationship is rewritten into the gateway database 46, if the gateway database 46 does not have any long connection mapping relationship related to the device identifier of the first charging pile 43, the first long connection mapping relationship can be directly written into the gateway database 46; if the gateway database 46 does not have other long connection mapping relationships related to the device identifier of the first charging pile 43, the first long connection mapping relationship can be used to overwrite other stored long connection mapping relationships related to the device identifier of the first charging pile 43.
[0097] In one embodiment, the cloud server 41 is specifically configured as follows: when sending a disconnect long connection request to the first gateway 42 that was last connected to the first charging pile 43, a disconnect long connection request is sent to each gateway that has a communication connection with the cloud server 41; each gateway includes the first gateway 42 that was last connected to the first charging pile.
[0098] Since the cloud server 41 may manage multiple gateways, the multiple gateways may include the first gateway 42, the second gateway, the third gateway, .... Since the cloud server 41 cannot determine which gateway has a long connection with the first charging pile 43 in the case of loss of connection with the first charging pile 42, in order to ensure that the disconnection request can disconnect the long connection corresponding to the first charging pile 43, the cloud server 41 can send the generated disconnection request to the message queue (message queue, mq). Then, each gateway managed by the cloud server 42 can obtain the disconnection request from the message queue. Afterwards, for any gateway, after obtaining the disconnection request, the device identification and device online time will be parsed from the instruction, and then it will be determined whether there is a long connection between the first charging pile 43 corresponding to the device identification. Among them, each gateway except the first gateway 42 will determine that there is no long connection between the first charging pile 43 corresponding to the device identification, so the disconnection request can be ignored. The first gateway 42 may determine that there is a long connection between it and the first charging pile 43 , and disconnect the long connection between it and the first charging pile 43 in response to the request to disconnect the long connection.
[0099] That is, in order to solve the "no device connected" problem mentioned above, the cloud server 41 will send an MQ broadcast message when "no device connected" is detected. All gateway nodes locate the long connection with the first charging pile 43 by consuming the broadcast message, and disconnect the long connection according to the long connection disconnection request.
[0100] Alternatively, the cloud server 41 may also directly send a disconnection request to each gateway that has a communication connection with the cloud server 41 instead of using a message queue, so that the first gateway 42 among the gateways receives the disconnection request.
[0101] In one embodiment, the connection management system also includes a second gateway 44; the second gateway 44 is configured to: receive a long connection request sent by the second charging pile 45, establish a long connection with the second charging pile 45, and write a second long connection mapping relationship of the second charging pile 45 into the gateway database 46, the second long connection request carries the device identification of the second charging pile 45, and the device identification of the second charging pile 45 is the same as that of the first charging pile 43; the cloud server 41 loses connection with the first charging pile 43 because the first long connection mapping relationship of the first charging pile 43 stored in the gateway database 46 is overwritten by the second long connection mapping relationship of the second charging pile 45, wherein the first long connection mapping relationship and the second long connection mapping relationship include the same device identification.
[0102] Here, the first charging pile 434 and the second charging pile 45 have the same device identification, a long connection is established between the first charging pile 43 and the first gateway (hereinafter referred to as the first long connection for ease of description), and a long connection is established between the second charging pile 45 and the second gateway 44 (hereinafter referred to as the second long connection for ease of description). The first gateway 42 and the second gateway 44 may be the same or different. The establishment time of the first long connection is earlier than the establishment time of the second long connection. The long connection request sent by the second charging pile 45 may be initiated after the first long connection mapping relationship is rewritten into the gateway database 46, or before the first long connection mapping relationship is rewritten into the gateway database 46. If it is initiated before the first long connection mapping relationship is rewritten into the gateway database 46, it will cause the first charging pile 43 to lose connection. If it is initiated after the first long connection mapping relationship is rewritten into the gateway database 46, it will cause the first charging pile 43 to lose connection again.
[0103] Since the latest mapping relationship between each device identifier and the gateway identifier is stored in the gateway database 46, and the establishment time of the first long connection is earlier than the establishment time of the second long connection, the first long connection mapping relationship corresponding to the first long connection will be overwritten by the second long connection mapping relationship corresponding to the second long connection, resulting in the latest mapping relationship currently stored being the mapping relationship between the device identifier of the second charging pile 45 and the identifier of the second gateway 444. In this way, the first long connection mapping relationship stored in the gateway database 46 will be deleted, causing the first charging pile to lose connection.
[0104] In one embodiment, the cloud server 41 is further configured to: when sending a downlink instruction to the first charging pile, query the second long connection mapping relationship including the device identification of the first charging pile 43 from the gateway database 46; according to the second long connection mapping relationship, send a downlink instruction of the first charging pile to the second gateway 44, and the downlink instruction carries the device identification of the first charging pile;
[0105] The second gateway 44 is further configured to receive a downlink instruction sent by the cloud server 41 , and send the downlink instruction to the second charging pile 45 having the same device identifier as the first charging pile 43 .
[0106] Here, the downlink instruction may include a downlink response instruction for the uplink information after the cloud server 41 receives the uplink information sent by the first charging pile 43 through the long connection with the first gateway 42, and / or a downlink control instruction initiated by the terminal 47 for the first charging pile 43 received by the cloud server 41. The control instruction is an instruction initiated at the terminal 47 for the first charging pile 43, which can be used to control the function of the first charging pile 43. Exemplarily, the control instruction may be a start charging instruction, an end charging instruction, etc. The uplink information may include the working status information actively reported by the first charging pile 43 and / or the uplink instruction actively reported by the first charging pile 43.
[0107] Exemplarily, the device identifications of the first charging pile 43 and the second charging pile 45 are both "12345678", the establishment time of the first long connection is earlier than the establishment time of the second long connection, and the latest mapping relationship stored in the gateway database 46 is the mapping relationship between the device identification "12345678" and the identification of the second gateway 44. When the cloud server 41 sends a downlink instruction to the first charging pile 43, the second long connection mapping relationship can be found from the gateway database 46 according to the device identification "12345678", and the downlink instruction can be sent to the second gateway 44 according to the second long connection mapping relationship. The second gateway 44 can receive the downlink instruction sent by the cloud server 41 and forward the downlink instruction to the second charging pile 45. In this way, any instruction sent for the device identification "12345678" will be sent to the second charging pile 45, causing the loss of connection of the first charging pile 43.
[0108] After receiving the downlink instruction, the second charging pile 45 can feedback the instruction response to the cloud server 41 through the second gateway 44.
[0109] In one embodiment, the system further comprises:
[0110] The second gateway 44 is further configured to: when the second charging pile 45 is offline, delete the second long connection mapping relationship stored in the gateway database 46;
[0111] The cloud server 41 is further configured to: when sending a downlink instruction to the first charging pile 43 , if a long connection mapping relationship corresponding to the device identifier of the first charging pile cannot be found from the gateway database 46 , it is determined that the connection with the first charging pile 43 is lost.
[0112] Here, for any charging pile, after the charging pile goes offline, the gateway that has a long connection with the charging pile will actively try to delete the long connection mapping relationship related to the charging pile stored in the gateway database 46. Therefore, when the second charging pile 45 is offline, the second gateway 44 can also find out the long connection mapping relationship corresponding to the device identifier of the second charging pile from the gateway database 46, that is, the second long connection mapping relationship. Then, delete the second long connection mapping relationship stored in the gateway database 46. At this time, since the first long connection relationship of the first charging pile 43 has been overwritten by the second long connection mapping relationship, when the second long connection mapping relationship is deleted, there will be no long connection mapping relationship corresponding to the device identifier of the first charging pile 43 in the gateway database 46, and the first charging pile 43 is in a disconnected state.
[0113] After the second charging pile 45 is offline, the cloud server 41 can determine whether there is a long connection mapping relationship corresponding to the device identification of the first charging pile 43 based on the various long connection mapping relationships currently stored in the gateway database 46, and then determine whether the downlink information can be sent to the first charging pile 43. In the embodiment of the present application, the information sent by the cloud server 41 to any charging pile can be defined as a downlink instruction, and the information actively sent by any charging pile to the cloud server 41 can be defined as uplink information. When the cloud server 41 needs to send a downlink instruction to the first charging pile 43, if any long connection mapping relationship corresponding to the device identification of the first charging pile 43 cannot be found from the gateway database 46, it can be determined that the connection with the first charging pile 43 is lost.
[0114] For example, after deleting the second long connection mapping relationship stored in the gateway database 46, there is still a long connection between the first gateway 42 and the first charging pile 43, but the gateway database 46 does not have the long connection mapping relationship corresponding to the long connection. At this time, the first charging pile 43 will still actively report the working status (such as idle, plugged in, charging, not plugged in, appointment, self-checking, stopped, idle and not returned, fault) or instructions (such as the sign-in information of the charging pile, heartbeat reporting, working status reporting, stage power reporting during charging, event reporting of the charging pile, fault reporting, charging gun button action reporting, plug-and-play charging instruction reporting, etc.) to the cloud server 41 through the long connection with the first gateway 42. However, when the cloud server 41 responds to the uplink information reported by the first charging pile 43 and sends a downlink instruction, since the gateway database 46 does not have the corresponding long connection mapping relationship, the cloud server 41 will continuously throw out the exception of "no device connection". Therefore, through this phenomenon, it can be determined that the first charging pile is online but in a disconnected state.
[0115] In one embodiment, the cloud server 41 is further configured to: receive uplink information reported by the first charging pile 43 or a control instruction sent by the receiving terminal 47, the control instruction being used to instruct the use control of the first charging pile; and generate a downlink instruction matching the uplink information or the control instruction.
[0116] Here, the control instruction may be an instruction initiated by the user at the terminal 47 for the first charging pile 43, which may be used to perform functional control on the first charging pile 43, for example, a start charging instruction, an end charging instruction, etc. The uplink information may include working status information actively reported by the first charging pile 43 and / or an uplink instruction actively reported by the first charging pile 43.
[0117] In specific implementation, the downlink instruction of the cloud server 41 can be generated according to the following steps: when the long connection between the first charging pile 43 and the first gateway 42 exists, the first charging pile 43 can actively send uplink information to the cloud server 41 through the first gateway 42. The uplink information here can be the response of the first charging pile 43 to the control instruction of the cloud server 41, or it can be actively reported status information or instructions, etc. Regardless of whether the first charging pile 43 is lost, the uplink information can be actively reported to the cloud server 41. The cloud server 41 can receive the uplink information of the first charging pile 43 and generate a downlink instruction related to the uplink information.
[0118] Optionally, the user can use the terminal 47 to control the online first charging pile 43, and use the terminal 47 to send a control instruction for the device identifier of the first charging pile to the cloud server 41. For example, a start charging instruction, a stop charging instruction, etc. Then the cloud server 41 can receive the control instruction from the terminal 47, and use the control instruction as a downlink instruction for the first charging pile, or generate a corresponding downlink instruction according to the control instruction.
[0119] In one embodiment, when the first gateway 42 disconnects the long connection with the first charging pile 43, it is specifically configured as follows:
[0120] When the initiation time of the disconnection request is later than the online time of the device corresponding to the first charging pile 43, the long connection with the first charging pile is disconnected.
[0121] In specific implementation, after obtaining the request to disconnect the long connection from the message queue, the first gateway 42 can determine the long connection object stored in the memory according to the device identification of the first charging pile 43, and then determine the device online time of the first charging pile 43 according to the long connection object. Then determine whether the initiation time of the request to disconnect the long connection is later than the device online time corresponding to the device identification of the first charging pile 43. If so, it can detect the long connection with the first charging pile 43 according to the long connection object, and actively disconnect the long connection. If the initiation time is not later than the device online time corresponding to the device identification of the first charging pile 43, it can be determined that before initiating the request to disconnect the long connection, the first charging pile 43 has newly established a long connection with other gateways. In order to avoid accidentally disconnecting the newly established long connection, the request to disconnect the long connection can be ignored.
[0122] Here, the time judgment is added to avoid closing the newly created persistent connection and avoid frequent disconnection of the newly established persistent connection due to multiple disconnection requests. If it is determined that the connection needs to be disconnected, the persistent connection is actively disconnected and the first charging pile 43 is actively initiated to reconnect. After the persistent connection with the gateway is successfully reestablished, the mapping relationship between the device identifier and the gateway identifier is rewritten to the gateway database 46, and the abnormality is recovered.
[0123] like Figure 5As shown, it is a schematic diagram of the process of disconnecting and reconstructing a long connection provided by an embodiment of the present application, wherein the device identifications of the first charging pile and the second charging pile are both "12345678", there is a long connection between the first charging pile and the first gateway, and there is a long connection between the second charging pile and the second gateway. The establishment time of the long connection corresponding to the second charging pile is later than the establishment time of the long connection of the first charging pile, so the second long connection mapping relationship corresponding to the long connection of the second charging pile will overwrite the first long connection mapping relationship corresponding to the first charging pile stored in the gateway database, resulting in loss of connection with the first charging pile. After the second charging pile is offline, the long connection between the second charging pile and the second gateway will be disconnected, and the second long connection mapping relationship corresponding to the second charging pile stored in the gateway database will be deleted. At this time, the first long connection mapping relationship corresponding to the first charging pile does not exist in the gateway database. Even if the long connection between the first charging pile and the first gateway exists, the cloud server cannot send instructions to the first charging pile. In order for the first charging pile to normally receive the information sent by the cloud server again, the cloud server can initiate a request to disconnect the long connection for the first charging pile and put it into the message queue when it determines that the first charging pile has lost connection (specifically, the cloud server can obtain the uplink information reported by the first charging pile but cannot send a downlink instruction to the first charging pile). The first gateway can obtain the request to disconnect the long connection from the message queue, and in the case that the initiation time of the request to disconnect the long connection is later than the device online time of the first charging pile, the first gateway can respond to the request to disconnect the long connection, find the long connection with the first charging pile and disconnect the long connection. Then, the first charging pile can send a message to the third gateway (the third gateway includes but is not limited to the first gateway, Figure 5 In the example of the third gateway being the first gateway, a long connection reconstruction request is initiated. The first gateway can respond to the long connection reconstruction request, reconstruct the long connection with the first charging pile, and update the device online time corresponding to the device identifier of the first charging pile. If the reconstruction is successful, the long connection mapping relationship between the device identifier "12345678" of the first charging pile and the identifier of the first gateway is rewritten into the gateway database, thereby solving the problem of the first charging pile being disconnected.
[0124] In this way, in the case of loss of connection with the first charging pile, if the initiation time of the disconnection request for the long connection is later than the device online time of the first charging pile, the first gateway uses the received disconnection request for the long connection to first disconnect the long connection with the first charging pile, and then responds to the long connection reconstruction request to rebuild the long connection with the first charging pile, which can not only avoid the problem of deleting the newly created long connection corresponding to the first charging pile, but also realize the long connection mapping relationship between the identifier of the first gateway obtained after reconstruction and the device identifier of the first charging pile, and re-store it in the gateway database. In this way, the cloud server can use the long connection mapping relationship corresponding to the first charging pile stored in the gateway database to send the downlink instruction to the first gateway, and then use the first gateway to forward the downlink instruction to the first charging pile, thereby realizing the control of the first charging pile and solving the problem of loss of connection of the first charging pile. In the whole technical scheme, the long connection corresponding to the overwritten long connection mapping relationship is actively disconnected by using the disconnection request for the long connection, and then the long connection reconstruction request of the first charging pile is completed to rewrite the long connection mapping relationship into the gateway database, thereby solving the problem of loss of connection of the charging pile due to multiple charging piles sharing a device identifier.
[0125] In one embodiment, the long connection reestablishment request may be initiated after the first charging pile 43 fails to send uplink information to the first gateway 42. Here, the communication information actively sent by the first charging pile 43 to the first gateway 42 may be the uplink information mentioned above.
[0126] For example, after the first gateway 42 disconnects the long connection with the first charging pile 43 according to the long connection disconnection request. If the first charging pile 43 needs to send uplink information to the cloud server 41 again, since the long connection with the first gateway 42 no longer exists, it will not be able to send communication information to the first gateway 42, and thus cannot report information to the cloud server 41. At this time, the first charging pile 43 can determine that the long connection with the first gateway is disconnected, and initiate a long connection reconstruction request to the first gateway 42 to re-establish the long connection, thereby resuming communication with the cloud server 41.
[0127] Optionally, in order to further determine whether the failure to send the communication information is caused by the disconnection of the long connection, verification logic can be added. Specifically, after disconnecting the long connection with the first charging pile 43, if the first charging pile 43 sends the communication information to the cloud server 41 again, if the information fails to send, it is necessary to determine the cause of the failure. In the case where the cause of failure is a sending error, it can be determined that it is caused by the absence of a long connection, that is, it can be detected that the long connection with the first gateway 42 has been disconnected, and a long connection reconstruction request can be initiated to the first gateway 42. In the case where the cause of failure is a sending timeout, it can be determined that the sending failure may be caused by network instability and other reasons, and a long connection reconstruction request will not be initiated to the first gateway 42.
[0128] In one implementation, after the first gateway 42 rewrites the first long connection mapping relationship of the first charging pile 43 into the gateway database 46 , when the first charging pile 43 is offline, the first gateway may delete the first long connection mapping relationship stored in the gateway database 46 .
[0129] Exemplarily, after the first long connection mapping relationship corresponding to the first charging pile 43 is rewritten into the gateway database 46, if the first charging pile 43 is offline, the long connection between the first gateway 42 and the first charging pile 43 will be disconnected, and the first gateway 42 can delete the first long connection mapping relationship stored in the gateway database 46, that is, delete the long connection mapping relationship between the device identifier of the first charging pile 43 and the identifier of the first gateway 42. At the same time, the long connection mapping relationship between the device identifier of the first charging pile 43 and the identifier of the first gateway stored in the cloud service database will also be deleted.
[0130] Optionally, if the first long connection mapping relationship rewritten in the gateway database 46 is a long connection mapping relationship between the first charging pile 43 and other gateways, the mapping relationship between the device identification of the first charging pile 43 and the identification of other gateways stored in the gateway database 46 can be deleted when the first charging pile 43 is offline.
[0131] Optionally, when the first charging pile 43 is offline, the long connection object corresponding to the first charging pile 43 stored in the memory may also be deleted.
[0132] To facilitate understanding of the connection management system provided in the above embodiments, Figure 6a As shown, a specific implementation flowchart of saving a persistent connection object provided by an embodiment of the present application may include the following steps:
[0133] The first charging pile initiates a long connection establishment request to the first gateway.
[0134] The first gateway generates a persistent connection object and saves it in the memory corresponding to the gateway service. The data structure of the persistent connection object may be a map data structure, which may include a key-value pair, wherein the key is a persistent connection identifier (ID), and the value is a persistent connection object. The data structure of the persistent connection object may include a device identifier, a persistent connection ID, a gateway Internet Protocol (IP) connected to the charging pile, and the device online time of the charging pile.
[0135] The first gateway establishes a persistent connection with the first charging pile when the authentication of the first charging pile is passed. Optionally, if the authentication fails, the first gateway may close the persistent connection channel with the first charging pile and delete the persistent connection object stored in the memory.
[0136] When the long connection is successfully established, the long connection mapping relationship between the device identifier of the first charging pile and the identifier of the first gateway can be stored in the gateway database. At the same time, the first gateway will also send this long connection mapping relationship to the cloud server, and the cloud server can then store the long connection mapping relationship in the cloud service database to achieve data backup and for background display. In addition, after the first gateway establishes a long connection with the first charging pile, the information that the first charging pile is online can also be sent to the cloud server.
[0137] When the user uses the terminal to initiate a control instruction for the device identifier of the first charging pile, the terminal will send the control instruction to the cloud server. The cloud server queries the gateway database through the device identifier of the first charging pile, and can find the long connection mapping relationship between the first charging pile and the first gateway. The cloud server can then send the control instruction as a downlink instruction to the first gateway. The first gateway can obtain the long connection object through the connection identifier (connectionid), and send the control instruction to the first charging pile based on the long connection object and the long connection with the first charging pile.
[0138] After receiving the control instruction, the first charging pile can respond to the control instruction, thereby realizing the control of the first charging pile. At the same time, the first charging pile can return a response receipt to the first gateway to indicate a message of success or failure of the response. The first gateway can send the response receipt to the cloud server.
[0139] like Figure 6b As shown, a specific implementation flow chart of a connection management method provided in an embodiment of the present application may include the following steps:
[0140] The cloud server determines that it has lost connection with the first charging pile. When the cloud server determines that the first charging pile is online but in a disconnected state, the cloud server can also generate a prompt message and feedback to the operator. After obtaining the prompt message, the operator can determine that the first charging pile may be in a disconnected state, and click the disconnect long connection button for the device identifier in the background to initiate a disconnect long connection request for the device identifier of the first charging pile. Then, the cloud server can generate a disconnect long connection request according to the device identifier of the first charging pile in response to the operator clicking the disconnect long connection button for the device identifier. That is, the disconnect long connection request can also be initiated by the cloud server after the operator clicks the disconnect long connection button in the background.
[0141] The cloud server puts the disconnect request into the message queue. The message body corresponding to the disconnect request may include the device ID and the initiation time of the disconnect request. The initiation time is also the time when the cloud server discovers the "device has no connection exception". The initiation time exists specifically in the form of a timestamp.
[0142] Each gateway managed by the cloud server will subscribe to information from the message queue.
[0143] After the second gateway obtains the disconnection request for the long connection in the message queue, it does not detect the long connection between the second gateway and the first charging pile through the device identification and ignores the disconnection request for the long connection.
[0144] After obtaining the disconnection request of the persistent connection in the message queue, the first gateway obtains the persistent connection object corresponding to the first charging pile through the device identifier, and obtains the device online time from the persistent connection object.
[0145] When the initiation time of the disconnection request for the long connection is later than the online time of the device corresponding to the device identifier, the long connection with the first charging pile is acquired by disconnecting the device identifier in the long connection request, and the long connection with the first charging pile is disconnected.
[0146] When the first charging pile detects that the long connection with the first gateway has been disconnected, the first charging pile initiates a long connection reestablishment request to the first gateway.
[0147] The first gateway generates and saves a new persistent connection object, and re-establishes the persistent connection with the first charging pile when the first charging pile is authenticated according to the persistent connection re-establishment request.
[0148] When the first charging pile is authenticated and the long connection is rebuilt successfully, the long connection mapping relationship between the device identification of the first charging pile and the identification of the first gateway is rewritten into the gateway database.
[0149] The cloud server can use the rewritten long connection mapping relationship to restore communication with the first charging pile.
[0150] On the contrary, if the authentication of the first charging pile fails, the persistent connection channel may be closed and the saved new persistent connection object may be deleted.
[0151] like Figure 6c As shown, a specific implementation flow chart of another connection management method provided in an embodiment of the present application may include the following steps:
[0152] The cloud server determines that it has lost connection with the first charging pile, automatically initiates a request to disconnect the long connection for the device identifier of the first charging pile, and puts the request to disconnect the long connection into the message queue. The reason why the cloud server automatically initiates the request to disconnect the long connection may be that when responding to the receipt of the uplink information sent by the first charging pile (or, when receiving the control instruction sent by the user using the terminal), the long connection mapping relationship corresponding to the device identifier cannot be queried from the gateway database. The first charging pile can use the long connection between it and the first gateway to send uplink information to the first gateway, and the first gateway can send the uplink information to the cloud server; the reported information may include reported working status information, reporting instructions, etc.
[0153] Each gateway managed by the cloud server will subscribe to information from the message queue.
[0154] After the second gateway obtains the disconnection request for the long connection in the message queue, it does not detect the long connection between the second gateway and the first charging pile through the device identification and ignores the disconnection request for the long connection.
[0155] After obtaining the disconnection request of the persistent connection in the message queue, the first gateway obtains the persistent connection object corresponding to the first charging pile through the device identifier, and obtains the device online time from the persistent connection object.
[0156] When the initiation time of the disconnection request for the long connection is later than the online time of the device corresponding to the device identifier, the long connection with the first charging pile is acquired by disconnecting the device identifier in the long connection request, and the long connection with the first charging pile is disconnected.
[0157] When the first charging pile detects that the long connection with the first gateway has been disconnected, the first charging pile initiates a long connection reestablishment request to the first gateway and updates the device online time of the device identifier.
[0158] The first gateway generates and saves a new persistent connection object, and re-establishes the persistent connection with the first charging pile when the first charging pile is authenticated according to the persistent connection re-establishment request.
[0159] When the first charging pile is authenticated and the long connection is rebuilt successfully, the long connection mapping relationship between the device identification of the first charging pile and the identification of the first gateway is rewritten into the gateway database.
[0160] The cloud server can use the rewritten long connection mapping relationship to restore communication with the first charging pile.
[0161] On the contrary, if the authentication of the first charging pile fails, the persistent connection channel may be closed and the saved new persistent connection object may be deleted.
[0162] Since the connection management system provided in the embodiment of the present application involves the interaction between the gateway, the cloud server and the charging pile, the present application also provides a Figure 7 The flowchart of a connection management method applied to a first gateway shown may include the following steps:
[0163] S701: Receive a disconnection request from a cloud server, where the disconnection request carries a device identifier of the first charging pile, and the disconnection request is sent when the cloud server determines that it has lost connection with the first charging pile.
[0164] S702: Disconnect the long connection with the first charging pile.
[0165] S703: Receive a long connection reestablishment request sent by the first charging pile, and reestablish a long connection with the first charging pile.
[0166] S704: rewrite the first long connection mapping relationship of the first charging pile into the gateway database, where the first long connection mapping relationship is used to determine the access gateway of the first charging pile, and the first long connection mapping relationship includes the device identifier of the first charging pile and the identifier of the first gateway.
[0167] Regarding the specific implementation steps of the connection management method applied to the first gateway, reference may be made to the introduction of the various embodiments in the connection management system, which will not be described in detail here.
[0168] Since the connection management system provided in the embodiment of the present application involves the interaction between the gateway, the cloud server and the charging pile, the present application also provides a Figure 8 The flowchart of a connection management method applied to a cloud server shown may include the following steps:
[0169] S801: When it is determined that the connection with the first charging pile is lost, a disconnection request for the long connection is sent to the first gateway to which the first charging pile was last connected, wherein the disconnection request for the long connection carries a device identifier of the first charging pile.
[0170] S802: Receive a disconnection long connection response sent by the first gateway.
[0171] S803: When sending a downlink instruction to the first charging pile, query the first long connection mapping relationship of the first charging pile from the gateway database, determine the first gateway that re-establishes a long connection with the first charging pile, and communicate with the first charging pile through the first gateway, wherein the first long connection mapping relationship includes the device identifier of the first charging pile and the identifier of the first gateway.
[0172] Regarding the specific implementation steps of the above-mentioned connection management method applied to the cloud server, reference can be made to the introduction of each embodiment in the above-mentioned connection management system, which will not be repeated here.
[0173] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0174] Based on the same technical concept, the embodiment of the present application also provides a computer device. Fig. 9 FIG. 1 is a schematic diagram of a computer device provided in an embodiment of the present application, including:
[0175] Processor 901, memory 902 and bus 903. Among them, memory 902 stores machine-readable instructions executable by processor 901, and processor 901 is used to execute machine-readable instructions stored in memory 902. When the machine-readable instructions are executed by processor 901, processor 901 performs the following steps: S701: Receive a disconnection request for a long connection sent by a cloud server, the disconnection request for a long connection carries the device identification of the first charging pile, and the disconnection request for a long connection is sent by the cloud server when it determines that the connection with the first charging pile is lost; S702: Disconnect the long connection with the first charging pile; S703: Receive a long connection reconstruction request sent by the first charging pile, and re-establish the long connection with the first charging pile; and S704: Rewrite the first long connection mapping relationship of the first charging pile into the gateway database, the first long connection mapping relationship is used to determine the access gateway of the first charging pile, The first long connection mapping relationship includes the device identification of the first charging pile and the identification of the first gateway; or, when the machine-readable instruction is executed by the processor 901, the processor 901 performs the following steps: S801: when it is determined that the connection with the first charging pile is lost, a long connection disconnection request is sent to the first gateway to which the first charging pile was last connected, and the long connection disconnection request carries the device identification of the first charging pile; S802: receiving a long connection disconnection response sent by the first gateway; and S803: when sending a downlink instruction to the first charging pile, query the first long connection mapping relationship of the first charging pile from the gateway database, determine the first gateway that re-establishes a long connection with the first charging pile, and communicate with the first charging pile through the first gateway, wherein the first long connection mapping relationship includes the device identification of the first charging pile and the identification of the first gateway.
[0176] The above-mentioned memory 902 includes a memory 9021 and an external memory 9022; the memory 9021 here is also called an internal memory, which is used to temporarily store the calculation data in the processor 901, as well as the data exchanged with the external memory 9022 such as a hard disk. The processor 901 exchanges data with the external memory 9022 through the memory 9021. When the computer device is running, the processor 901 communicates with the memory 902 through the bus 903, so that the processor 901 executes the execution instructions mentioned in the above method embodiment.
[0177] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the connection management method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0178] The computer program product of the connection management method provided in the embodiment of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the connection management method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0179] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0180] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. 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 through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0181] 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.
[0182] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0183] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0184] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0185] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A connection management system, characterized in that: include: The cloud server is configured to: when determining that the connection with the first charging pile is lost, send a disconnection request to the first gateway to which the first charging pile was last connected, wherein the disconnection request carries a device identifier of the first charging pile; and receiving a disconnection long connection response sent by the first gateway; The first gateway is configured to: receive the disconnection request sent by the cloud server, and disconnect the long connection with the first charging pile; receive the long connection reestablishment request sent by the first charging pile, and reestablish the long connection with the first charging pile; and rewriting the first long connection mapping relationship of the first charging pile into the gateway database, the first long connection mapping relationship being used to determine the access gateway of the first charging pile, the first long connection mapping relationship including the device identifier of the first charging pile and the identifier of the first gateway; The first charging pile is configured to: when detecting that the long connection with the first gateway is disconnected, send the long connection reestablishment request to the first gateway.
2. The system according to claim 1, characterized in that The cloud server is specifically configured to: when sending a disconnect long connection request to the first gateway to which the first charging pile was last connected, send the disconnect long connection request to each gateway that has a communication connection with the cloud server; the each gateway includes the first gateway to which the first charging pile was last connected.
3. The system according to claim 1, characterized in that The connection management system also includes a second gateway; The second gateway is configured to: receive a long connection request sent by a second charging pile, establish a long connection with the second charging pile, and write a second long connection mapping relationship of the second charging pile into a gateway database, wherein the second long connection request carries a device identifier of the second charging pile, and the device identifiers of the second charging pile and the first charging pile are the same; The cloud server loses connection with the first charging pile because the first long connection mapping relationship of the first charging pile stored in the gateway database is overwritten by the second long connection mapping relationship of the second charging pile, wherein the first long connection mapping relationship and the second long connection mapping relationship include the same device identifier.
4. The system according to claim 3, characterized in that The cloud server is further configured to: when sending a downlink instruction to the first charging pile, query the second long connection mapping relationship including the device identification of the first charging pile from the gateway database; send a downlink instruction of the first charging pile to the second gateway according to the second long connection mapping relationship, wherein the downlink instruction carries the device identification of the first charging pile; The second gateway is further configured to: receive the downlink instruction sent by the cloud server, and send the downlink instruction to the second charging pile having the same device identifier as the first charging pile.
5. The system according to claim 4, characterized in that The system further comprises: The second gateway is further configured to: when the second charging pile is offline, delete the second long connection mapping relationship stored in the gateway database; The cloud server is further configured to: when sending a downlink instruction to the first charging pile, if a long connection mapping relationship corresponding to the device identifier of the first charging pile cannot be found in the gateway database, determine that the connection with the first charging pile is lost.
6. The system according to claim 4, characterized in that The cloud server is further configured to: receive uplink information reported by the first charging pile or a control instruction sent by a receiving terminal, wherein the control instruction is used to instruct use control of the first charging pile; and generate a downlink instruction matching the uplink information or the control instruction.
7. The system according to any one of claims 1 to 6, characterized in that: When the first gateway disconnects the long connection with the first charging pile, the first gateway is specifically configured as follows: When the initiation time of the request to disconnect the long connection is later than the online time of the device corresponding to the first charging pile, the long connection with the first charging pile is disconnected.
8. A connection management method, characterized in that: Applied to the first gateway, including: Receiving a disconnection request sent by a cloud server, the disconnection request carrying a device identifier of a first charging pile, the disconnection request being sent by the cloud server when determining that the cloud server has lost connection with the first charging pile; Disconnecting the long connection with the first charging pile; Receiving a long connection reestablishment request sent by the first charging pile, and reestablishing a long connection with the first charging pile; The first long connection mapping relationship of the first charging pile is rewritten into the gateway database, where the first long connection mapping relationship is used to determine the access gateway of the first charging pile, and the first long connection mapping relationship includes the device identifier of the first charging pile and the identifier of the first gateway.
9. A connection management method, characterized in that: Applied to cloud servers, including: When it is determined that the connection with the first charging pile is lost, sending a disconnection request to the first gateway to which the first charging pile was last connected, wherein the disconnection request carries a device identifier of the first charging pile; Receiving a disconnection long connection response sent by the first gateway; When sending a downlink instruction to the first charging pile, the first long connection mapping relationship of the first charging pile is queried from the gateway database, the first gateway for re-establishing a long connection with the first charging pile is determined, and communication with the first charging pile is carried out through the first gateway, wherein the first long connection mapping relationship includes the device identification of the first charging pile and the identification of the first gateway.
10. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the connection management method as described in claim 8 or 9.
11. A computer program product, characterized in that When the computer program is executed by a computer device, the computer device executes the steps of the connection management method according to claim 8 or 9.
