Mode switching method and device

By opening the communication port in the user mode of the service equipment and establishing a connection with the test equipment to obtain mode variables, the problem of low mode switching efficiency in the existing technology is solved, and efficient mode switching without disassembly and welding is achieved.

CN119988109APending Publication Date: 2025-05-13HANGZHOU EZVIZ SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311498457.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-10
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the prior art, mode switching of business equipment requires disassembly of the equipment and welding the solid interface, resulting in inefficiency.

Method used

By opening the communication port in the user mode of the service device, establishing a communication connection with the test device, obtaining mode variables and storing them, and switching to test mode according to the mode variables after restarting.

Benefits of technology

No disassembly and welding interfaces are required, which significantly improves the efficiency of mode switching and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988109A_ABST
    Figure CN119988109A_ABST
Patent Text Reader

Abstract

The invention provides a mode switching method and equipment, which can be used in the field of computers. In the method, when the operation mode of the service equipment is a user mode, a communication port is opened. The test equipment sends a communication connection request to the service equipment through the communication port; and the service equipment establishes communication connection with the test equipment. And the service equipment acquires the mode variable from the test equipment based on the communication connection and stores the mode variable. And after the service equipment is restarted, when the mode variable indicates that the operation mode is the test mode, entering the test mode. According to the scheme, the communication connection is established, the mode switching is completed according to the mode variable, the service equipment does not need to be disassembled, an entity interface does not need to be welded, and the mode switching efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a mode switching method and device. Background Art

[0002] With the development of science and technology, various business equipments are produced for people to use. After the business equipments are produced, they will inevitably have failures and need to be repaired. After the business equipments are repaired, in order to determine whether the business equipments have been repaired successfully, they need to be tested.

[0003] In the prior art, when testing, the operation mode of the service device needs to be switched to the test mode before the test can be performed. In the process of mode switching, the service device needs to be disassembled, and the corresponding physical interface needs to be welded on the mainboard of the test device. The test device and the service device are connected through the physical interface so that the two can communicate. Then the test device sends a test instruction to the service device, and the service device switches its own operation mode to the test mode, and then the test device can test the service device.

[0004] In summary, the existing mode switching method requires disassembling the service equipment and welding the physical interface, resulting in low efficiency of mode switching. Summary of the invention

[0005] The embodiments of the present application provide a mode switching method and device, which are used to solve the problem that the existing mode switching method requires disassembly of the service equipment and welding of the physical interface, resulting in low efficiency of mode switching.

[0006] In a first aspect, an embodiment of the present application provides a mode switching method, which is applied to a service device, and the method includes:

[0007] When the operation mode is user mode, open the communication port;

[0008] If a communication connection request sent by the test device is received through the communication port within a preset timeout period, a communication connection is established with the test device;

[0009] Obtaining and storing a mode variable from the test device through the communication connection, wherein the mode variable is used to indicate that the operation mode of the service device after restart is a test mode or a user mode;

[0010] Restarting the service device;

[0011] When the mode variable indicates that the operating mode is the test mode, the test mode is entered.

[0012] In a specific implementation manner, obtaining and storing the mode variable from the test device through the communication connection includes:

[0013] Receiving, via the communication connection, an identity authentication instruction sent by the test device;

[0014] By interacting with the test device, the test device is verified to obtain a verification result, wherein the verification result is used to indicate that the verification is passed or that the verification is not passed;

[0015] If the verification result indicates that the verification is passed, sending a variable acquisition instruction to the test device;

[0016] The mode variable sent by the test device is received and stored.

[0017] In a specific implementation manner, verifying the test device by interacting with the test device to obtain a verification result includes:

[0018] Generate random numbers;

[0019] Encoding the random number to obtain a first character string;

[0020] Sending the first character string to the testing device via the communication connection;

[0021] Receiving, via the communication connection, a second character string sent by the service device;

[0022] Decoding the second character string to obtain an encrypted value;

[0023] Decrypt the encrypted value using the public key to obtain a verification value;

[0024] Determining whether the verification value is the same as the random number;

[0025] If the verification value is the same as the random number, a verification result indicating that the verification is passed is generated;

[0026] If the verification value is different from the random number, a verification result indicating that the verification failed is generated.

[0027] In a specific embodiment, the method further comprises:

[0028] If the verification result indicates that the verification fails, the communication connection is disconnected and the communication port is closed.

[0029] In a specific implementation, when the operation mode is the user mode, before opening the communication port, the method further includes:

[0030] When the service device is started, the operation mode is determined according to whether the mode variable is stored in the service device, and the operation mode is a user mode or a test mode.

[0031] In a specific implementation manner, determining the operation mode according to whether the mode variable is stored in the service device includes:

[0032] Determining whether a mode variable has been stored in the service device;

[0033] If the mode variable is not stored in the service device, determining that the operation mode is the user mode;

