Terminal device and wired network sharing method
Patent Information
- Application Number
- CN202310962088.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-01
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-08-01
AI Technical Summary
[0005]本申请提供了一种终端设备及有线网络共享方法,以解决网络共享时需要上行网络先连接再共享的问题
[0014]由以上技术方案可知,上述实施例提供的终端设备及有线网络共享方法,可以响应于终端设备的开机事件,监测网络网口的节点状态,在节点状态为连通状态时,设置网络网口的网口模式为服务器模式,其中,服务器模式用于表征网络网口为网络共享的出口。并为网络网口连接的外接设备设置网络共享参数,以及基于网络共享参数向外接设备共享网络。所述方法可以在开机后可以自动进行有线网络共享,建立终端设备与外接设备网络共享的通道,并监听上行网络变化,在监听到终端设备连接至上行网络后,建立外接设备与上行网络的数据转发通路,从而实现外接设备的网络使用,解决网络共享时需要上行网络先连接再共享的问题。
Smart Images

Figure CN117615201B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network sharing technology, and in particular to a terminal device and a wired network sharing method. Background Technology
[0002] Terminal devices refer to devices that input programs and data to a computer or receive processed results from a computer via communication facilities. These can include smart TVs, mobile phones, communication terminals, smart advertising screens, projectors, and other terminal devices. Taking smart TVs as an example, a smart TV is a television product based on Internet application technology, possessing an open operating system and chip, an open application platform, and enabling two-way human-computer interaction. It integrates multiple functions such as audio-visual entertainment and data to meet diverse and personalized user needs.
[0003] Terminal devices can connect to the network via wired or wireless connections to access the internet. To improve user experience, terminal devices can support network sharing functions, including Bluetooth, hotspot, USB, and wired network sharing. Users can share the network from the terminal device with other devices using these methods, enabling those devices to access the network.
[0004] However, to achieve network sharing, users need to first connect their terminal devices to the local network. After the connection is successful, they need to check whether the device to be shared is available. If it is available, then network sharing can be performed. This method of requiring an uplink network connection before sharing limits the use cases of network sharing and reduces the user experience. Summary of the Invention
[0005] This application provides a terminal device and a wired network sharing method to solve the problem that the uplink network needs to be connected before sharing when sharing the network.
[0006] Firstly, some embodiments of this application provide a terminal device, including a network port and a controller. The network port is configured to establish a connection with an external device; the controller is configured to execute the following program steps:
[0007] In response to the power-on event of the terminal device, monitor the node status of the network port;
[0008] When the node is in a connected state, the network port mode is set to server mode. The server mode is used to indicate that the network port is a network shared exit point.
[0009] Configure network sharing parameters for the external device connected to the network port, and share the network with the external device based on the network sharing parameters.
[0010] Secondly, some embodiments of this application provide a wired network sharing method applied to the aforementioned terminal device, the wired network sharing method comprising the following steps:
[0011] In response to the power-on event of the terminal device, the node status of the network port is monitored, and the network port establishes a connection with the external device;
[0012] When the node is in a connected state, the network port mode is set to server mode. The server mode is used to indicate that the network port is a network shared exit point.
[0013] Configure network sharing parameters for the external device connected to the network port, and share the network with the external device based on the network sharing parameters.
[0014] As can be seen from the above technical solutions, the terminal device and wired network sharing method provided in the above embodiments can respond to the power-on event of the terminal device, monitor the node status of the network port, and set the network port mode to server mode when the node status is connected. Server mode is used to characterize the network port as the network sharing exit point. Network sharing parameters are set for the external device connected to the network port, and network sharing is performed with the external device based on these parameters. The method can automatically perform wired network sharing after power-on, establish a network sharing channel between the terminal device and the external device, and monitor uplink network changes. After detecting that the terminal device is connected to the uplink network, a data forwarding path is established between the external device and the uplink network, thereby enabling the external device to use the network and solving the problem that the uplink network needs to be connected before sharing. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram illustrating the operational scenarios between a terminal device and a control device provided in some embodiments of this application;
[0017] Figure 2 This is a schematic diagram of the hardware configuration of the control device provided in some embodiments of this application;
[0018] Figure 3 This is a schematic diagram of the hardware configuration of a terminal device provided in some embodiments of this application;
[0019] Figure 4This is a schematic diagram of the software configuration of a terminal device provided in some embodiments of this application;
[0020] Figure 5 This is a network sharing diagram of terminal devices provided in some embodiments of this application;
[0021] Figure 6 A schematic diagram illustrating the network sharing process provided in some embodiments of this application;
[0022] Figure 7 A schematic diagram illustrating a use case of the wired network sharing method provided in some embodiments of this application;
[0023] Figure 8 A flowchart illustrating a wired network sharing method provided in some embodiments of this application;
[0024] Figure 9 A schematic diagram of a network sharing interface provided in some embodiments of this application;
[0025] Figure 10 A flowchart illustrating the process of setting up a shared mode for a network port according to some embodiments of this application;
[0026] Figure 11 Provided for some embodiments of this application Figure 7 A schematic diagram illustrating the wired network sharing process in this scenario;
[0027] Figure 12 This is a schematic diagram illustrating the process of performing network sharing as provided in some embodiments of this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the exemplary embodiments of this application clearer, the technical solutions in the exemplary embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described exemplary embodiments are only some embodiments of this application, and not all embodiments.
[0029] Based on the exemplary embodiments shown in this application, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application. Furthermore, although the disclosures in this application are presented by way of one or more exemplary examples, it should be understood that each aspect of these disclosures can constitute a complete technical solution on its own.
[0030] It should be understood that the terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate, for example, to allow implementation in orders other than those given in the embodiments illustrated or described in this application.
[0031] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclusively include, for example, a product or device that includes a series of components is not necessarily limited to those that are explicitly listed, but may include other components that are not explicitly listed or that are inherent to such product or device.
[0032] The terminal device provided in this application can have various implementation forms, such as a television, a smart television, a laser projection device, a monitor, an electronic bulletin board, an electronic table, etc. Figure 1 and Figure 3 This is one specific implementation of the terminal device of this application.
[0033] Figure 1 This is a schematic diagram illustrating the operational scenario between the terminal device and the control device according to the embodiment. Figure 1 As shown, the user can operate the terminal device 200 through the smart device 300 or the control device 100.
[0034] In some embodiments, the control device 100 may be a remote control. Communication between the remote control and the terminal device includes infrared protocol communication, Bluetooth protocol communication, and other short-range communication methods, controlling the terminal device 200 wirelessly or via wired means. Users can control the terminal device 200 by inputting user commands through buttons on the remote control, voice input, control panel input, etc.
[0035] In some embodiments, a smart device 300 (such as a mobile terminal, tablet computer, computer, laptop computer, etc.) may also be used to control the terminal device 200. For example, an application running on the smart device may be used to control the terminal device 200.
[0036] In some embodiments, the terminal device may receive instructions not through the aforementioned smart devices or control devices, but through touch or gestures.
[0037] In some embodiments, the terminal device 200 can also be controlled in ways other than the control device 100 and the smart device 300. For example, it can directly receive the user's voice commands through a module configured inside the terminal device 200 that acquires voice commands, or it can receive the user's voice commands through a voice control device set outside the terminal device 200.
[0038] In some embodiments, the terminal device 200 also communicates with the server 400. The terminal device 200 may communicate via a local area network (LAN), wireless local area network (WLAN), and other networks. The server 400 may provide various content and interactive features to the terminal device 200. The server 400 may be a cluster or multiple clusters, and may include one or more types of servers.
[0039] Figure 2 An exemplary block diagram of the configuration of the control device 100 according to an exemplary embodiment is shown. Figure 2 As shown, the control device 100 includes a controller 110, a communication interface 130, a user input / output interface 140, a memory, and a power supply. The control device 100 can receive user input operation commands and convert the operation commands into commands that the terminal device 200 can recognize and respond to, thus acting as an intermediary for interaction between the user and the terminal device 200.
[0040] like Figure 3 As shown, the terminal device 200 includes at least one of the following: a tuner 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, and a user interface.
[0041] In some embodiments, the controller includes a processor, a video processor, an audio processor, a graphics processor, RAM, ROM, and a first to an nth interface for input / output.
[0042] The display 260 includes a display screen assembly for presenting images, a driving assembly for driving image display, a component for receiving image signals from the controller output, and a user control UI interface for displaying video content, image content, menu control interface, and user control UI interface.
[0043] The display 260 can be an LCD display, an OLED display, or a projection display, and can also be a projection device and a projection screen.
[0044] The communicator 220 is a component used to communicate with external devices or servers according to various communication protocol types. For example, the communicator may include at least one of the following: a Wi-Fi module, a Bluetooth module, a wired Ethernet module, other network communication protocol chips or near-field communication protocol chips, and an infrared receiver. The terminal device 200 can establish the transmission and reception of control signals and data signals with the control device 100 or the server 400 through the communicator 220.
[0045] The user interface can be used to receive control signals from the control device 100 (such as an infrared remote control).
[0046] Detector 230 is used to collect signals from the external environment or to interact with the external environment. For example, detector 230 includes a light receiver, a sensor for collecting ambient light intensity; or, detector 230 includes an image acquisition device, such as a camera, which can be used to collect external environmental scenes, user attributes, or user interaction gestures; or, detector 230 includes a sound acquisition device, such as a microphone, for receiving external sounds.
[0047] The external device interface 240 may include, but is not limited to, one or more of the following: High Definition Multimedia Interface (HDMI), analog or high-definition component input interface (component), composite video input interface (CVBS), USB input interface (USB), RGB port, etc. It may also be a composite input / output interface formed by multiple interfaces mentioned above.
[0048] The tuner / demodulator 210 receives broadcast television signals via wired or wireless means, and demodulates audio and video signals, such as EPG data signals, from multiple wireless or wired broadcast television signals.
[0049] In some embodiments, the controller 250 and the tuner 210 may be located in different separate devices, that is, the tuner 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.
[0050] The controller 250 controls the operation of the terminal device and responds to user operations through various software control programs stored in the memory. The controller 250 controls the overall operation of the terminal device 200. For example, in response to receiving a user command to select a UI object to display on the display 260, the controller 250 can execute operations related to the object selected by the user command.
[0051] In some embodiments, the controller includes at least one of a central processing unit (CPU), a video processor, an audio processor, a graphics processing unit (GPU), a RAM (Random Access Memory), a ROM (Read-Only Memory), a first to an nth interface for input / output, a communication bus, etc.
[0052] Users can input commands through a graphical user interface (GUI) displayed on the monitor 260, and the user input interface receives the user input commands through the GUI. Alternatively, users can input commands by entering specific sounds or gestures, and the user input interface receives the user input commands by recognizing the sounds or gestures through sensors.
[0053] A "user interface" is the medium through which an application or operating system interacts and exchanges information with the user. It converts information from its internal form to a form that the user can accept. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be an icon, window, control, or other interface element displayed on the screen of an electronic device. Controls can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.
[0054] like Figure 4 As shown, in some embodiments, the system is divided into four layers, from top to bottom: the Applications layer (referred to as the "Application Layer"), the Application Framework layer (referred to as the "Framework Layer"), the Android runtime and system library layer (referred to as the "System Runtime Layer"), and the kernel layer.
[0055] In some embodiments, at least one application runs in the application layer. These applications may be Windows programs, system settings programs, or clock programs that come with the operating system; they may also be applications developed by third-party developers. In specific implementations, the application packages in the application layer are not limited to the examples above.
[0056] The framework layer provides application programming interfaces (APIs) and a programming framework for applications. The application framework layer includes predefined functions. It acts as a central processing unit, determining the actions taken by applications within the application layer. Through the API, applications can access system resources and obtain system services during execution.
[0057] like Figure 4 As shown, the application framework layer in this embodiment includes managers, content providers, etc., wherein the managers include at least one of the following modules: ActivityManager, which interacts with all activities running in the system; LocationManager, which provides access to system location services for system services or applications; PackageManager, which retrieves various information related to application packages currently installed on the device; NotificationManager, which controls the display and clearing of notification messages; and WindowManager, which manages icons, windows, toolbars, wallpapers, and desktop widgets on the user interface.
[0058] In some embodiments, the Activity Manager manages the lifecycle of individual applications and common navigation and back functions, such as controlling application exit, opening, and back actions. The Window Manager manages all window programs, such as obtaining the screen size, determining if a status bar is present, locking the screen, capturing the screen, and controlling display window changes (e.g., shrinking the display window, shaking the display, distorting the display, etc.).
[0059] In some embodiments, the system runtime library layer provides support for the upper layer, namely the framework layer. When the framework layer is used, the Android operating system runs the C / C++ libraries contained in the system runtime library layer to implement the functions that the framework layer needs to perform.
[0060] In some embodiments, the kernel layer is a layer between hardware and software. For example... Figure 4 As shown, the kernel layer includes at least one of the following drivers: audio driver, display driver, Bluetooth driver, camera driver, WIFI driver, USB driver, HDMI driver, sensor driver (such as fingerprint sensor, temperature sensor, pressure sensor, etc.), and power driver.
[0061] In some embodiments, the terminal device 200 has Internet access functionality, allowing users to access the Internet and browse various media resources on the network, such as watching media resources on the network, and also to perform Internet access functions such as video chat.
[0062] In some embodiments, the terminal device 200 can connect to the network via a wired connection. The terminal device 200 may be provided with a network interface through which one end of a network cable can be connected, and the other end of the network cable can be connected to an electronic device that provides the network, such as a router, to achieve a wired connection between the terminal device 200 and the electronic device that provides the network, thereby connecting to the network provided by these electronic devices.
[0063] In some embodiments, the terminal device 200 can connect to the network wirelessly. The terminal device 200 can connect wirelessly to electronic devices that provide a network, such as routers. For example, a router can provide WiFi, and the terminal device can connect to this WiFi to access the network.
[0064] The terminal device 200 may also include a communicator 220, which enables the terminal device 200 to communicate with other electronic devices and perform data exchange and other operations. The communicator 220 may include a Bluetooth module for controlling the terminal device 200 to turn Bluetooth on and off. The communicator 220 may also include a WiFi module for WiFi connectivity and an infrared receiver module for receiving infrared signals. Based on the communicator 220, the terminal device can establish various forms of communication connections with electronic devices, including Bluetooth, infrared, and WiFi connections.
[0065] In some embodiments, such as Figure 5 As shown, terminal device 200 has network sharing capabilities, including Bluetooth, hotspot, USB, and wired network sharing methods. Users can share the network from terminal device 200 with other devices through these methods, enabling other devices to access the network. In other words, when terminal device 200 connects to the internet via a data network, it can share its internet access service with other devices (such as Wi-Fi, Bluetooth, hotspot, and USB ports) through its downstream functions. Figure 5 The devices shown (such as gaming devices, mobile terminals, and computers) enable other devices to access the Internet.
[0066] For example, network sharing can be achieved through the WiFi hotspot function of terminal device 200. Terminal device 200 accesses the Internet through mobile operator's data service and simultaneously activates its wireless AP function, allowing surrounding devices to connect to terminal device 200 via WiFi and share its Internet access. Another example is that terminal device 200 can connect to other devices via Bluetooth to share the network.
[0067] like Figure 6 The diagram illustrates the network sharing process provided in this embodiment. For a terminal device 200 that already has a network connection, network sharing is performed. First, the user enters the settings interface by clicking the "Settings" option provided by the terminal device 200, and then clicks the "Network Sharing" option to enable network sharing, starting the network sharing service of the terminal device 200, i.e., the IP Server, allowing other devices to connect and use the shared network connection. Next, the Dynamic Host Configuration Protocol (DHCP) server is configured and started. The DHCP Server is used to allocate IP addresses and other network configuration information. When configuring the DHCP Server, its IP address and subnet mask are set. By configuring and starting the DHCP Server, other devices can obtain the required IP address, subnet mask, and other information through the DHCP Server. Then, the upstream network interface card (NIC) is obtained. The upstream NIC refers to the NIC interface connected to the Internet or other networks to correctly route data traffic during network sharing. Next, configure and start the IP Forward service and Domain Name Service (DNS Service). IP Forward refers to the function of forwarding data packets from one network interface to another in a shared network. Configuring and starting the IP Forward service ensures that data in the shared network can be forwarded correctly. Finally, configure IP rule and IP tables. IP rule and IP tables are tools used to set network rules and configure firewalls. You can configure IP rule and iptables rules according to actual needs to achieve network traffic control and security.
[0068] Based on the aforementioned network sharing method, for a terminal device 200 with a network connection, other devices can connect to the shared network of terminal device 200 wirelessly or via wired connection to obtain internet access. However, to achieve network sharing, the user needs to first connect terminal device 200 to the local network, and then check if the device requiring network sharing is available. If it is available, network sharing can then proceed. In other words, terminal device 200 can only interconnect with other devices and share the network after it has accessed the internet. This method, which requires an uplink network connection before sharing, limits the use cases for network sharing. For example, if a user only wants to establish a pathway when sharing the network, meaning terminal device 200 can interconnect with other devices even without an uplink network connection.
[0069] To address the issue of limited network sharing, some embodiments of this application also provide a wired network sharing method applied to a terminal device 200. Upon power-on, this method automatically establishes a wired network sharing channel between the terminal device 200 and an external device, and monitors uplink network changes, thereby enabling the external device to use the network. The terminal device 200, capable of applying the wired network sharing method, includes a network port and a controller 250. The network port is configured to establish a connection with the external device, and the controller 250 is configured to execute the aforementioned wired network sharing method.
[0070] like Figure 7 As shown, Figure 7 This is a schematic diagram illustrating a use case of the wired network sharing method in this application embodiment. The terminal device 200 can connect to an upstream network to achieve network access. An upstream network refers to the direction in which data flows from the local network to other network nodes or an upstream network. It can refer to electronic devices such as switches and routers connected to the local network, responsible for transmitting data to other network nodes or an upstream network. Upstream networks include wired networks and wireless networks; that is, the terminal device 200 can connect to the network using either a wired or wireless connection.
[0071] To connect to and share a network, the terminal device 200 includes two network ports: eth1 and eth0. The terminal device 200 can connect via the eth0 port to network-providing electronic devices such as routers via a wired connection, and can also connect wirelessly to the WiFi provided by routers or similar electronic devices, thus achieving uplink network connectivity. The eth1 port is used to establish connections with external devices. One end of a network cable can be connected through the eth1 port, and the other end of the network cable can be connected to the external device, thus achieving a wired connection between the terminal device 200 and the external device.
[0072] External devices refer to devices that are connected to the shared network, such as Open Pluggable Specification (OPS) computers, smart TVs, laser projectors, monitors, electronic bulletin boards, etc.
[0073] After the network cable of the external device is plugged into the eth1 port, the terminal device 200 can interconnect with the external device, establishing a network sharing channel between the terminal device 200 and the external device through the eth1 port. Once the terminal device 200 is connected to the uplink network, it can share the network with the external device connected to the eth1 port, thus enabling the external device to connect to the network. In other words, once the external device is wired to the terminal device 200 through the eth1 port, it can interconnect with the terminal device 200, regardless of whether the terminal device 200 has an uplink network connection. Furthermore, once the terminal device 200 is connected to the uplink network, it can share the network with the external device, breaking the limitation that network sharing requires an uplink network connection before sharing.
[0074] It is understandable that the number of eth1 network ports is not limited. Figure 7 As shown, the terminal device 200 can determine the number of devices that can share the network based on the number of eth1 network ports. If there is one eth1 network port, then there is one external device sharing the network. If there are multiple eth1 network ports, then there are multiple external devices sharing the network.
[0075] like Figure 8 As shown, Figure 8 This is a flowchart illustrating the wired network sharing method in this application, specifically including the following:
[0076] S100: In response to the power-on event of the terminal device, monitor the node status of the network port.
[0077] The controller 250 of the terminal device 200 can receive various control commands input by the user during use, thereby controlling the overall operation of the display device 200. Different control commands correspond to different functions. For example, the user can click the "Settings" option provided by the terminal device 200 to access the settings interface. The settings interface includes a "Network Sharing" option, which the user can click to access settings such as… Figure 9The network sharing interface shown includes network sharing methods such as Bluetooth network sharing, USB network sharing, and wired network sharing. Users can click on the corresponding options to control the terminal device 200 to perform network sharing based on the corresponding network sharing method. Clicking the "Wired Network Sharing" option allows the user to input a command for wired network sharing to the controller 250. The controller 250 can respond to this command and control the terminal device 200 to execute the wired network sharing method provided in this embodiment.
[0078] To reduce user operation steps, the wired network sharing method provided in this application can be automatically triggered after the terminal device 200 is powered on. That is, after the terminal device 200 performs the power-on operation, a power-on event is triggered. In response to this power-on event, the controller 250 can control the terminal device 200 to execute the wired network sharing method. In other words, the wired network sharing method provided in this embodiment does not require the user to click the "network sharing" option switch from the settings page or other application entry, nor does it require an uplink network connection to be triggered. Wired network sharing can be automatically performed after the terminal device 200 is powered on.
[0079] The wired network sharing method provided in this application embodiment can establish a network sharing channel between the terminal device 200 and the external device after the terminal device 200 is wiredly connected to the external device through the network port, and share the network with the external device after the terminal device 200 is connected to the uplink network. Therefore, in response to the power-on event of the terminal device 200, the controller 250 can monitor the node status of the network port, that is, monitor whether the device sharing the network and the terminal device 200 are hardware-connected.
[0080] The node status includes connected and disconnected states. Connected state means the external device is connected to the network port via a network cable and data transmission is normal. Disconnected state means the network cable is not connected to the network port or data transmission is abnormal. When a node is detected to be connected, a network sharing channel is established between the terminal device 200 and the external device.
[0081] In some embodiments, in response to a power-on event of the terminal device 200, the controller 250 may start a network service, such as an Ethernet service, and register a process to monitor the node status of the network ports. This process monitors the node status of the network ports, and when network signal transmission is detected in the network port, the node status is updated to a connected state (i.e., an up state). In other words, after the terminal device 200 powers on, it can traverse the loaded network ports and check whether the data path of each loaded network port is open, i.e., whether a network cable is plugged into the network port and whether there is network signal transmission. If the data path of the network port is open, the node status of the network port is updated to a connected state.
[0082] by Figure 7 Taking the illustrated use case as an example, terminal device 200 can share the network with external devices connected to the eth1 network port. After terminal device 200 is powered on, controller 250 can monitor whether the external device and terminal device 200 are hardware-connected, that is, whether the eth1 network port is in a connected state (i.e., up state). When the node status of the eth1 network port is detected to be connected, a network sharing channel is established between terminal device 200 connected to the eth1 network port and the external device.
[0083] S200: When the node is in a connected state, set the network port mode to server mode.
[0084] Before establishing a network sharing channel between terminal device 200 and external devices, it is necessary to distinguish the network port sharing mode. Sharing modes include client mode and server mode. Client mode indicates that the network port acts as the entry point for network sharing by terminal device 200, while server mode indicates that the network port acts as the exit point for network sharing by terminal device 200. In other words, if the network port acts as the entry point for network sharing by terminal device 200, then the external devices connected to that network port share the network with terminal device 200; if the network port acts as the exit point for network sharing by terminal device 200, then terminal device 200 shares the network with the external devices connected to that network port.
[0085] by Figure 7Taking the illustrated use case as an example, the eth0 port is in client mode, serving as the entry point for network sharing by terminal device 200. Terminal device 200 can use the eth0 port to monitor whether the network cable of an electronic device providing the network (such as a router) is plugged into it. If so, terminal device 200 can connect to the network and access the internet through this eth0 port. The eth1 port is in server mode, serving as the exit point for network sharing by terminal device 200. Terminal device 200 can use the eth1 port to monitor whether the network cable of an external device that needs to share the network is plugged into it. If so, terminal device 200 can share the network with the external device through this eth1 port.
[0086] Therefore, to reduce the likelihood of the opposite occurring during network sharing, the controller 250 performs network connection filtering on the network port before executing network sharing via wired media. Specifically, if the node status of the network port is detected as connected, the network port mode is set to server mode. In other words, the sharing mode is selected and determined; if the node status of the network port is connected, no network connection operation is initiated as a client, but rather the process is handled as a server.
[0087] In some embodiments, the terminal device 200 can determine the sharing mode for wired network processing based on the name of the wired node. For example, the network port with the prefix "eth" is designated as the client mode by default, and the terminal device 200 can monitor whether the router's network cable is plugged into the terminal device 200 through this network port. If so, the terminal device 200 can connect to the network and access the Internet through this network port.
[0088] Therefore, network ports can be pre-defined in the hardware layer of the terminal device 200. When filtering network connections for these ports, the controller 250 can read the port name when it detects that the port's node status is connected. This port name is the one pre-defined in the terminal device's hardware layer. If the port name is a first preset name, the port mode is set to server mode to share the network with external devices connected to the port. If the port name is a second preset name, the port mode is set to client mode to connect to the network via the port.
[0089] For example, with Figure 7Taking the illustrated use case as an example, terminal device 200 includes two network ports, eth1 and eth0. The port names "eth1" and "eth0" are pre-defined at the hardware layer according to the purpose of the network ports. That is, the network port named "eth1" is used for sharing the network, and the network port named "eth0" is used for connecting to the network.
[0090] like Figure 10 The diagram illustrates the process of setting up a shared network port mode according to an embodiment of this application. In response to the power-on event of the terminal device 200, the controller 250 starts the Ethernet service and registers monitoring of the node status of the network ports (eth1 and eth0). When it detects that a network cable is plugged into the network port and there is network signal transmission, it updates the node status of the network port to a connected state.
[0091] When the node status of the network port is "connected," the sharing mode for network sharing is selected and determined by reading the network port name pre-written at the hardware layer. If the network port name is "eth1," the network port is identified as eth1, its mode is set to server mode (i.e., INTERFACE-MODE-SERVER is executed), and the system of terminal device 200 is notified that the network port can be shared to external devices connected to it. Conversely, if the network port name is "eth0," the network port is identified as eth0, its mode is set to client mode (i.e., INTERFACE-MODE-CLIENT is executed), and the user can connect to the network and access the internet through this network port.
[0092] In addition, the default sharing mode for network ports can be client mode. When selecting the sharing mode for network sharing, if the network port is detected to be eth1, the sharing mode of the network port will be changed to server mode. If the network port is not detected to be eth1, no action will be taken, and the default sharing mode of the network port will be client mode.
[0093] S300: Configures network sharing parameters for external devices connected to the network port, and shares the network with external devices based on the network sharing parameters.
[0094] By setting the network port mode to server mode, i.e., selecting the network port as the network sharing exit point, the controller 250 can configure network sharing parameters for external devices connected to the network port, and share the network with external devices based on these parameters. This part requires declaring the wired node to sharing type conversion in the terminal device 200. Specifically, when the network port node status is detected as connected, the controller 250 can set the network sharing type to a wired network sharing type. This wired network sharing type is a pre-added network sharing type based on the network port, added to the framework layer of the terminal device 200, and the network is shared with external devices according to this type.
[0095] Understandably, since the native logic of terminal device 200 does not declare wired types by default, and only recognizes wired, Bluetooth, P2P, and other nodes, wired nodes will be defined as invalid sharing types (i.e., TETHERING_INV ALID) when passed in. This embodiment of the application can add the network sharing type (TETHERING_ETHERNET) based on the network interface to the framework layer of terminal device 200, thus avoiding the failure of network sharing via wired connection due to invalid type.
[0096] In some embodiments, when setting network sharing parameters for external devices connected to the network port, the controller 250 can start a network sharing service, i.e., an IP server. Based on the network sharing service, an Internet Protocol address (IP address) is assigned to the network port. This can be achieved by enabling a DHCP server to assign IP addresses to devices connected to the shared network, ensuring that they are started and configured correctly. After assigning IP addresses, routing parameters and packet filtering parameters are configured for the external devices connected to the network port to establish a network sharing channel between the terminal device 200 and the external devices. This involves configuring routing, IP rules, and IP tables to ensure correct forwarding of data traffic. At this time, the terminal device 200 has no requirements for the uplink network; it can be connected to the uplink network or not.
[0097] After establishing a network sharing channel between terminal device 200 and external devices, if terminal device 200 is not connected to the uplink network, it cannot share the network with external devices. Once terminal device 200 is connected to the uplink network, it can configure the packet forwarding address of the external devices according to the uplink network to which terminal device 200 is connected, thereby changing the uplink network configuration to establish a data forwarding path between the external devices and the uplink network. This achieves the goal of terminal device 200 sharing the network with external devices, enabling the external devices to access the Internet.
[0098] When changing the uplink network configuration, controller 250 can obtain the Internet Protocol address of the uplink network and set the packet forwarding address of the external device to the Internet Protocol address, that is, set the packet forwarding of the Domain Name Service (DNS Service). For example, with Figure 7 Taking the illustrated use case as an example, a data forwarding path is established between the external device and the uplink network, allowing data packets to be forwarded from the eth1 network port to the eth0 network port or the wireless LAN (WLAN). If the IP address of the Wi-Fi connected to the terminal device 200 is 162.168.1.1, then the DNSForward of the external device is set to 162.168.1.1, enabling data packets to be forwarded from the eth1 network port to the WLAN, thus achieving internet access for the external device.
[0099] In this embodiment, the wired network sharing method provided in this application can establish a network sharing channel between the terminal device 200 and an external device when the terminal device 200 is not connected to the uplink network, thereby enabling interconnection between the terminal device 200 and the external device. After the terminal device 200 is connected to the uplink network, a data forwarding path between the external device and the uplink network is established by changing the configuration of the uplink network, enabling the external device to use the network.
[0100] In some embodiments, in order to obtain the network connection status of the terminal device 200 in a timely manner and improve the efficiency of network sharing, the controller 250 can monitor the network connection status between the terminal device 200 and the uplink network. When the network connection status is detected as connected, the controller can share the network with the external device based on the packet forwarding address configured by the uplink network.
[0101] For example, such as Figure 11 The diagram shown is a schematic representation of a wired network sharing process provided in an embodiment of this application. Figure 7 Taking the illustrated use case as an example, in response to the power-on event of terminal device 200, controller 250 monitors the node status of the network ports. When it detects that the node status of eth1 port is connected, it blocks client processing on eth1 port, that is, sets the eth1 port's port mode to server mode, and uses eth1 port as the network sharing exit. Then, it starts the Tethering function in terminal device 200. The Tethering function refers to sharing the Internet connection with other devices through the network of terminal device 200 (such as a 4G network). It starts the IP server, assigns IP addresses to the network ports based on the IP server, and performs routing configuration to establish a network sharing channel between terminal device 200 and external devices.
[0102] Simultaneously, the controller 250 registers to monitor the uplink network and the network connection status of the terminal device 200, specifically whether it is wired to a network-providing electronic device such as a router via the eth0 port, or wirelessly connected to the WiFi provided by such a device. If the network connection status is detected as connected, the controller can modify the uplink network configuration to establish a data forwarding path between the external device and the uplink network, and perform network sharing to enable the external device to access the Internet.
[0103] In some embodiments, a state machine can be used to monitor network changes, thereby modifying the uplink network configuration. Specifically, the controller 250 can create a state machine to monitor the network connection status between the terminal device and the uplink network. In other words, a state machine is created to handle network change events and state transitions.
[0104] A state machine is a model representing different states and transition conditions. Different states can be defined within the state machine to characterize the network connection status of the terminal device 200. For example, "Connected" and "Disconnected" can be defined to represent connected and disconnected network states, respectively. The state machine also defines state transition conditions and actions. For instance, when the network connection state transitions from "Disconnected" to "Connected," a corresponding event is triggered, leading to a series of operations to change the uplink network configuration.
[0105] Specifically, after the terminal device 200 connects to the uplink network, the controller 250 receives a broadcast message (e.g., Connectivity-action) from the terminal device 200's framework layer indicating a successful network connection. This triggers an operation to handle network connection state changes (i.e., handleConnectivityAction) and a command to handle uplink network changes (i.e., CMD-UPSTREAM-CHANGED). The TetherModeAliveState state machine handles the network change event and sets the uplink network (i.e., setDNSForward).
[0106] like Figure 12 The diagram shown illustrates the process of performing network sharing according to an embodiment of this application. First, Ethernet tethering is enabled. A callback function is registered to monitor the node status of the network interface and the connection status of the uplink network. Then, network sharing is started. The network sharing status of the node corresponding to the network interface is requested; when the node is available, the wired network sharing callback is triggered.
[0107] The IPServer startup triggers a callback to initiate the state transition of the TetherMainSM state machine. The EVENT-IFACE-SERVING-STATE-ACTION event is triggered, indicating a change in the interface service state. The CMD-TETHER-CON NECTION-CHANGED command is executed, handling changes in network sharing connectivity. The chooseUpstreamType event is executed to select the uplink network type.
[0108] When the wired network sharing callback is triggered, the IPServing type is set to TETHERING-ETHERNET (a wired network sharing type pre-added in the framework layer). The IPServer is started, and the DHCP Server's IP address is set to 192.168.44.1. The changeInterfaceState operation is executed to change the state of the network interface. The CMD-TETHER-REQUESTED event is handled to enable network sharing. When the TetherModeAliveState state machine handles the network change event, the IPServer's state machine transitions to TetheredState. TetheredState (shared network state) refers to the state when the IPServer successfully starts and is in the shared network state during network sharing. iprule and iptables are configured, and the tetherAddForward operation is executed to add forwarding rules for network sharing, ensuring that packets are correctly forwarded to devices on the shared network.
[0109] Based on the above-described wired network sharing method, some embodiments of this application also provide a terminal device 200, including a network port and a controller 250. The network port is configured to establish a connection with an external device; the controller 250 is configured to execute the following program steps:
[0110] S100: In response to the power-on event of the terminal device, monitor the node status of the network port.
[0111] S200: When the node is in a connected state, set the network port mode to server mode.
[0112] The server mode is used to characterize the network port as a shared network exit point.
[0113] S300: Configures network sharing parameters for external devices connected to the network port, and shares the network with external devices based on the network sharing parameters.
[0114] As can be seen from the above technical solutions, the terminal device and wired network sharing method provided in the above embodiments can respond to the power-on event of the terminal device, monitor the node status of the network port, and set the network port mode to server mode when the node status is connected. Server mode is used to characterize the network port as the network sharing exit point. Network sharing parameters are set for the external device connected to the network port, and network sharing is performed with the external device based on these parameters. The method can automatically perform wired network sharing after power-on, establish a network sharing channel between the terminal device and the external device, and monitor uplink network changes. After detecting that the terminal device is connected to the uplink network, a data forwarding path is established between the external device and the uplink network, thereby enabling the external device to use the network and solving the problem that the uplink network needs to be connected before sharing.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0116] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A terminal device, characterized in that, include: The network port is configured to establish a connection with external devices; The controller is configured as follows: In response to the power-on event of the terminal device, the node status of the network port is monitored; the node status is used to characterize whether the external device and the terminal device are hardware-connected. When the node is in a connected state, the network port mode is set to server mode. The server mode is used to indicate that the network port is a network shared exit point. When the terminal device is not connected to the uplink network, network sharing parameters are set for the external device connected to the network port to establish a network sharing channel between the terminal device and the external device; Monitor the network connection status between the terminal device and the uplink network; When the network connection status is detected as connected, a data forwarding path is established between the external device and the uplink network according to the packet forwarding address configured by the uplink network, so as to share the network with the external device.
2. The terminal device according to claim 1, characterized in that, The controller is also configured to: When the node status of the network port is detected to be connected, the network port name is read. The network port name is a network port name pre-written in the hardware layer of the terminal device. If the network port name is a first preset name, set the network port mode to server mode.
3. The terminal device according to claim 2, characterized in that, The controller is also configured to: If the network port name is a second preset name, the network port mode is set to client mode, and the client mode is used to indicate that the network port is a network sharing entry point; Connect to the network via the network port.
4. The terminal device according to claim 1, characterized in that, The controller is also configured to: When the node is in a connected state, the network sharing type is set to wired network sharing type, which is a network sharing type based on network port that is pre-added in the terminal device framework layer; Share the network with the external device according to the network sharing type.
5. The terminal device according to claim 1, characterized in that, The controller sets network sharing parameters for the external devices connected to the network port, and is configured as follows: Start network sharing service; Based on the network sharing service, an Internet Protocol address is assigned to the network port; Configure routing parameters and packet filtering parameters for the external devices connected to the network port to establish a network sharing channel between the terminal device and the external devices.
6. The terminal device according to claim 1, characterized in that, The uplink network includes wired networks and wireless networks.
7. The terminal device according to claim 1, characterized in that, The controller is also configured to: Create a state machine; The state machine is used to monitor the network connection status between the terminal device and the uplink network.
8. The terminal device according to claim 1, characterized in that, The controller executes the configuration of the packet forwarding address of the external device according to the uplink network to which the terminal device is connected, and is configured as follows: Obtain the Internet Protocol address of the uplink network; Set the data packet forwarding address of the external device to the Internet Protocol address.
9. The terminal device according to claim 1, characterized in that, The controller is also configured to: In response to the power-on event of the terminal device, start the network service; Register a process to monitor the node status of the network interface; When a network signal is detected transmitting through the network port, the node status is updated to connected.
10. A method for sharing a wired network, characterized in that, include: In response to the power-on event of the terminal device, the node status of the network port is monitored, and the network port establishes a connection with the external device; the node status is used to characterize whether the external device and the terminal device are hardware-connected. When the node is in a connected state, the network port mode is set to server mode. The server mode is used to indicate that the network port is a network shared exit point. When the terminal device is not connected to the uplink network, network sharing parameters are set for the external device connected to the network port to establish a network sharing channel between the terminal device and the external device; Monitor the network connection status between the terminal device and the uplink network; When the network connection status is detected as connected, a data forwarding path is established between the external device and the uplink network according to the packet forwarding address configured by the uplink network, so as to share the network with the external device.
Citation Information
Patent Citations
Network sharing method, TV and computer readable storage medium
CN107370646A
Ethernet sharing method based on Android system
CN113543147A