Communication method of mobile terminal based on Android system, mobile terminal and readable storage medium
By introducing a listener and loader into the mobile terminal, the Hub network port is automatically detected and loaded, which solves the problem that the mobile terminal cannot automatically select multiple Hub functions, realizes the automatic connection and superposition of multiple Ethernet ports, and improves network speed and User experience.
Patent Information
- Application Number
- CN201910966468.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-12
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-10-12
AI Technical Summary
Mobile terminals based on the Android system only support a single Ethernet interface by default and cannot automatically select the multi-Hub function. As a result, users need to manually select an Ethernet port for data communication, which affects the user experience.
By introducing a listener and loader into the mobile terminal, the network port connection status is monitored, and when the Hub network port is detected, the Hub network port is automatically loaded for data communication. The Hub network port is given priority for data communication, or multiple Ethernet ports are The ports are superimposed to achieve super network functions.
It realizes automatic Ethernet connection and data communication of mobile terminals in a multi-Hub environment, improves user experience, increases network upload and download rates, and simplifies the user setup process.
Smart Images

Figure CN110881196B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of information technology, and more specifically, to a communication method of a mobile terminal based on an Android system, a mobile terminal, and a machine-readable storage medium. Background Art
[0002] At present, mobile terminals based on the Android system only support the loading of the Ethernet eth0 interface by default, and can only support Ethernet data communication of a single network port.
[0003] As the market's requirements for networks become higher and higher, it is often necessary to support multiple Hub functions and realize the intelligence of multiple Hubs. Current mobile terminals generally have USB device expansion ports. When users connect their purchased multi-functional Hubs to the USB device expansion port, the mobile terminal forms multiple network ports. At this time, Ethernet needs to be selected for data communication.
[0004] Current mobile terminals provide an Ethernet selection function in the setting interface. Users need to enter the setting interface to select which Ethernet port to use. If the user's technical level is not high and they do not know how to choose, the mobile terminal will not be able to perform data communication, which is likely to affect user use and is not smart enough. Summary of the invention
[0005] The embodiments of the present application provide a communication method for a mobile terminal based on the Android system, a mobile terminal and a machine-readable storage medium, which can intelligently select Ethernet for communication for the user when the mobile terminal finds that a network cable is plugged into the Hub port, thereby realizing automatic connection and communication of Ethernet.
[0006] On the one hand, an embodiment of the present application provides a communication method for a mobile terminal based on an Android system, wherein the mobile terminal loads a default network port, and the method includes:
[0007] When it is monitored that the mobile terminal is externally connected to a Hub and a second network cable is plugged into the Hub network port;
[0008] Load the Hub network port;
[0009] Data communication is performed according to the Hub network port.
[0010] On the other hand, an embodiment of the present application provides a mobile terminal based on the Android system, including a listener, a loader and a communication module;
[0011] The monitor monitors the connection status of the network port of the mobile terminal and the network cable corresponding to the network port;
[0012] The loader loads the Hub network port when the listener detects that the mobile terminal is externally connected to the Hub and a second network cable is plugged into the Hub network port;
[0013] The communication module performs data communication according to the Hub network port loaded by the loader.
[0014] On the other hand, an embodiment of the present application provides a machine-readable storage medium having executable instructions stored thereon, which implement the above method when executed by a machine.
[0015] It can be seen that in the above technical scheme, the mobile terminal based on the Android system provided by this application automatically selects the Ethernet port for data communication for the user when network cables are inserted into both the default interface and the Hub network port. The second Ethernet priority corresponding to the Hub network port in the Android system is higher than the first Ethernet priority corresponding to the default interface such as the RJ45 network port in the Android system, so the Ethernet corresponding to the Hub network port is selected for data communication.
[0016] In addition, the embodiment of the present application also provides a super network function for users when network cables are inserted into both the default interface and the Hub network port. Instead of using a single network, the first Ethernet and the second Ethernet exist at the same time, and the two Ethernets are superimposed. The route of the first Ethernet is added to the route of the second Ethernet to achieve network speed superposition. The network data processing module in the system will automatically judge and split the same data and assign them to the default network port respectively. The Hub network port can improve the upload and download speeds to improve the user's special requirements for the network.
[0017] The embodiment of the present application facilitates merchants using mobile terminals to independently select a network for networking without delaying the work of other hubs, and provides users with a super network function that can increase the Internet access speed of mobile terminals. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. However, those skilled in the art should understand that the drawings described below are only some examples of the present application and do not limit its scope.
[0019] Figure 1A It is a structural diagram of a mobile terminal based on an Android system according to an embodiment.
[0020] Figure 1B is a schematic structural diagram of a POS machine according to an embodiment;
[0021] Figure 2It is a schematic flow chart of a communication method of a mobile terminal based on an Android system according to an embodiment.
[0022] Figure 3 The present invention is a flow chart of inserting a single network cable into a network port to obtain network terminal information according to an embodiment.
[0023] Figure 4 The present invention is a flow chart of obtaining network terminal information by simultaneously inserting two network cables into a network port and unplugging any one of them according to an embodiment. DETAILED DESCRIPTION
[0024] The technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the present application. It should be understood by those skilled in the art that the described embodiment is a part of the embodiment of the present invention, rather than all the embodiments. Based on the embodiment in the present application, those skilled in the art can make any appropriate modifications or variations to obtain all other embodiments.
[0025] Currently, Android only supports the loading of the interface of the default network port by default when it is powered on. It can only support a single hub or a built-in single-port Ethernet connection, but cannot support multiple hub functions.
[0026] In view of this, the present application provides a mobile terminal that supports multiple Hub functions. The mobile terminal uses the Android operating system. Under the current situation that the Android system can only load one network port by default, data communication under multiple Ethernet ports is realized by modifying the loading process and the assignment of public variables. Moreover, under multiple Ethernet ports, the present application provides a function of automatically selecting a network for Internet access according to the network cable insertion status of the Ethernet interface. In this way, even if the mobile terminal has multiple Ethernet plug-in cables, it can automatically connect to the network according to the priority of the Ethernet default network port and the Hub network port, and can also realize a super network with dual Ethernet superposition, providing users with a number of intelligent functions.
[0027] The above technical solution will be described in detail below in conjunction with specific embodiments.
[0028] In one embodiment, as shown in FIG. 1 , in the mobile terminal based on the Android system of the embodiment of the present application, the mobile terminal loads a default network port by default, and the mobile terminal also provides a USB expansion interface. The user accesses the Hub through the USB expansion interface to form a Hub network port, and inserts a second network cable into the Hub network port to form a mobile terminal with multiple Hub functions.
[0029] The embodiment of the present application provides how the mobile terminal with multiple hub functions selects Ethernet for users to perform data communication. Specifically, two solutions are provided. One is to select one from multiple Ethernets for data communication, and the other is to superimpose multiple Ethernets to provide users with super network functions and improve Internet access speed.
[0030] The following example uses the default network port as eth0 and the Hub network port as eth1 to illustrate the technical solution of this proposal.
[0031] Referring to FIG. 1 , the mobile terminal based on the Android system provided in the embodiment of the present application includes a listener 101 , a loader 102 and a communication module 103 ;
[0032] The monitor 101 monitors the connection status of the network port of the mobile terminal and the network cable corresponding to the network port;
[0033] The loader 102 loads the Hub network port when the monitor 101 monitors that the mobile terminal is externally connected to the Hub and a second network cable is plugged into the Hub network port;
[0034] The communication module 103 performs data communication according to the Hub network port loaded by the loader 102 .
[0035] When the monitor detects that the mobile terminal is connected to the first network cable and the first network cable is plugged into the default network port, it indicates that the current mobile terminal is connected to the network cable through both the default network port and the Hub network port. There are two communication modes when two network cables are plugged into the network ports at the same time:
[0036] First, a single network is selected from multiple Ethernet networks for data communication. In this case, the communication module includes a first communication unit and a second communication unit; the first communication unit is used to perform data communication according to the Hub network port loaded by the loader; the second communication unit is used to disconnect the data communication of the default network port.
[0037] In this way, the system of the mobile terminal determines the priority of Ethernet eth0 and eth1 to automatically connect to the network. In the embodiment of the present application, when it is detected that the multi-function Hub is connected to the USB device expansion port and connected to the second network cable, eth1 must be actively loaded when it is turned on, and the priority of eth1 is set to the highest. eth1 is used for data communication, and eth0 is disconnected.
[0038] Second, multiple Ethernet networks are superimposed to generate a super network. At this time, the communication module has a first communication unit and a third communication unit; the first communication unit is used to perform data communication according to the Hub network port loaded by the loader; the third communication unit is used to maintain data communication of the default network port, and the default network port and the Hub network port are superimposed for data communication.
[0039] The super network function means canceling the Ethernet priority scoring judgment in the Android system, allowing eth0 and eth1 to exist at the same time. Instead of using one network separately, the two Ethernets are superimposed, and the route of the first Ethernet corresponding to eth0 is added to the route of the second Ethernet corresponding to eth1 to achieve network speed superposition. The network data processing module in the system will automatically judge and split the same data and assign them to eth0 and eth1 to achieve an increase in upload and download rates to improve users' special requirements for the network.
[0040] In actual applications, the listener may be an InterfaceObserver listener, and the mobile terminal may be a POS machine. The following description is made with the mobile terminal being a POS machine.
[0041] Specifically, when the monitor 101 detects that there is a hub in the POS machine and a second network cable is plugged into the hub port, the loader 102 updates the value of mIface to eth1; if no Hub connection is detected, indicating that the network cable is plugged into the RJ45 port, the value of mIface is eth0.
[0042] In an embodiment of the present application, the mobile terminal provides a configuration relationship between eth0 and eth1. Through the configuration relationship, it can independently determine the choice of Ethernet to automatically connect to the network. It can choose to use a network with a higher priority as the Ethernet connection state, and can choose to superimpose the networks corresponding to eth0 and eth1 as the Ethernet connection state, thereby improving the intelligence of the mobile terminal.
[0043] The implementation method for superimposing the networks corresponding to eth0 and eth1 can be to superimpose the route of the first Ethernet corresponding to eth0 onto the route of the second Ethernet corresponding to eth1, or to superimpose the route of the second Ethernet corresponding to eth1 onto the route of the first Ethernet corresponding to eth0, so as to achieve the superposition of network speed.
[0044] When the networks corresponding to eth0 and eth1 are superimposed, the structural diagram of the POS machine is as follows: Figure 1B The system also includes a data processor 104 connected to the communication module 103. When receiving upload data or download data, the data processor 104 splits the upload data or download data and sends them to eth0 and eth1 respectively for transmission, thereby improving the upload rate or download rate.
[0045] It can be seen that in the above technical solution, since it is detected that there is a hub in the POS machine and the network cable is inserted into the hub port, the hub port is automatically selected for data communication, so that the POS machine can intelligently support data communication under multiple Ethernet networks, and no longer requires manual settings by the user. Moreover, the automatic selection of the hub port for data communication is achieved by assigning the value of the network port public variable mIface. When two network cables are inserted into the hub and the RJ45 port at the same time, the mIface value is set to eth1 to avoid startDHCP conflicts, and then the Ethernet connection status is selected according to the configuration relationship between eth0 and eth1, such as using the eth1 network port to obtain relevant network information for Internet access, so as to realize the communication of POS under multiple Ethernet networks, without the need for users to manually select which network to use in the settings, and provide users with intelligent functions.
[0046] In one embodiment, Figure 2 It is a schematic flow chart of a communication method of a mobile terminal based on an Android system according to an embodiment.
[0047] Figure 2 In the present invention, the communication method of the mobile terminal based on the Android system includes:
[0048] Step 201: The mobile terminal loads the default network port;
[0049] Step 202: When it is detected that the mobile terminal is connected to a Hub and a second network cable is plugged into the Hub network port, the Hub network port is loaded;
[0050] Step 203: Perform data communication according to the Hub network port.
[0051] Among them, there is a monitor for monitoring the network port in the mobile terminal. When it monitors that the mobile terminal is connected to a Hub and a second network cable is inserted into the Hub network port, it indicates that the mobile terminal has at least an external network cable at the Hub port. At this time, the second Ethernet corresponding to the Hub network port is used for data communication.
[0052] In step 201, the mobile terminal loads the default network port, specifically including: assigning the network port public variable value mIface in the mobile terminal interface function to the default network port;
[0053] The corresponding step 202 loads the Hub network port, which specifically includes: updating the value of miface to the Hub network port, or increasing the value of miface to the Hub network port, that is, the value of miface can be modified or increased.
[0054] In practical applications, the mobile terminal may be a POS machine. In combination with the actual situation, the following describes the implementation of the present invention in detail by taking the default network port of the POS machine as eth0 and the Hub network port as eth1 as an example.
[0055] In actual applications, the mobile terminal has two types of network ports: the default network port and the Hub network port. When the user accesses the network cable through the default network port and the Hub network port respectively, it will be monitored that the default network port of the mobile terminal is plugged into the first network cable and the Hub network port is plugged into the second network cable. At this time, it belongs to the situation of dual network cable insertion and multiple Ethernet states exist. Ethernet needs to be selected for the user for data communication.
[0056] When dual network cables are inserted into the mobile terminal, select the Ethernet connection status according to the configuration relationship between eth0 and eth1 for data communication. There are two specific methods:
[0057] First, the system of the mobile terminal determines the priority of Ethernet eth0 and eth1 and automatically connects to the network. In the embodiment of the present application, the first network cable is inserted into the default network port, and it is detected that the USB device expansion port of the mobile terminal is connected to a multi-function Hub. When the second network cable is inserted into the Hub network port, the use priority of eth1 is configured to be higher than the use priority of eth0, and data communication is performed preferentially through eth1.
[0058] In this case, eth1 needs to be actively loaded when booting, and the priority of eth1 is set to the highest. Then the mobile terminal can automatically use eth1 for data communication and disconnect the data communication of eth0.
[0059] When two network cables are inserted into the Hub network port and the default network port at the same time, the mIface value will be automatically set to eth1 to avoid startDHCP conflicts. The eth1 network port will be used first to obtain relevant network information for Internet access, realizing POS communication under multiple Ethernet networks. There is no need for users to manually select which network to use for Internet access in the settings. The background will automatically determine the network for Internet access based on priority.
[0060] Second, multiple Ethernet networks are superimposed to generate a super network, the data communication of eth0 is maintained, and the first Ethernet corresponding to eth0 and the second Ethernet corresponding to eth2 are superimposed to perform data communication.
[0061] The super network function means canceling the Ethernet priority scoring judgment in the Android system, allowing eth0 and eth1 to exist at the same time. Instead of using one network alone, the two Ethernets are superimposed, and the route of the first Ethernet corresponding to eth0 is added to the route of the second Ethernet corresponding to eth1, or the route of the first Ethernet corresponding to eth0 is superimposed on the route of the second Ethernet corresponding to eth1, so as to achieve the superposition of network speed.
[0062] When the POS machine provides a super network for data transmission, the embodiment of the present application also splits the same data and allocates them to eth0 and eth1 respectively, splits the upload data or download data during data communication into two copies of data, and performs data communication through eth0 and eth1 respectively, thereby improving the upload and download speeds, thereby improving users' requirements for high-speed data transmission on the network.
[0063] This application realizes the autonomous selection of Internet access when two network cables are inserted into the network port at the same time, and the update of Internet information status by unplugging the network port of any network cable, and supports network port loading and network cable connection after startup.
[0064] The following describes in detail the process of obtaining network information by inserting a single network cable into the network port, inserting two network cables into the network port at the same time, and unplugging any one of them.
[0065] like Figure 3 As shown in the figure, a single network cable is inserted into the network port, and the POS machine obtains the network end information flow chart. When a single network cable is inserted into the network port, determine whether the network port ID is eth0 or eth1. If the network port is eth1, modify the mIface value, record the network port connection status as persist.sys.ethernet.eth1 / eth0, start the DHCP service to obtain the network end related address, and send a broadcast notification of the network connection status.
[0066] like Figure 4 The two network cables shown are plugged into the network port at the same time and any one of them is unplugged, and the POS machine obtains network information flow chart,
[0067] When two network cables are plugged into the network port at the same time, modify the mIface value to eth1, record the network port connection status as persist.sys.ethernet.eth1 / eth0, close the eth0 network end disconnect, open the eth1 network end, send a broadcast, start the DHCP service to obtain the network end related address, and send a broadcast to notify the network connection status.
[0068] When two network cables are plugged into the network port at the same time, you can also modify the mIface value to eth1
[0069] Monitor the network cable connection status of the Hub port or the default network port. When the network cable of the Hub port is disconnected, that is, when any network cable is unplugged, update the value of miface to the default network port and clear the network port information of the Hub port; or, when the network cable of the default network port is disconnected, update the value of miface to the Hub port and clear the network port information of the default network port. Start the DHCP service to obtain the relevant address of the network end and send a broadcast to notify the network connection status.
[0070] The method provided in the embodiment of the present application monitors the network cable insertion status of the default interface and the Hub network port of the mobile terminal, and provides a method of automatically selecting one Ethernet for communication when the default interface and the Hub network port have network cables inserted. It also provides a super network function, which does not use one network alone, but rather allows the first Ethernet and the second Ethernet to exist at the same time, superimposes the two Ethernets, adds the route of the first Ethernet to the route of the second Ethernet, and realizes the superposition of network speed. The network data processing module in the system will automatically judge and split the same data and assign them to the default network port respectively. The Hub network port realizes the improvement of upload and download speed to improve the user's special requirements for the network.
[0071] The embodiment of the present invention facilitates merchants using mobile terminals to independently select a network for networking without delaying the work of other hubs, and provides users with a super network function that can improve the Internet access speed of the mobile terminal.
[0072] In addition, the embodiment of the present application further provides a machine-readable storage medium. The machine-readable storage medium may store executable instructions, and when the executable instructions are executed by a machine, the machine implements the specific process of the method embodiment described above with reference to the above.
[0073] For example, machine-readable storage media may include, but are not limited to, random access memory (RAM), read-only memory (ROM), electrically-erasable programmable read-only memory (EEPROM), static random access memory (SRAM), hard disk, flash memory, and the like.
[0074] It will be appreciated by those skilled in the art that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0075] In the embodiments of the present application, the disclosed systems, devices and methods can be implemented in other ways. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system. In addition, the coupling between the units can be direct coupling or indirect coupling. In addition, the functional units in the embodiments of the present application can be integrated into a processing unit, or can be separate physical existences, etc.
[0076] 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 machine-readable storage medium. Therefore, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a machine-readable storage medium, which can include several instructions to enable an electronic device to perform all or part of the technical solution described in the embodiments of the present application. The above-mentioned storage medium may include various media that can store program codes, such as ROM, RAM, removable disk, hard disk, magnetic disk or optical disk.
[0077] The above contents are only specific implementation methods of the present application, and the protection scope of the present application is not limited thereto. Those skilled in the art may make changes or substitutions within the technical scope disclosed in the present application, and these changes or substitutions shall be within the protection scope of the present application.
Claims
1. A communication method for a mobile terminal based on an Android system, wherein the mobile terminal loads a default network port, characterized in that: The method comprises: When it is detected that the mobile terminal is connected to a hub and a second network cable is plugged into the hub's network port; Load the Hub network port; Perform data communication according to the Hub network port; The default network ports loaded by the mobile terminal include: The network port public variable value mIface in the mobile terminal interface function is assigned the default network port; The corresponding loading hub network port specifically includes: Update the value of the miface to the Hub network port, or increase the value of the miface to the Hub network port; After monitoring that the mobile terminal is connected to an external hub, the method further includes: monitoring that the mobile terminal is connected to a first network cable, and the first network cable is plugged into a default network port; Correspondingly, after the Hub network port is loaded, the method further includes: disconnecting the data communication of the default network port; After monitoring that the mobile terminal is connected to an external hub, the method further includes: Correspondingly, after the Hub network port is loaded, the method further includes: maintaining data communication of the default network port, and superimposing the first Ethernet corresponding to the default network port and the second Ethernet corresponding to the Hub network port to perform data communication; The method further comprises: Split the uploaded or downloaded data into two parts during data communication; Data communication is performed through the default network port and the Hub network port respectively.
2. The method according to claim 1, characterized in that The superimposing the first Ethernet and the second Ethernet specifically includes: Add the route of the second Ethernet to the route of the first Ethernet, or add the route of the first Ethernet to the route of the second Ethernet.
3. The method according to claim 1, characterized in that After the data communication, the method further includes: Monitor the network cable connection status of the Hub port or the default network port; When the network cable of the Hub port is disconnected, the value of the miface is updated to the default network port and the network port information of the Hub port is cleared; Or, when it is detected that the network cable of the default network port is disconnected, the value of the miface is updated to the Hub network port, and the network port information of the default network port is cleared.
4. The method according to any one of claims 1 to 3, characterized in that: The mobile terminal is a POS machine.
5. A mobile terminal based on the Android system, characterized in that: The mobile terminal includes a listener, a loader and a communication module; The monitor monitors the connection status of the network port of the mobile terminal and the network cable corresponding to the network port; The loader loads the Hub network port when the listener detects that the mobile terminal is externally connected to the Hub and a second network cable is plugged into the Hub network port; A communication module, performing data communication according to the Hub network port loaded by the loader; When the monitor monitors that the mobile terminal is connected to a first network cable, and the first network cable is plugged into a default network port; The communication module includes a first communication unit, a second communication unit and a third communication unit; The first communication unit is used to perform data communication according to the Hub network port loaded by the loader; The second communication unit is used to disconnect the data communication of the default network port; The third communication unit is used to maintain data communication of the default network port and perform data communication after superimposing the default network port and the Hub network port; The mobile terminal loading the default network port specifically includes: assigning the network port public variable value mIface in the mobile terminal interface function to the default network port; The Hub network port loaded by the loader specifically includes: updating the value of the miface to the Hub network port, or adding the value of the miface to the Hub network port; The monitor is used to monitor that the mobile terminal is connected to the first network cable, and the first network cable is inserted into the default network port. Accordingly, after the hub network port is loaded, the data communication of the default network port is disconnected, the data communication of the default network port is maintained, and the first Ethernet corresponding to the default network port and the second Ethernet corresponding to the hub network port are superimposed to perform data communication; The communication module is used to split the uploaded data or downloaded data during data communication into two parts of data, and perform data communication through the default network port and the Hub network port respectively. The mobile terminal according to claim 5, wherein: The mobile terminal is a POS machine, and the listener is an InterfaceObserver listener.
7. A machine-readable storage medium having executable instructions stored thereon, wherein when the executable instructions are executed by a machine, the method according to any one of claims 1 to 3 is implemented.