[0034] If the mode variable has been stored in the service device, determining whether the variable value of the mode variable is a preset variable value;

[0035] If the variable value of the mode variable is not the preset variable value, determining that the operation mode is the user mode;

[0036] If the variable value of the mode variable is the preset variable value, it is determined that the operating mode is the test mode.

[0037] In a specific embodiment, the method further comprises:

[0038] If no communication connection request sent by the test device is received through the communication port within the preset timeout period, the communication port is closed.

[0039] In a specific embodiment, the method further comprises:

[0040] receiving a variable deletion instruction sent by the test device;

[0041] Deleting the pattern variable;

[0042] The communication connection is disconnected, and the communication port is closed.

[0043] In a second aspect, an embodiment of the present application provides a mode switching method, which is applied to a test device, and the method includes:

[0044] In response to the acquired test instruction, sending a communication connection request to the service device through a communication port opened by the service device;

[0045] Establishing a communication connection with the service device;

[0046] When receiving the variable acquisition instruction sent by the service device, a mode variable is sent to the service device, where the mode variable is used to indicate that the operation mode of the service device after restart is the test mode or the user mode.

[0047] In a specific implementation manner, after establishing a communication connection with the service device, the method further includes:

[0048] Sending an identity authentication instruction to the service device via the communication connection;

[0049] Receive the variable acquisition instruction sent by the service device.

[0050] In a specific implementation manner, before receiving the variable setting instruction sent by the service device, the method further includes:

[0051] Receiving, via the communication connection, a first character string sent by the service device;

[0052] Decoding the first character string to obtain a random number;

[0053] Encrypt the random number using a private key to obtain an encrypted value;

[0054] Encoding the encrypted value to obtain a second character string;

[0055] The second character string is sent to the service device through the communication connection.

[0056] In a specific embodiment, the method further comprises:

[0057] At the end of the test, a variable deletion instruction is sent to the service device.

[0058] In a third aspect, an embodiment of the present application provides a mode switching device, including:

[0059] Processing modules for:

[0060] When the operation mode is user mode, open the communication port;

[0061] Communication modules for:

[0062] If a communication connection request sent by the test device is received through the communication port within a preset timeout period, a communication connection is established with the test device;

[0063] Obtaining and storing a mode variable from the test device through the communication connection, wherein the mode variable is used to indicate whether the operation mode of the service device after restart is a test mode or a user mode;

[0064] The processing module is further used for:

[0065] Restarting the service device;

[0066] When the mode variable indicates that the operating mode is the test mode, the test mode is entered.

[0067] In a fourth aspect, an embodiment of the present application provides a mode switching device, including:

[0068] Communication modules for:

[0069] In response to the acquired test instruction, sending a communication connection request to the service device through a communication port opened by the service device;

[0070] Establishing a communication connection with the service device;

[0071] When receiving the variable acquisition instruction sent by the service device, a mode variable is sent to the service device, where the mode variable is used to indicate that the operation mode of the service device after restart is the test mode or the user mode.

[0072] In a fifth aspect, an embodiment of the present application provides a service device, including:

[0073] Processor, memory, communication interface;

[0074] The memory is used to store executable instructions of the processor;

[0075] Wherein, the processor is configured to execute the mode switching method described in any one of the first aspects by executing the executable instructions.

[0076] In a sixth aspect, an embodiment of the present application provides a testing device, including:

[0077] Processor, memory, communication interface;

[0078] The memory is used to store executable instructions of the processor;

[0079] Wherein, the processor is configured to execute the mode switching method described in any one of the second aspects by executing the executable instructions.

[0080] In a seventh aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the mode switching method described in any one of the first aspect or the second aspect is implemented.

[0081] In an eighth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the mode switching method described in any one of the first aspect or the second aspect.

[0082] The mode switching method and device provided in the embodiment of the present application open the communication port when the operating mode of the business device is the user mode. The test device sends a communication connection request to the business device through the communication port; then the business device establishes a communication connection with the test device. The business device then obtains and stores the mode variable from the test device based on the communication connection. After the business device is restarted, when the mode variable indicates that the operating mode is the test mode, it enters the test mode. This solution establishes a communication connection and completes the mode switching according to the mode variable, without the need to disassemble the business device or weld the physical interface, thereby effectively improving the efficiency of mode switching. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0084] Figure 1 A flowchart of a first embodiment of the mode switching method provided in the present application;

[0085] Figure 2 A schematic diagram of a flow chart of a second embodiment of a mode switching method provided in the present application;

[0086] Figure 3 A schematic diagram of a flow chart of a third embodiment of the mode switching method provided in the present application;

[0087] Figure 4 A flowchart of a fourth embodiment of the mode switching method provided in the present application;

[0088] Figure 5 A flowchart of a fifth embodiment of the mode switching method provided in the present application;

