Communication method and system for configuring interphone system function by using PC (Personal Computer)
By realizing two-way Socket communication between PC and terminal on the walkie-talkie terminal, using JSON format and URL-encoded instruction transmission, the problems of operation instruction size limitation, garbled code and two-way communication in the prior art are solved, and any functions of the PC operation terminal are realized. Efficient data transmission.
Patent Information
- Application Number
- CN202311000855.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2025-02-18
AI Technical Summary
The existing intercom terminal operation instructions have size limitations, so large-scale data operations cannot be performed, the instructions are inconvenient to expand, the analysis is complicated, and two-way communication cannot be realized. Chinese transmission will also have garbled code problems.
Establish Socket connection with Android terminal through PC management software, realize two-way communication, send system module request instructions and receive response instructions, use JSON format to describe instructions, perform URL encoding to solve the problem of garbled code, and support large-scale data transmission.
It realizes any function of the PC operating the walkie-talkie terminal through two-way communication, solves the problem of data transmission size limitation and garbled code, supports large-scale data transmission and simplifies instruction analysis.
Smart Images

Figure CN119484262A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication method and system for configuring intercom system functions using a PC. Background Art
[0002] For walkie-talkie terminals, in order to facilitate carrying and prevent misoperation, the screen size is generally designed to be small, and can only be operated through physical buttons. If you want to operate some system functions of the walkie-talkie, such as adding a wifi configuration information, or adding a public network APN information, you need to enter multiple fields, which is very inconvenient to operate. Therefore, the terminal is connected to the PC via USB, and the terminal system functions are operated through the PC. The current implementation method is: the PC sends a broadcast adb shell am broadcast, and carries the operation instructions in the broadcast parameters. After receiving the broadcast, the terminal parses the broadcast parameters to obtain the operation instructions, and then executes the corresponding system functions according to the instructions. The main disadvantages of the existing technology are as follows:
[0003] 1) Operation instructions have size limits and cannot perform large-scale data operations. Currently, the maximum size is only 1K.
[0004] 2) The operation instructions are not easy to expand and are complex to parse.
[0005] 3) Broadcast commands are only one-way and two-way communication is not possible.
[0006] 4) When the command carries Chinese characters, garbled characters will appear. Summary of the invention
[0007] The embodiment of the present application provides a communication method and system for configuring intercom system functions using a PC. The PC can establish two-way communication with an intercom terminal, and ultimately use the PC to operate any function of the intercom terminal.
[0008] The present application proposes a communication method for configuring intercom system functions using a PC, comprising the following steps:
[0009] The PC management software establishes a Socket connection with the Android terminal;
[0010] The PC management software sends a system module request instruction to the terminal;
[0011] The terminal management application receives and executes the PC module request instruction;
[0012] The terminal sends module response instructions to the PC software;
[0013] The PC software receives the response command and displays the execution result.
[0014] Furthermore, the PC management software establishes a Socket connection with the Android terminal, specifically:
[0015] After the Android terminal management application is started, the Android terminal data communication module will create a TCP Socket service and listen to a terminal port, waiting for the PC Socket client to connect;
[0016] The PC is directly connected to the Android terminal via a USB cable, and the Android terminal turns on the USB debugging function;
[0017] After the PC management software is started, the data communication module of the PC management software calls the adb forward command to forward the port, so that the PC software sends data to the PC port, and finally forwards it to the corresponding port of the terminal;
[0018] The data communication module of the PC management software creates a TCP Socket client and connects to the terminal TCP Socket service through the local address 127.0.0.1 and the PC port.
[0019] Furthermore, the PC management software sends a system module request instruction to the terminal, specifically:
[0020] On the PC management software interface, operate a system module function;
[0021] The UI interaction module sends a request instruction expressed in JSON format, which is finally passed to the PC management software data communication module;
[0022] The data communication module encapsulates the request instruction into a request data packet after URL encoding according to the data communication protocol, and finally sends the request data packet out through the Socket.
[0023] Further, the terminal management application receives and executes the PC module request instruction, specifically:
[0024] The terminal data communication module reads the data sent by the PC through the Socket, parses it according to the data communication protocol, and obtains the request data packet;
[0025] Decode the request data packet through the URL to obtain the request instruction in JSON format;
[0026] According to the operation module type of the request instruction, the instruction is sent to the corresponding module controller in the application for processing;
[0027] After receiving the operation instruction, the module controller of the management application finally calls the corresponding system interface of the corresponding module of the Android system framework according to the operation type and operation data, thereby completing the operation of the terminal system function.
[0028] Further, the terminal sends a module response instruction to the PC software, specifically:
[0029] After the module controller of the application executes the request instruction, it calls the corresponding system module interface according to the result display requirements of the PC software to obtain the module response data;
[0030] Encapsulate the module response data into a response instruction in JSON format and hand it over to the terminal data communication module;
[0031] The data communication module encodes the module response instruction into a URL, encapsulates it into a response data packet according to the data communication protocol, and finally sends it out through the Socket.
[0032] Furthermore, the PC software receives the response instruction and displays the execution result, specifically:
[0033] The data communication module of the PC management software reads the sent data through the Socket, parses it according to the data communication protocol, and obtains the response data packet;
[0034] The response data packet is decoded through the URL to obtain the module response instruction, which carries the execution result data, and then handed over to the UI interaction module to display the execution result.
[0035] The present application also proposes a communication system for configuring intercom system functions using a PC, including PC management software and an Android terminal that communicate with each other, wherein the Android terminal includes a management APP and an Android system framework, wherein:
[0036] The PC management software includes a UI interaction module and a PC management software data communication module that communicate with each other;
[0037] The management APP includes a terminal data communication module and a wifi controller, a bluetooth controller, an apn controller, and other controllers that communicate with the terminal data communication module;
[0038] The Android system framework includes a wifi system module, a bluetooth system module, an apn system module, and other system modules that communicate with the wifi controller, the bluetooth controller, the apn controller, and other controllers respectively;
[0039] The PC management software data communication module communicates with the terminal data communication module.
[0040] Furthermore, the communication protocol data packet between the PC management software data communication module and the terminal data communication module is divided into three parts: a packet header, a packet content, and a packet tail, wherein the packet type includes a request packet and a response packet.
[0041] Furthermore, the package content is obtained by URL encoding the request or response instruction.
[0042] Furthermore, the packet content length is represented by 4 bytes, and the maximum length supported by the packet content length is 4GB.
[0043] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0044] The maximum data length in the communication protocol of this application is 4G, so it is large enough for request response instructions to carry data and can meet large-scale data transmission. The protocol instructions are described in json format, which can be extended arbitrarily and is relatively simple to parse. The protocol is divided into request response packets, and socket communication is used to realize two-way data interaction between PC and terminal. The protocol data will be transmitted in URL encoding, so the garbled problem caused by Chinese transmission can be solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0046] Figure 1 A flow chart of a communication method for configuring intercom system functions using a PC;
[0047] Figure 2 It is a block diagram of the communication system principle that uses a PC to configure the functions of the intercom system;
[0048] Figure 3 A schematic diagram of a communication protocol data packet structure of a communication system using a PC to configure intercom system functions;
[0049] Figure 4 The present invention is a flow chart of URL encoding of packet contents of a communication protocol data packet of a communication system that uses a PC to configure intercom system functions. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0051] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0052] like Figure 1 As shown, the present application proposes a communication method for configuring intercom system functions using a PC, comprising the following steps:
[0053] Step 1: Establish a Socket connection between the PC management software and the Android terminal
[0054] 1) After the terminal management application is started, its data communication module will create a TCP Socket service and listen to a terminal port, waiting for the PC Socket client to connect.
[0055] 2) The PC is directly connected to the terminal via a USB cable, and the USB debugging function needs to be enabled on the terminal.
[0056] 3) After the PC management software is started, its data communication module calls the adb forward command to forward the port, so that the PC software sends data to the PC port, which is finally forwarded to the corresponding port of the terminal.
[0057] 4) PC management software, whose data communication module creates a TCP Socket client and connects to the terminal TCP Socket service through the local address 127.0.0.1 and PC port.
[0058] After these steps, the PC management software establishes a Socket connection with the terminal, so two-way data communication is possible.
[0059] Step 2: The PC management software sends a system module request command to the terminal
[0060] 1) On the PC management software interface, operate a system module function, such as adding a WiFi configuration information.
[0061] 2) Generate module request instructions based on UI operations and finally pass them to the data communication module.
[0062] The UI interaction module will determine the system module type moduleType of the operation, such as whether it is a wifi module or a Bluetooth module, the operation actionType of the module, such as whether to add wifi configuration information or delete wifi configuration information, and the data reqData required for the operation on the module. For example, if a wifi module adds a wifi operation, the data required to carry include the wifi name, wifi password, etc. The module request instruction is finally constructed by moduleType, actionType, and reqData.
[0063] 3) The data communication module encapsulates the module request instruction into a request data packet after URL encoding according to the data communication protocol, and finally sends the request data packet out through Socket.
[0064] Step 3: The terminal management application receives and executes the PC module request command
[0065] 1) The application data communication module reads the data sent by the PC through the Socket, parses it according to the data communication protocol, and obtains the request data packet.
[0066] 2) Decode the request data packet through the URL to obtain the module request instruction, so as to know which module of the terminal the PC software has performed what operation and what data the operation carries.
[0067] 3) Depending on the module type being operated, the instruction is handed over to the corresponding module controller in the application for processing.
[0068] For example, if a Wi-Fi module is operated, the Wi-Fi controller is responsible for processing the instructions.
[0069] 4) After receiving the operation instruction, the module controller of the management application finally calls the corresponding system interface of the corresponding module of the Android system framework according to the operation type and operation data, thereby completing the operation of the terminal system function. For example, to add wifi configuration information, the addOrUpdateNetwork method of Android's WifiManager is called to add the wifi information to the system.
[0070] Step 4: The terminal sends the module response command to the PC software
[0071] 1) After the application module controller executes the request instruction, it calls the corresponding system module interface according to the PC software display result needs to obtain the module response data. For example, add wifi information and query all current wifi configuration information of the system.
[0072] 2) Encapsulate the module response data into a module response instruction and hand it over to the data communication module.
[0073] 3) The data communication module encodes the module response instruction into a URL, encapsulates it into a response data packet according to the data communication protocol, and finally sends it out through the Socket.
[0074] Step 5: The PC software receives the response command and displays the execution result
[0075] 1) The PC management software data communication module reads the sent data through the Socket, parses it according to the data communication protocol, and obtains the response data packet.
[0076] 2) The response data packet is decoded through the URL to obtain the module response instruction, which carries the execution result data, and then the UI interaction module displays the execution result.
[0077] like Figure 2 As shown, the present application also proposes a communication system using a PC to configure intercom system functions, including PC management software and an Android terminal that communicate with each other, wherein the Android terminal includes a management APP and an Android system framework, wherein:
[0078] The PC management software includes a UI interaction module and a PC management software data communication module that communicate with each other;
[0079] The management APP includes a terminal data communication module and a wifi controller, a bluetooth controller, an apn controller, and other controllers that communicate with the terminal data communication module;
[0080] The Android system framework includes a wifi system module, a bluetooth system module, an apn system module, and other system modules that communicate with the wifi controller, the bluetooth controller, the apn controller, and other controllers respectively;
[0081] The PC management software data communication module communicates with the terminal data communication module.
[0082] In this data communication protocol, the data packet is designed as the smallest unit of communication between the PC and the terminal. The structure of each data packet is designed as follows: Figure 3 The data structure of the present invention is only an example, and adjustments based on it, such as frame format position or byte length, etc., are all within the scope of protection.
[0083] 1) Each data packet is divided into three parts: packet header, packet content, and packet tail. The packet type includes request packet and response packet. The end mark of the packet tail is "\r\n\r\n" which is 4 bytes. The packet content length is represented by 4 bytes, so the maximum length supported for the packet content length is 4GB.
[0084] 2) Package content structure. The package content is obtained by URL encoding the request or response instruction, such as Figure 4 URL encoding is used to solve the problem of Chinese garbled characters appearing during communication.
[0085] Request instruction: indicates the request instruction generated by the UI interaction module when operating a system module function of the terminal on the PC management software, such as adding a wifi configuration information including the wifi name and wifi password to the terminal. It is expressed in JSON format and contains the following fields:
[0086]
[0087] For the system module moduleType of the operation, the value examples are as follows:
[0088]
[0089]
[0090] For other modules that need to be operated, any expansion can be performed.
[0091] For different modules, the corresponding actionType has different values. For example, for WIFI operation, the value examples are as follows:
[0092] Wi-Fi Operation Field value Add wifi 1 Check Wi-Fi 2 Delete wifi 3 Update Wi-Fi 4 Connect to wifi 5 ... ...
[0093] For a certain operation of the module, the operation data reqData that needs to be carried is also different. For example, when adding WIFI, the following fields need to be carried:
[0094] Field Name Field Description Field Type Field value networkId Network unique identifier int ssid wifi name String password Wifi password String authType wep, psk and other security types int
[0095] Response command: After receiving the module request command from the PC, the terminal executes the module function and encapsulates the result into a response command and sends it to the PC. It is also expressed in JSON format and contains the following fields:
[0096]
[0097]
[0098] For status codes, the value examples are as follows:
[0099] Status Code illustrate 909 Operation successful 404 Operation failed 405 Operation not supported ... ...
[0100] After the terminal executes the PC's instructions, it sends the data to the PC as respData. The returned data content is different for different operations. For example, for the PC to query the terminal wifi operation, the terminal will return all wifi configuration information to the PC, and respData carries the following fields:
[0101] Field Name Field Description Field Type Field value networkId Network unique identifier int ssid wifi name String password Wifi password String authType wep, psk and other security types int
[0102] In summary, the maximum data length in the communication protocol of this application is 4G, so the request response instruction is large enough to carry data and can meet the needs of large-scale data transmission. The protocol instructions are described in json format, which can be extended arbitrarily and is relatively simple to parse. The protocol is divided into request response packets, and socket communication is used to realize two-way data interaction between PC and terminal. The protocol data will be transmitted in URL encoding, so the garbled problem caused by Chinese transmission can be solved.
[0103] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0104] Therefore, the present application also proposes a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any embodiment of the present application is implemented.
[0105] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0106] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0108] Furthermore, the present application also proposes an electronic device (or computing device), comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any embodiment of the present application when executing the computer program.
[0109] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0110] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A communication method for configuring intercom system functions using a PC, characterized in that: The following steps are involved: The PC management software establishes a Socket connection with the Android terminal; The PC management software sends a system module request instruction to the terminal; The terminal management application receives and executes the PC module request instruction; The terminal sends module response instructions to the PC software; The PC software receives the response command and displays the execution result.
2. A communication method for configuring intercom system functions using a PC according to claim 1, characterized in that: The PC management software establishes a Socket connection with the Android terminal, specifically: After the Android terminal management application is started, the Android terminal data communication module will create a TCP Socket service and listen to a terminal port, waiting for the PC Socket client to connect; The PC is directly connected to the Android terminal via a USB cable, and the USB debugging function is enabled on the Android terminal; After the PC management software is started, the data communication module of the PC management software calls the adb forward command to forward the port, so that the PC software sends data to the PC port, and finally forwards it to the corresponding port of the terminal; The data communication module of the PC management software creates a TCP Socket client and connects to the terminal TCP Socket service through the local address 127.0.0.1 and the PC port.
3. A communication method for configuring intercom system functions using a PC according to claim 1, characterized in that: The PC management software sends a system module request instruction to the terminal, specifically: On the PC management software interface, operate a system module function; The UI interaction module sends a request instruction expressed in JSON format, which is finally passed to the PC management software data communication module; The data communication module encapsulates the request instruction into a request data packet after URL encoding according to the data communication protocol, and finally sends the request data packet out through the Socket.
4. A communication method for configuring intercom system functions using a PC according to claim 1, characterized in that: The terminal management application receives and executes the PC module request instruction, specifically: The terminal data communication module reads the data sent by the PC through the Socket, parses it according to the data communication protocol, and obtains the request data packet; Decode the request data packet through the URL to obtain the request instruction in JSON format; According to the operation module type of the request instruction, the instruction is sent to the corresponding module controller in the application for processing; After receiving the operation instruction, the module controller of the management application finally calls the corresponding system interface of the corresponding module of the Android system framework according to the operation type and operation data, thereby completing the operation of the terminal system function.
5. A communication method for configuring intercom system functions using a PC according to claim 1, characterized in that: The terminal sends a module response instruction to the PC software, specifically: After the module controller of the application executes the request instruction, it calls the corresponding system module interface according to the result display requirements of the PC software to obtain the module response data; Encapsulate the module response data into a response instruction in JSON format and hand it over to the terminal data communication module; The data communication module encodes the module response instruction into a URL, encapsulates it into a response data packet according to the data communication protocol, and finally sends it out through the Socket.
6. A communication method for configuring intercom system functions using a PC according to claim 1, characterized in that: The PC software receives the response instruction and displays the execution result, specifically: The data communication module of the PC management software reads the sent data through the Socket, parses it according to the data communication protocol, and obtains the response data packet; The response data packet is decoded through the URL to obtain the module response instruction, which carries the execution result data, and then handed over to the UI interaction module to display the execution result.
7. A communication system using a PC to configure intercom system functions, characterized in that: It includes PC management software and Android terminal that communicate with each other, and the Android terminal includes management APP and Android system framework, wherein: The PC management software includes a UI interaction module and a PC management software data communication module that communicate with each other; The management APP includes a terminal data communication module and a wifi controller, a bluetooth controller, an apn controller, and other controllers that communicate with the terminal data communication module; The Android system framework includes a wifi system module, a bluetooth system module, an apn system module, and other system modules that communicate with the wifi controller, the bluetooth controller, the apn controller, and other controllers respectively; The PC management software data communication module communicates with the terminal data communication module.
8. A communication system for configuring intercom system functions using a PC according to claim 7, characterized in that: The communication protocol data packet between the PC management software data communication module and the terminal data communication module is divided into three parts: a packet header, a packet content, and a packet tail, wherein the packet type includes a request packet and a response packet.
9. A communication system for configuring intercom system functions using a PC according to claim 8, characterized in that: The package content is obtained by URL encoding the request or response instruction.
10. A communication system for configuring intercom system functions using a PC according to claim 8 or 9, characterized in that: The packet content length is represented by 4 bytes, and the maximum length supported by the packet content length is 4GB.