Detailed Description
The core idea of the invention is as follows: after the LTE data card is in communication connection with the test platform terminal, the LTE data card receives a connection state command sent by the test platform terminal loaded with the virtual network card driver of the LTE data card, and then the LTE data card sends a connection state setting command to the virtual network card driver, so that the virtual network card driver sets the state of the LTE data card virtual network card to be a corresponding connection state after receiving the command. Therefore, the connection state command is sent to the LTE data card, so that the virtual network card driver can set the state of the virtual network card, the automatic switching of the connection state of the LTE data card is realized, and the probability of the automatic test of the LTE data card is improved.
Example one
Fig. 1 is a flowchart of a method for controlling a connection state of an LTE data card according to a first embodiment of the present invention. As shown in fig. 1, after the LTE data card and the test platform terminal establish a communication connection, the method includes:
step S101, the LTE data card receives a connection state command sent by a test platform terminal driven by the virtual network card loaded with the LTE data card.
The test platform terminal generally stores a virtual network card driver corresponding to the LTE data card. Therefore, after the LTE data card test platform terminal establishes communication connection, the test platform terminal can load the virtual network card driver of the LTE data card, namely the test platform terminal can operate the virtual network card driver.
Here, the LTE data card receives the connection status command sent by the test platform terminal.
And S102, the LTE data card analyzes the connection state command and sends a connection state setting command corresponding to the connection state command to the virtual network card driver, so that the virtual network card driver sets the state of the LTE data card virtual network card to be a corresponding connection state after receiving the connection state setting command.
Through the technical scheme that the test platform terminal shown in fig. 1 sends a connection state command to the LTE data card, and then the LTE data card sets the state of the virtual network card through the drive of the virtual network card, the automatic switching of the connection state of the LTE data card can be realized, the switching time is saved, and the automatic test of the LTE data card can be further realized.
In the embodiment of the invention, the test platform terminal may be a PC, or may be other terminals supporting the automatic test of the LTE data card, such as a specially customized mobile phone. And if the Windows operating system is used by the test platform terminal, the virtual network card driver of the LTE data card is specifically a Windows virtual network card driver. Of course, the test platform terminal may also use other operating systems, and at this time, the virtual network card driver of the LTE data card is a virtual network card driver supporting the operating system. The communication connection between the LTE data card and the test platform terminal may be a wireless connection, or a physical connection, for example, the LTE data card is inserted into the test platform terminal. Or the LTE data card establishes communication connection with the test platform terminal through WIFI or Bluetooth.
Example two
In order to make the objects, technical solutions and advantages of the present invention clearer, the following describes the embodiments of the present invention in further detail by taking the test platform terminal as a PC, and the PC uses a Windows operating system, and the LTE data card is inserted into the PC as an example of a manner of establishing a communication connection with the PC.
Fig. 2 is a flowchart of a method for controlling a connection state of an LTE data card according to a second embodiment of the present invention. As shown in fig. 2, the method includes:
step S201, when the LTE data card is inserted into the PC, the Windows virtual network card driver of the LTE data card is loaded.
In this step, the loading of the Windows virtual network card driver of the LTE data card specifically means: the Windows virtual network card driver is loaded into the memory of the PC for operation.
Step S202, the LTE data card receives a connection state command sent by the PC driven by the Windows virtual network card loaded with the LTE data card.
In this step, the LTE data card receives a connection status command sent by the automated testing software on the PC through its own virtual serial port. Here, the connection status command is specifically: a connected command or a disconnected command, and both the connected command and the disconnected command are AT commands. The AT command (instruction) is a character string that starts with the AT and ends with a character.
Step S203, the LTE data card analyzes the received connection status command, and sends a connection status setting command corresponding to the received connection status command to the Windows virtual network card driver.
In this step, the LTE data card sends a connection state setting command to the Windows virtual network card driver through a USB (Universal Serial BUS) interface. Here, the set connection state command is specifically: a set connected status command or a set unconnected status command.
Step S204, after the Windows virtual network card driver receives the connection state setting command, the state of the LTE data card Windows virtual network card is set to be a corresponding connection state.
The state of the LTE data card virtual network card can be set to be in an unconnected state by setting a connection mark, and the state of the LTE data card virtual network card can be set to be in a connected state by clearing the connection mark; or the state of the LTE data card virtual network card is set to be the connected state by setting the connection mark, and the state of the LTE data card virtual network card is set to be the unconnected state by clearing the connection mark.
The method in fig. 2 can realize the automatic switching of the state of the Window virtual network card of the LTE data card between the connected state and the unconnected state without physically repeatedly inserting and pulling out the LTE data card, and meets the requirement of automatic testing.
EXAMPLE III
In the third embodiment of the present invention, in addition to the steps of the method shown in fig. 2, the method for controlling the connection state of the LTE data card further includes, after step S201 of the method shown in fig. 2 and before step S202: the LTE data card sends a connection state setting command indicating the unconnected state to the Windows virtual network card driver, so that the Windows virtual network card driver sets the state of the Windows virtual network card of the LTE data card to be the unconnected state after receiving the command; before the LTE data card sends a connection state setting command indicating the unconnected state to the Windows virtual network card driver, the Windows virtual network card driver sets the initial state of the LTE data card virtual network card to be the connected state.
More specifically, in embodiment three of the present invention: after the Window virtual network card driver of the LTE data card is loaded, and before the LTE data card receives a connection state command sent by the automatic test software on the PC: the method comprises the steps that a Window virtual network card driver sets the initial state of an LTE data card Window virtual network card to be a connected state; the LTE data card sends a command for setting the unconnected state to the Window virtual network card driver, and the Window virtual network card driver sets the state of the LTE data card Window virtual network card to be the unconnected state after receiving the command. The process is very short, so that the phenomenon presented to the user is that after the LTE data card is inserted, the Window virtual network card is driven and loaded, and the connection state is the unconnected state.
Here, the Window virtual network card driver sets the initial state of the Window virtual network card of the LTE data card to the connected state, and may be compatible with some LTE data cards that do not implement the function of automatically disconnecting the network card.
Of course, the embodiment of the present invention is not limited thereto, and when the initial state of the Window virtual network card is the unconnected state, the LTE data card may also send a command for setting the unconnected state to the Window virtual network card driver, and after receiving the command, the Window virtual network card driver sets the state of the Window virtual network card of the LTE data card to the unconnected state. That is, no matter the initial state of the Window virtual network card is an unconnected state or a connected state, the LTE data card can send a command for setting the unconnected state to the Window virtual network card driver, so that the Window virtual network card driver sets the state of the LTE data card Window virtual network card to the unconnected state.
In the second and third embodiments of the present invention, the connection status command sent by the automation test software on the PC to the LTE data card includes: connected and unconnected commands, which are two new AT commands, for example:
at + netcards =1 connected command, i.e. set to connected state;
at + netcards =0 unconnected command, i.e., set to an unconnected (disconnected) state.
In the second and third embodiments of the present invention, the connection state setting command sent by the LTE data card to the Window virtual network card driver includes: a set connected status command and a set unconnected status command, the two commands being USB data command strings, for example:
an inno-lte-attach set connected state command, that is, a connected state;
the ino-lte-dettach sets the unconnected state command, i.e., to the unconnected (disconnected) state.
In the second and third embodiments of the present invention, the Window virtual network card driver sets the state of the LTE data card Window virtual network card to a connected state or an unconnected state by setting or clearing a connection flag.
Specifically, the Window virtual network card driver sets the state of the LTE data card virtual network card to be in an unconnected state by setting a connection flag, and sets the state of the LTE data card virtual network card to be in a connected state by clearing the connection flag; or the Window virtual network card driver sets the state of the LTE data card virtual network card to be a connected state by setting a connection mark, and sets the state of the LTE data card virtual network card to be an unconnected state by clearing the connection mark. Taking the former as an example, the command for the Window virtual network card driver to set the state of the LTE data card Window virtual network card is as follows:
MP _ CLEAR _ FLAG (Adapter, fMP _ DISCONNECTED) is set to connected status command;
MP _ SET _ FLAG (Adapter, fMP _ DISCONNECTED) is SET to the unconnected (DISCONNECTED) state command.
Thus, when the upper layer driver inquires the state of the network card, the Window virtual network card driver returns the corresponding connection state to the upper layer driver according to the mark. For example, when the PC system upper layer driver queries the network card connection STATUS through OID _ GEN _ MEDIA _ CONNECT _ STATUS, the Windows virtual network card driver calls MP _ TEST _ FLAG (Adapter, fMP _ DISCONNECTED) to obtain the FLAG value of the connection STATUS, and returns the corresponding STATUS value (ndissmedia state DISCONNECTED/ndissmedia state connected).
Or the Window virtual network card driver actively informs the system upper layer driver that the network card state is changed after setting or clearing the mark:
after receiving the command of setting the unconnected state, the Windows virtual network card driver SETs the network card connection state FLAG to be the unconnected state through MP _ SET _ FLAG (Adapter, fMP _ DISCONNECTED), and calls NdismendarteStatus (Adapter- > Adapter handle, NDIS _ STATUS _ MEDIA _ DISCONNECT, 0,0) and NdismendarteStatus complete functions to inform the upper layer of the system that the network card connection state is changed into the unconnected state;
after receiving the command for setting the connected state, the Windows virtual network card driver sets the network card connection state FLAG to be in the connected state through MP _ CLEAR _ FLAG (Adapter, fMP _ DISCONNECTED), and calls ndissmindcatestatus (Adapter- > Adapter handle, NDIS _ STATUS _ MEDIA _ CONNECT,0,0) and ndissmindcatestatusecomplete functions to notify the upper layer driver of the system that the network card connection state is changed into the connected state.
In one embodiment of the present invention, the automatic testing process of the LET data card is as follows:
(1) after an LTE data card is inserted into a PC, a Window virtual network card driver of the LTE data card is loaded, the Window virtual network card driver initializes the connection state to be connected by setting a connected state command MP _ CLEAR _ FLAG (Adapter, fMP _ DISCONNECTED), at the moment, the LTE data card immediately sends an instruction of 'ino-LTE-dettach' for setting the connection state to be unconnected to the Window virtual network card driver, and the Window virtual network card driver SETs the connection state of the LTE data card virtual network card to be unconnected (DISCONNECTED) by setting an unconnected state command MP _ SET _ FLAG (Adapter, fMP _ DISCONNECTED) after receiving the instruction. Because the process is very short, the phenomenon presented to the user is that after the LTE data card is inserted, the Window virtual network card driver is loaded and the connection state is disconnected.
(2) Subsequently, the network card connection state needs to be set to the connected state. An automatic test software end on a PC sends an AT command AT + netcards =1 to an LTE data card through a virtual serial port of the LTE data card, the LTE data card receives and analyzes the command, and sends a command of setting a connection state of 'lno-LTE-attach' to a window virtual network card driver through a USB interface, after the window virtual network card driver receives the command, the window virtual network card driver sets a connection state mark of the Windows virtual network card of the LTE data card to be a connected state through MP _ CLEAR _ FLAG (Adapter, fMP _ DISCONNECTED), and calls a Ndissminestatestatus function to inform an upper layer driver of the system that the connection state of the Windows virtual network card of the LTE data card is changed into the connected state, and then other test work of the LTE data card can be carried out.
(3) After the test operation is finished, the network card connection state needs to be set to be a disconnection state. The automatic test software on the PC sends an AT command AT + netcards =0 to the LTE data card through a virtual serial port of the LTE data card, after the LTE data card receives and analyzes the command, the LTE data card sends a command of setting a connection state of 'ino-LTE-debug' to the window virtual network card driver through the USB interface, after the window virtual network card driver receives the command, the Windows virtual network card connection state FLAG of the LTE data card is SET to be an unconnected (DISCONNECTED) state through MP _ SET _ FLAG (Adapter, fMP _ DISCONNECTED), and NdismINDICATEST STATUS (Adapter- > Adapter Handle, NDIS _ STATUS _ MEDIA _ DISCONNEC T,0,0) and NdismINDICATESSTATUS COMPLETE functions are called to inform a system that the connection state of the Windows virtual network card of the upper layer driver LTE data card is changed into the unconnected state (or can be informed again when the upper layer driver inquires), and the test work of the LTE data card is finished.
(4) If the next test operation is required, the connection state of the Windows virtual network card of the LTE data card can be set to be the connected state, then the next operation is carried out, and the process is circulated.
In the above embodiment, the test platform terminal is a PC, and the PC uses a Windows operating system, and for other test platform terminals, for example: the specially customized mobile phone uses an android operating system, and the connection state command and the connection state setting command are both commands matched with the android operating system. The details will not be described again.
Example four
Fig. 3 is a schematic structural diagram of a system for controlling a connection state of an LTE data card in a fourth embodiment of the present invention. As shown in fig. 3, the system includes: LTE data card processing unit 310, automated testing unit 320 and virtual network card drive unit 330, wherein: the LTE data card processing unit 310 is located at an LTE data card side where communication connection with the test platform terminal is established, and the automated test unit 320 and the virtual network card driving unit 330 are respectively located at a test platform terminal side where communication connection with the LTE data card is established; and,
an automation test unit 320 for sending a connection status command to the LTE data card processing unit 310;
the LTE data card processing unit 310 is configured to, after receiving the connection status command sent by the automation test unit 320, parse the received connection status command, and send a connection status setting command corresponding to the received connection status command to the virtual network card driving unit 330;
the virtual network card driving unit 330 is configured to set the state of the virtual network card of the LTE data card to a corresponding connection state after receiving the connection state setting command sent by the LTE data card processing unit 310.
Here, the test platform terminal may be a PC, or may be another terminal supporting the automatic test of the LTE data card, such as a specially-customized mobile phone.
The test system in fig. 3 can realize the automatic switching of the state of the Window virtual network card of the LTE data card between the connected state and the unconnected state without physically repeatedly inserting and pulling out the LTE data card, and meets the requirement of automatic test.
EXAMPLE five
In addition, in the fifth embodiment, the LTE data card processing unit 310 is further configured to send a connection state setting command indicating a non-connection state to the virtual network card driving unit 330 before receiving the connection state command sent by the automatic testing unit 320;
the virtual network card driving unit 330 may further be configured to set the initial state of the virtual network card of the LTE data card to the connected state before receiving the connection state setting command indicating the unconnected state sent by the LTE data card processing unit 310. Here, the virtual network card driving unit 330 sets the initial state of the virtual network card of the LTE data card to the connected state, and may be compatible with some LTE data cards that do not implement the function of automatically disconnecting the network card.
Of course, the embodiment of the present invention is not limited to this, when the initial state of the virtual network card is the unconnected state, the LTE data card processing unit 310 may also send a connection state setting command indicating the unconnected state to the virtual network card driving unit 330, and after receiving the connection state setting command, the virtual network card driving unit 330 sets the state of the LTE data card virtual network card to the unconnected state. That is, no matter the initial state of the LTE data card virtual network card is an unconnected state or a connected state, the LTE data card processing unit 310 may send a connection state setting command indicating the unconnected state to the virtual network card driving unit 330, so that the virtual network card driving unit 330 sets the state of the LTE data card virtual network card to the unconnected state.
In the fourth and fifth embodiments of the present invention, the LTE data card processing unit 310 receives the connection status command sent by the automation test unit 320 through the virtual serial port.
Here, the connection status command is specifically: a connected command or a disconnected command, and both the connected command and the disconnected command are AT commands. The AT command (instruction) is a character string that starts with the AT and ends with a character.
That is, the connection status command sent by the automation test unit 320 to the LTE data card processing unit 310 includes: a connected command and a disconnected command, which may specifically be two new AT commands, such as:
at + netcards =1 connected command, i.e. set to connected state;
at + netcards =0 unconnected command, i.e., set to an unconnected (disconnected) state.
In the fourth and fifth embodiments of the present invention, the LTE data card processing unit 310 sends a connection state setting command to the virtual network card driving unit 330 through the USB interface.
Here, the set connection state command is specifically: a set connected status command or a set unconnected status command.
That is, the connection state setting command sent by the LTE data card processing unit 310 to the virtual network card driver includes: a set connected status command and a set unconnected status command, the two commands being USB data command strings, such as:
an inno-lte-attach set connected state command, that is, a connected state;
the ino-lte-dettach sets the unconnected state command, i.e., to the unconnected (disconnected) state.
In the fourth and fifth embodiments of the present invention, the virtual network card driving unit 330 sets the state of the virtual network card of the LTE data card to the unconnected state by setting the connection flag, and sets the state of the virtual network card of the LTE data card to the connected state by clearing the connection flag;
or,
the virtual network card driving unit 330 sets the state of the virtual network card of the LTE data card to a connected state by setting the connection flag, and sets the state of the virtual network card of the LTE data card to an unconnected state by clearing the connection flag.
Taking the former as an example, the commands for setting the clear and connect representations by the virtual network card driving unit 330 are respectively:
MP _ CLEAR _ FLAG (Adapter, fMP _ DISCONNECTED) is set to connected status command;
MP _ SET _ FLAG (Adapter, fMP _ DISCONNECTED) is SET to the unconnected (DISCONNECTED) state command.
Thus, when the upper layer driver unit queries the network card status, the virtual network card driver unit 330 returns the corresponding connection status to the upper layer driver according to the flag. For example, when the upper layer driver unit in the TEST terminal platform inquires the network card connection STATUS through OID _ GEN _ MEDIA _ CONNECT _ STATUS, the virtual network card driver unit 330 calls MP _ TEST _ FLAG (Adapter, fMP _ DISCONNECTED) to obtain the FLAG value of the connection STATUS, and returns the corresponding STATUS value (ndissmedistatedisconnected/ndissmedistateconnected).
Or, the virtual network card driving unit 330 actively notifies the upper layer driving unit that the network card state has changed after setting or clearing the flag:
after the virtual network card driver receiving unit 330 SETs the unconnected state command, it SETs the network card connection state FLAG to the unconnected state through MP _ SET _ FLAG (Adapter, fMP _ DISCONNECTED), and calls ndismindstatatus (Adapter- > Adapter handle, NDISs _ STATUS _ MEDIA _ DISCONNECT, 0,0), ndismindstatatus complete function to notify the upper layer driver unit that the network card connection state has been changed to the unconnected state;
after receiving the connection state setting command, the virtual card driving unit 330 sets the card connection state FLAG to be in a connected state through MP _ CLEAR _ FLAG (Adapter, fMP _ DISCONNECTED), and calls ndissmindcatestatus (Adapter- > Adapter handle, NDIS _ STATUS _ MEDIA _ connect T,0,0) and ndissmindcatestatusecomplete functions to notify the upper layer driving unit that the card connection state has been changed to be in a connected state.
In summary, the LTE data card receives a connection status command sent by a test platform terminal driven by a virtual network card loaded with the LTE data card, and then the LTE data card parses the connection status command and sends a connection status setting command to the virtual network card driver, so that the virtual network card driver sets the status of the LTE data card virtual network card to a corresponding connection status after receiving the command.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.