[0089] Figure 6 A schematic diagram of the structure of a mode switching device embodiment 1 provided in the present application;

[0090] Figure 7 A schematic diagram of the structure of the second embodiment of the mode switching device provided by the present application;

[0091] Figure 8 A schematic diagram of the structure of a business device provided for this application;

[0092] Fig. 9 A schematic diagram of the structure of a test device provided in this application. DETAILED DESCRIPTION

[0093] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments made by ordinary technicians in this field under the enlightenment of the embodiments belong to the scope of protection of the present application.

[0094] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0095] With the development of science and technology, the number and types of business equipment used by people are increasing. In the process of using business equipment, it is inevitable that failures will occur and they need to be repaired. After the repair is completed, in order to determine the effect of the repair, it needs to be tested.

[0096] In the prior art, when testing, the operation mode of the service device needs to be switched to the test mode before the test can be performed. In the process of mode switching, the service device needs to be disassembled, and the corresponding physical interface needs to be welded on the mainboard of the test device. The test device and the service device are connected through the physical interface so that the two can communicate. Then the test device sends a test instruction to the service device, and the service device switches its own operation mode to the test mode, and then the test device can test the service device.

[0097] Since the business equipment needs to be disassembled and the physical interface needs to be welded, the efficiency of mode switching will be low.

[0098] In view of the problems existing in the prior art, the inventors found in the process of studying mode switching that in order to improve the efficiency of mode switching, the business device can open the communication port, and then establish a communication connection with the test device through the port to achieve communication. Then, through the communication connection, the business device obtains the mode variable from the test device and stores it. Then, after the business device is restarted, it can enter the test mode according to the mode variable, without disassembling the machine and welding the interface, which effectively improves the efficiency of mode switching. Based on the above invention concept, the mode switching scheme in this application is designed.

[0099] In the present application, the business equipment may be a display device, a camera, a server, etc., and the test equipment may be a computer, a server, a terminal device, etc. The present application embodiment does not limit the business equipment and the test equipment, which may be determined according to actual conditions.

[0100] The following is an example of an application scenario of the mode switching method provided in this application.

[0101] For example, in this application scenario, a service device fails and needs to be tested after repair. After the service device is started, it determines which mode to enter based on whether it stores a mode variable. After entering the user mode, the communication port is opened.

[0102] Then, within the preset timeout period, the service device will wait for the test device to send a communication connection request to it.

[0103] When the test device obtains the test instruction, it sends a communication connection request to the business device.

[0104] If the service device receives a communication connection request sent by the test device through the communication port within a preset timeout period, a communication connection is established with the test device.

[0105] The business device obtains and stores the mode variables from the test device through the communication connection. Then the business device restarts and enters the test mode according to the obtained mode variables.

[0106] After the service equipment enters the test mode, the test equipment can start testing.

[0107] It should be noted that the above scenario is only an example of an application scenario provided by an embodiment of the present application. The embodiment of the present application does not limit the actual form of the various devices included in the scenario. In the specific application of the solution, it can be set according to actual needs.

[0108] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0109] Figure 1 This is a flow chart of the first embodiment of the mode switching method provided by the present application. The present embodiment of the present application describes the situation in which the business device and the test device establish a communication connection through the test interface, and then the business device switches the mode according to the mode variables obtained through the communication connection. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 1 As shown, the mode switching method specifically includes the following steps:

[0110] S101: When the operation mode of the service device is user mode, the communication port is enabled.

[0111] After the business device is started, the business device will determine whether to enter the user mode or the test mode based on whether it has stored the mode variable. Since the business device is in a state of being repaired and needs to be tested, the mode variable is not stored and the operating mode is determined to be the user mode.

[0112] In this step, when the operation mode of the service device is user mode, in order to enter the test mode, the communication port needs to be opened.

[0113] It should be noted that the port number of the communication port is a preset port number, which may be 7000, 8000, 9000, etc. The embodiment of the present application does not limit the preset port number and may be set according to actual conditions.

[0114] S102: In response to the acquired test instruction, the test device sends a communication connection request to the service device through the communication port opened by the service device.

[0115] In this step, in order to test the service device, when the test device obtains the test instruction, it sends a communication connection request to the service device through the communication port opened by the service device in response to the obtained test instruction.

[0116] It should be noted that the test device may obtain the test instruction in the following manner: when the test device is started, the test device automatically generates the test instruction, and the test instruction can be obtained; or the test device generates the test instruction in response to the user's operation by clicking the test button on the graphical user interface of the test device; or the test device may receive the test instruction after receiving the test instruction from the third-party device. The embodiment of the present application does not limit the manner in which the test device obtains the test instruction, and it can be determined according to the actual situation.

[0117] S103: If the service device receives a communication connection request sent by the test device through the communication port within a preset timeout period, a communication connection is established with the test device.

[0118] In this step, after opening the communication port, the service device will wait for the test device to send a communication connection request within a preset timeout period.

[0119] If a communication connection request sent by the test device is received through the communication port within the preset timeout period, it means that the business device needs to be tested, and then the business device establishes a communication connection with the test device.

[0120] If no communication connection request is received from the test device through the communication port within the preset timeout period, it means that no test is needed. In order to ensure the security of the business equipment and prevent malicious elements from attacking the business equipment through the communication port, the communication port needs to be closed.

[0121] It should be noted that the preset timeout period can be 30 seconds, 1 minute, 5 minutes, etc. The embodiment of the present application does not limit the preset timeout period and can be set according to actual conditions.

[0122] It should be noted that the connection method between the business device and the test device can be a wireless connection or a wired connection through a network cable. The embodiment of the present application does not limit the connection method between the business device and the test device, which can be determined according to actual conditions.

[0123] It should be noted that the communication connection may be a socket connection.

[0124] S104: The service device obtains and stores the pattern variables from the test device through the communication connection.

[0125] In this step, after the service device establishes a communication connection with the test device, the service device needs to obtain and store the mode variable from the test device through the communication connection in order to enter the test mode after restart. The mode variable is used to indicate whether the operation mode of the service device after restart is the test mode or the user mode.

[0126] The business device will send a variable acquisition instruction to the test device through a communication connection, and then the test device will send the mode variable to the business device when receiving the variable acquisition instruction sent by the business device.

[0127] It should be noted that the variable value of the mode variable sent by the test device to the business device is a preset variable value, which can be 0, 1, 2, etc. The embodiment of the present application does not limit the preset variable value and can be set according to actual conditions.

[0128] S105: Restart the service equipment.

[0129] In this step, after the service device stores the mode variables, it needs to be restarted in order to enter the test mode, so that the operation mode can be determined according to the test variables later.

[0130] S106: When the mode variable indicates that the operation mode is the test mode, the service device enters the test mode.

[0131] In this step, after the service device is restarted, when the mode variable indicates that the operating mode is the test mode, the service device enters the test mode.

[0132] After the business device is restarted, it will determine whether it has stored the mode variable. If the mode variable is not stored, it will enter the user mode. If the mode variable is stored, it will continue to determine whether the variable value of the mode variable is the preset variable value; if the variable value is not the preset variable value, it will enter the user mode; if the variable value is the preset variable value, it indicates that the operating mode is the test mode, and then it will enter the test mode.

[0133] Because the business device has stored the mode variable at this time, and the variable value of the mode variable is the preset variable value, the test mode is entered.

[0134] After the service equipment enters the test mode, the test equipment can test the service equipment.

[0135] The mode switching method provided in this embodiment opens the communication port when the operating mode of the business device is the user mode. The test device sends a communication connection request to the business device through the communication port; then the business device establishes a communication connection with the test device. The business device then obtains and stores the mode variable from the test device based on the communication connection. After the business device is restarted, when the mode variable indicates that the operating mode is the test mode, it enters the test mode. Compared with the prior art that requires disassembly and welding of physical interfaces, this solution establishes a communication connection and completes mode switching according to the mode variables. There is no need to disassemble the business device or weld the physical interface, which effectively improves the efficiency of mode switching and reduces costs.

[0136] Figure 2 This is a flow chart of the second embodiment of the mode switching method provided by the present application. Based on the above embodiment, the present embodiment of the present application describes the situation where the service device and the test device interact through a communication connection, and the service device obtains and stores the mode variable. Figure 2 As shown, the mode switching method specifically includes the following steps:

[0137] S201: The test device sends an identity authentication instruction to the business device through a communication connection.

[0138] In this step, after the test device establishes a communication connection with the service device, in order for the service device to subsequently verify whether the identity of the test device is correct, it is necessary to send an identity authentication instruction to the service device through the communication connection.

[0139] S202: After receiving the identity authentication instruction sent by the test device through the communication connection, the service device interacts with the test device to verify the test device and obtain a verification result.

[0140] In this step, after the test device sends an identity authentication instruction to the service device, the service device can receive the identity authentication instruction and then interact with the test device through a communication connection to obtain a test result. The verification result is used to indicate whether the verification is passed or not.

[0141] S203: The service device determines whether the verification result indicates that the verification is passed; if the verification result indicates that the verification is passed, step S203 is executed; if the verification result indicates that the verification is not passed, step S204 is executed.

[0142] In this step, after the service device obtains the verification result, in order to determine whether to obtain the mode variable or close the communication port in the future, it is necessary to determine whether the verification result indicates that the verification is passed.

[0143] S203: The service device sends a variable acquisition instruction to the test device.

[0144] In this step, if the verification result indicates that the verification is successful, it means that there is no problem with the identity of the test device and it is safe to obtain the mode variable from the test device, so the business device sends a variable acquisition instruction to the test device through the communication connection.

[0145] S204: The service device disconnects the communication connection and closes the communication port.

[0146] In this step, if the verification result indicates that the verification has not passed, it means that there is a problem with the identity of the test device. In order to ensure the security of the business device, the business device needs to disconnect the communication connection and close the communication port.

[0147] S205: After receiving the variable acquisition instruction sent by the service device, the test device sends the mode variable to the service device.

[0148] In this step, after the service device sends the variable acquisition instruction to the test device, the test device can receive the variable acquisition instruction and then send the pattern variable to the service device through the communication connection.

[0149] S206: The service device receives and stores the mode variable sent by the test device.

[0150] In this step, after the test device sends the mode variable to the service device, the service device can receive the mode variable and then store the mode variable so as to enter the test mode after a subsequent restart.

[0151] The mode switching method provided in this embodiment authenticates the test device through the business device. After the authentication is passed, the business device obtains the mode variables through the test device for storage, thereby ensuring the accuracy and security of the mode variables and improving the security of the business device.

[0152] Figure 3 This is a flow chart of the third embodiment of the mode switching method provided by the present application. Based on the above embodiments, the present embodiment of the present application describes the interaction between the service device and the test device and the verification of the test device. Figure 3 As shown, the mode switching method specifically includes the following steps:

[0153] S301: The service device generates a random number.

[0154] In this step, after the service device receives the identity authentication instruction sent by the test device, it needs to verify the test device and first generate a random number.

[0155] S302: The service device encodes the random number to obtain a first character string.

[0156] S303: The service device sends the first character string to the test device through the communication connection.

[0157] In the above steps, after the service device generates a random number, it encodes it for the convenience of transmission to obtain a first character string, and then sends the first character string to the test device through a communication connection.

[0158] It should be noted that the method for encoding the random number can be: encoding using base64; it can also be encoding using base32 encoding, shellcode encoding, etc. The embodiment of the present application does not limit the method for encoding the random number, which can be determined according to actual conditions.

[0159] S304: After receiving the first character string sent by the service device through the communication connection, the test device decodes the first character string to obtain a random number.

[0160] In this step, after the service device sends the first character string to the test device, the test device can receive the first character string and then decrypt it to obtain a random number.

[0161] S305: The test device encrypts the random number using the private key to obtain an encrypted value.

[0162] In this step, after the test device obtains the random number, it uses the private key to encrypt it to obtain an encrypted value.

[0163] It should be noted that the encryption method is asymmetric encryption, and the RSA method can be used for encryption, or the Digital Signature Algorithm (DSA), Elliptic Curve Cryptosystems (ECC), and other methods can be used for encryption. This application does not limit the encryption method, which can be determined according to actual conditions.

[0164] S306: The testing device encodes the encrypted value to obtain a second character string.

[0165] S307: The test device sends the second character string to the service device through the communication connection.

[0166] In the above steps, in order to facilitate transmission, the test device encodes the encrypted value to obtain a second character string, and then sends the second character string to the service device through the communication connection.

[0167] S308: After receiving the second character string sent by the business device through the communication connection, the business device decodes the second character string to obtain an encrypted value.

[0168] In this step, after the test device sends the second character string to the service device, the service device can receive the second character string and then decode it to obtain an encrypted value.

[0169] S309: The business device uses the public key to decrypt the encrypted value to obtain a verification value.

[0170] In this step, after the service device obtains the encrypted value, it uses the public key to decrypt the encrypted value to obtain the verification value, so that the test device can be verified based on the verification value later.

[0171] S310: The service device determines whether the verification value is the same as the random number; if the verification value is the same as the random number, execute step S311; if the verification value is different from the random number, execute step S312.

[0172] S311: The business device generates a verification result indicating that the verification has passed.

[0173] S312: The business device generates a verification result indicating that the verification failed.

[0174] In the above steps, after the service device obtains the verification value, it determines whether the verification value is the same as the random number.

[0175] If the verification value is the same as the random number, it means that there is no problem with the identity of the test device, and a verification result of verification passing is generated.

[0176] If the verification value is different from the random number, it indicates that there is a problem with the identity of the test device, and a verification result indicating that the verification failed is generated.

[0177] The mode switching method provided in this embodiment generates a random number through a business device, and encodes it to obtain a first character string. The test device decodes, encrypts, and encodes the first character string to obtain a second character string. The business device decodes and decrypts the second character string to obtain a verification value, and then compares it with the random number to determine whether the two are the same, thereby obtaining a verification result. This not only ensures the accuracy of the verification result, but also improves the security of the business device.

[0178] Figure 4 This is a flow chart of the fourth embodiment of the mode switching method provided by the present application. Based on the above embodiment, the present embodiment of the present application describes the situation where the operating mode is determined according to the mode variable each time the service device is started. Figure 4 As shown, the mode switching method specifically includes the following steps:

[0179] S401: Determine whether the mode variable is stored in the service device; if the mode variable is not stored in the service device, execute step S403; if the mode variable is stored in the service device, execute step S402.

[0180] Each time the service device is started, the operation mode is determined according to whether the mode variable is stored in the service device, and the operation mode is the user mode or the test mode.

[0181] In this step, when the service device is started, it is first determined whether the mode variable has been stored in the service device.

[0182] It should be noted that starting a business device includes restarting the business device.

[0183] S402: Determine whether the variable value of the pattern variable is a preset variable value; if the variable value of the pattern variable is not the preset variable value, execute step S403; if the variable value of the pattern variable is the preset variable value, execute step S404.

[0184] In this step, if the mode variable is stored in the service device, in order to prevent an unauthorized person from forging the mode variable to make the service device enter the test mode, it is also necessary to determine whether the variable value of the mode variable is a preset variable value.

[0185] S403: Determine that the operating mode is the user mode.

[0186] In this step, if the mode variable is not stored in the service device, it means that the user mode needs to be entered, and then it is determined that the operation mode is the user mode.

[0187] If the variable value of the mode variable is not the preset variable value, it means that the mode variable may be forged by an unknown molecule. At this time, it is necessary to enter the user mode, and then it is determined that the running mode is the user mode.

[0188] S404: Determine that the operation mode is the test mode.

[0189] In this step, if the variable value of the mode variable is a preset variable value, it means that it is safe to enter the test mode, and then it is determined that the operating mode is the test mode.

[0190] The mode switching method provided in this embodiment determines the operating mode by judging whether the mode variable has been stored in the business device and judging whether the variable value of the mode variable is a preset variable value, thereby making the operating mode more accurate and ensuring the safety of entering the test mode.

[0191] Figure 5 This is a flow chart of the fifth embodiment of the mode switching method provided by the present application. Based on the above embodiment, the present embodiment of the present application describes the situation of deleting the mode variable and closing the communication port after the test is completed. Figure 5 As shown, the mode switching method specifically includes the following steps:

[0192] S501: When the test is finished, the test device sends a variable deletion instruction to the service device.

[0193] In this step, after the service device enters the test mode, the test device tests the service device. After the test is completed, in order to ensure that the service device can enter the user mode when it is started next time, a variable deletion instruction needs to be sent to the service device.

[0194] S502: After receiving the variable deletion instruction sent by the test device, the service device deletes the mode variable.

[0195] In this step, after the test device sends a variable deletion instruction to the service device, the service device may receive the instruction and delete the stored pattern variables.

[0196] S503: The service device disconnects the communication connection and closes the communication port.

[0197] In this step, after the test device sends a variable deletion instruction to the service device, in order to ensure the security of the service device, the service device needs to disconnect the communication connection and close the communication port.

[0198] It should be noted that the execution order of the business device deleting the mode variable and step S503 can be: first execute the mode variable, then execute step S503; it can also be: first execute step S503, then execute the mode variable; it can also be: delete the mode variable and step S503 are executed simultaneously. The embodiment of the present application does not limit the execution order of the business device deleting the mode variable and step S503, which can be determined according to actual conditions.

[0199] After the business device deletes the mode variable, disconnects the communication connection, and closes the communication port, it can be restarted. Since the mode variable is no longer stored at this time, it will enter the user mode.

[0200] The mode switching method provided in this embodiment ensures that the business device can enter the user mode when it is started next time, and also ensures the security of the business device, by having the business device delete the mode variable, disconnect the communication connection, and close the communication port after the test is completed.

[0201] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0202] Figure 6 This is a schematic diagram of the structure of the first embodiment of the mode switching device provided by the present application; the device can be integrated into the service equipment in the above method embodiment, or can be implemented by the service equipment in the above method embodiment. Figure 6 As shown, the mode switching device 60 includes:

[0203] The processing module 61 is used for:

[0204] When the operation mode is user mode, open the communication port;

[0205] The communication module 62 is used for:

[0206] If a communication connection request sent by the test device is received through the communication port within a preset timeout period, a communication connection is established with the test device;

[0207] Obtaining and storing a mode variable from the test device through the communication connection, wherein the mode variable is used to indicate whether the operation mode of the service device after restart is a test mode or a user mode;

[0208] The processing module 61 is further used for:

[0209] Restarting the service device;

[0210] When the mode variable indicates that the operating mode is the test mode, the test mode is entered.

[0211] Furthermore, the communication module 62 is specifically used for:

[0212] Receiving, via the communication connection, an identity authentication instruction sent by the test device;

[0213] By interacting with the test device, the test device is verified to obtain a verification result, wherein the verification result is used to indicate that the verification is passed or that the verification is not passed;

[0214] If the verification result indicates that the verification is passed, sending a variable acquisition instruction to the test device;

[0215] The mode variable sent by the test device is received and stored.

[0216] Furthermore, the communication module 62 is specifically used for:

[0217] Generate a random number through the processing module 61;

[0218] The random number is encoded by the processing module 61 to obtain a first character string;

[0219] Sending the first character string to the testing device via the communication connection;

[0220] Receiving, via the communication connection, a second character string sent by the service device;

[0221] Decoding the second character string by the processing module 61 to obtain an encrypted value;

[0222] Decrypting the encrypted value using the public key through the processing module 61 to obtain a verification value;

[0223] Determine, by the processing module 61, whether the verification value is the same as the random number;

[0224] If the verification value is the same as the random number, a verification result indicating that the verification is passed is generated;

[0225] If the verification value is different from the random number, a verification result indicating that the verification failed is generated.

[0226] Furthermore, the processing module 61 is also used for:

[0227] If the verification result indicates that the verification fails, the communication connection is disconnected and the communication port is closed.

[0228] Furthermore, the processing module 61 is also used for:

[0229] When the service device is started, the operation mode is determined according to whether the mode variable is stored in the service device, and the operation mode is a user mode or a test mode.

[0230] Furthermore, the processing module 61 is also used for:

[0231] Determining whether a mode variable has been stored in the service device;

[0232] If the mode variable is not stored in the service device, determining that the operation mode is the user mode;

[0233] If the mode variable has been stored in the service device, determining whether the variable value of the mode variable is a preset variable value;

[0234] If the variable value of the mode variable is not the preset variable value, determining that the operation mode is the user mode;

[0235] If the variable value of the mode variable is the preset variable value, it is determined that the operating mode is the test mode.

[0236] Furthermore, the processing module 61 is also used for:

[0237] If no communication connection request sent by the test device is received through the communication port within the preset timeout period, the communication port is closed.

[0238] Furthermore, the communication module 62 is also used to receive a variable deletion instruction sent by the test device;

[0239] Furthermore, the processing module 61 is also used for:

[0240] Deleting the pattern variable;

[0241] The communication connection is disconnected, and the communication port is closed.

[0242] The mode switching device provided in this embodiment is used to execute the technical solution of the service equipment in any of the aforementioned method embodiments. Its implementation principle and technical effects are similar and will not be described in detail here.

[0243] Figure 7 This is a schematic diagram of the structure of the second embodiment of the mode switching device provided by the present application; the device can be integrated into the test equipment in the above method embodiment, or can be implemented by the test equipment in the above method embodiment. Figure 7 As shown, the mode switching device 70 includes:

[0244] The communication module 71 is used for:

[0245] In response to the acquired test instruction, sending a communication connection request to the service device through a communication port opened by the service device;

[0246] Establishing a communication connection with the service device;

[0247] When receiving the variable acquisition instruction sent by the service device, a mode variable is sent to the service device, where the mode variable is used to indicate that the operation mode of the service device after restart is the test mode or the user mode.

[0248] Furthermore, the communication module 71 is also used for:

[0249] Sending an identity authentication instruction to the service device via the communication connection;

[0250] Receive the variable acquisition instruction sent by the service device.

[0251] Furthermore, the communication module 71 is further configured to receive a first character string sent by the service device through the communication connection;

[0252] The processing module 72 is used to:

[0253] Decoding the first character string to obtain a random number;

[0254] Encrypt the random number using a private key to obtain an encrypted value;

[0255] Encoding the encrypted value to obtain a second character string;

[0256] Furthermore, the communication module 71 is further configured to send the second character string to the service device via the communication connection.

[0257] Furthermore, the communication module 71 is also used to send a variable deletion instruction to the service device when the test is completed.

[0258] The mode switching device provided in this embodiment is used to execute the technical solution of the test device in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.

[0259] Figure 8 A schematic diagram of the structure of a business device provided by this application. Figure 8 As shown, the service equipment 80 includes:

[0260] Processor 81, memory 82, and communication interface 83;

[0261] The memory 82 is used to store executable instructions of the processor 81;

[0262] The processor 81 is configured to execute the technical solution of the service device in any of the aforementioned method embodiments by executing the executable instructions.

[0263] Optionally, the memory 82 can be independent or integrated with the processor 81.

[0264] Optionally, when the memory 82 is a device independent of the processor 81, the service device 80 may further include:

[0265] The bus 84 , the memory 82 and the communication interface 83 are connected to the processor 81 via the bus 84 and communicate with each other. The communication interface 83 is used to communicate with other devices.

[0266] Optionally, the communication interface 83 may be implemented by a transceiver. The communication interface is used to implement communication between the database access device and other devices (such as a client, a read-write library, and a read-only library). The memory may include a random access memory (RAM) and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.

[0267] The bus 84 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0268] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0269] The service device is used to execute the technical solution of the service device in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.

[0270] Fig. 9 This is a schematic diagram of the structure of a test device provided in this application. Fig. 9 As shown, the test device 90 comprises:

[0271] Processor 91, memory 92, and communication interface 93;

[0272] The memory 92 is used to store executable instructions of the processor 91;

[0273] The processor 91 is configured to execute the technical solution of the test device in any of the aforementioned method embodiments by executing the executable instructions.

[0274] Optionally, the memory 92 may be independent or integrated with the processor 91 .

[0275] Optionally, when the memory 92 is a device independent of the processor 91, the test device 90 may further include:

[0276] The bus 94 , the memory 92 and the communication interface 93 are connected to the processor 91 via the bus 94 and communicate with each other. The communication interface 93 is used to communicate with other devices.

[0277] Optionally, the communication interface 93 may be implemented by a transceiver. The communication interface is used to implement communication between the database access device and other devices (such as a client, a read-write library, and a read-only library). The memory may include a random access memory (RAM) and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.

[0278] The bus 94 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0279] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0280] The testing device is used to execute the technical solution of the testing device in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.

[0281] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the technical solution provided by any of the aforementioned method embodiments is implemented.

[0282] An embodiment of the present application also provides a computer program product, including a computer program, which is used to implement the technical solution provided by any of the aforementioned method embodiments when executed by a processor.

[0283] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0284] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A mode switching method, characterized in that: Applied to business equipment, the method comprises: When the operation mode is user mode, open the communication port; If a communication connection request sent by the test device is received through the communication port within a preset timeout period, a communication connection is established with the test device; Obtaining and storing a mode variable from the test device through the communication connection, wherein the mode variable is used to indicate that the operation mode of the service device after restart is a test mode or a user mode; Restarting the service device; When the mode variable indicates that the operating mode is the test mode, the test mode is entered.

2. The method according to claim 1, characterized in that The acquiring and storing the mode variable from the test device through the communication connection includes: Receiving, via the communication connection, an identity authentication instruction sent by the test device; By interacting with the test device, the test device is verified to obtain a verification result, wherein the verification result is used to indicate that the verification is passed or that the verification is not passed; If the verification result indicates that the verification is passed, sending a variable acquisition instruction to the test device; The mode variable sent by the test device is received and stored.

3. The method according to claim 2, characterized in that The verifying the test device by interacting with the test device to obtain a verification result includes: Generate random numbers; Encoding the random number to obtain a first character string; sending the first character string to the testing device via the communication connection; Receiving, via the communication connection, a second character string sent by the service device; Decoding the second character string to obtain an encrypted value; Decrypt the encrypted value using the public key to obtain a verification value; Determining whether the verification value is the same as the random number; If the verification value is the same as the random number, a verification result indicating that the verification is passed is generated; If the verification value is different from the random number, a verification result indicating that the verification failed is generated.

4. The method according to claim 2 or 3, characterized in that: The method further comprises: If the verification result indicates that the verification fails, the communication connection is disconnected and the communication port is closed.

5. The method according to claim 1, characterized in that When the operation mode is the user mode, before opening the communication port, the method further includes: When the service device is started, the operation mode is determined according to whether the mode variable is stored in the service device, and the operation mode is a user mode or a test mode.

6. The method according to claim 5, characterized in that The determining the operation mode according to whether the mode variable is stored in the service device includes: Determining whether a mode variable has been stored in the service device; If the mode variable is not stored in the service device, determining that the operation mode is the user mode; If the mode variable has been stored in the service device, determining whether the variable value of the mode variable is a preset variable value; If the variable value of the mode variable is not the preset variable value, determining that the operation mode is the user mode; If the variable value of the mode variable is the preset variable value, it is determined that the operating mode is the test mode.

7. The method according to claim 1, characterized in that The method further comprises: If no communication connection request sent by the test device is received through the communication port within the preset timeout period, the communication port is closed.

8. The method according to claim 1, characterized in that The method further comprises: receiving a variable deletion instruction sent by the test device; Deleting the pattern variable; The communication connection is disconnected and the communication port is closed.

9. A mode switching method, characterized in that: Applied to testing equipment, the method comprises: In response to the acquired test instruction, sending a communication connection request to the service device through a communication port opened by the service device; Establishing a communication connection with the service device; When receiving the variable acquisition instruction sent by the service device, a mode variable is sent to the service device, where the mode variable is used to indicate that the operation mode of the service device after restart is the test mode or the user mode.

10. A service device, characterized in that: include: Processor, memory, communication interface; The memory is used to store executable instructions of the processor; The processor is configured to execute the mode switching method according to any one of claims 1 to 8 by executing the executable instructions.