Method, device and storage medium for a POS device to establish a P2P connection
By using the OUI information comparison mechanism in POS devices, P2P connections are established only with devices from specific manufacturers, solving the problem that POS devices cannot distinguish trusted devices when scanning connections, thus improving communication security and data protection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN XINGUODU TECH
- Filing Date
- 2024-10-28
- Publication Date
- 2026-07-10
AI Technical Summary
Existing POS devices lack a manufacturer-specific filtering mechanism when scanning connections between peer-to-peer devices, making it impossible to accurately distinguish between trusted and unauthorized devices. This increases the risk of connecting to insecure devices and threatens the confidentiality, integrity, and availability of transaction data.
By sending a scanning signal to the scanned device and receiving its OUI information, the OUI information is compared, and a P2P connection is established only with devices whose OUI information matches. The OUI information is used as a prerequisite for allowing the establishment of a P2P connection, ensuring that the connection is only established with devices from a specific manufacturer.
It effectively prevents unauthorized access by unknown or malicious devices, reduces the risk of data leakage and system attacks, and improves the security of P2P communication.
Smart Images

Figure CN119653519B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of POS device technology, and in particular to a method, apparatus and storage medium for establishing a P2P connection on a POS device. Background Technology
[0002] Currently, POS devices on the market generally employ a broad scanning method when scanning for peer-to-peer (P2P) device connections. This method indiscriminately detects and identifies all wireless devices within its signal range, offering high flexibility in device discovery. However, this indiscriminate scanning method has significant security shortcomings. Specifically, due to the lack of an effective filtering mechanism targeting specific device manufacturers (i.e., device vendors), POS devices cannot accurately distinguish which devices are from trusted or authorized manufacturers and which may be unauthorized or even security-risk third-party devices. Therefore, this scanning method greatly increases the risk of POS devices connecting to insecure or unauthorized devices, thereby threatening the confidentiality, integrity, and availability of transaction data, and causing potential data breaches and security vulnerabilities. Summary of the Invention
[0003] To address the aforementioned technical problems, this application provides a method, apparatus, and storage medium for establishing a P2P connection on a POS device, thereby improving the security of P2P communication on the POS device.
[0004] The technical solution provided in this application is described below:
[0005] The first aspect of this application provides a method for establishing a P2P connection using a POS device, including:
[0006] Send a scan signal to the device being scanned and receive a connection request from the device being scanned, the connection request including the OUI information of the device being scanned;
[0007] The specified OUI information is compared with the OUI information of the scanned device to obtain the comparison result; the specified OUI information is the information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection;
[0008] When the comparison result indicates that the specified OUI information matches the OUI information of the scanned device, a P2P connection is established with the scanned device.
[0009] Optionally, before sending the scanning signal to the scanned device, the method further includes:
[0010] When the P2P service is started according to user instructions, the current P2P connection status is monitored periodically to obtain monitoring results.
[0011] If the monitoring result indicates that there is currently no P2P connection, a scanning signal is sent to the scanned device via broadcast scanning.
[0012] If the monitoring results indicate that the current P2P connection is normal and active, then the scanning device will stop.
[0013] Optionally, the period for periodically monitoring the current P2P connection status is preset according to a specified method, wherein the specified method is:
[0014] Obtain the target formula, which is:
[0015] T = (1 + k) × T b , T≤t;
[0016] Where T is the period for the next periodic monitoring of the current P2P connection status, T b The period for this periodic monitoring of the current P2P connection status is defined as k, where k is the preset growth rate and t is the preset threshold.
[0017] The period for periodically monitoring the current P2P connection status is calculated according to the target formula. When T exceeds a preset threshold, the preset threshold is used as the period for periodically monitoring the current P2P connection status.
[0018] Optionally, the connection request may also include the MAC address of the scanned device, and after establishing a P2P connection with the scanned device, it may also include:
[0019] The MAC address of the scanned device is added to the scan list, which is a list of devices that are allowed to connect automatically. The scan list is stored in the configuration information area.
[0020] Optionally, after adding the MAC address of the scanned device to the scan list, the method further includes:
[0021] When the scan list stores several MAC addresses, the communication status data of the P2P connection corresponding to each MAC address is obtained. The communication status data includes the signal strength and number of connections of the P2P connection.
[0022] The MAC addresses are sorted according to the communication status data so that a P2P connection can be established according to the order displayed in the scan list.
[0023] Optionally, after receiving the connection request from the scanned device, the method further includes:
[0024] If the MAC address of the scanned device is the only one displayed in the scan list, a P2P connection is established directly with the scanned device.
[0025] Optionally, after comparing the specified OUI information with the OUI information of the scanned device to obtain a comparison result, the method further includes:
[0026] When the comparison result indicates that the specified OUI information does not match the OUI information of the scanned device, the connection request of the scanned device is rejected.
[0027] A second aspect of this application provides an apparatus for establishing a P2P connection in a POS device, applied to a POS device, comprising:
[0028] The scanning unit is used to send a scanning signal to the device being scanned and to receive a connection request from the device being scanned, the connection request including the OUI information of the device being scanned.
[0029] The comparison unit is used to compare the specified OUI information with the OUI information of the scanned device to obtain a comparison result; the specified OUI information is information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection;
[0030] The P2P connection unit is used to establish a P2P connection with the scanned device when the comparison result indicates that the specified OUI information matches the OUI information of the scanned device.
[0031] A third aspect of this application provides an apparatus for establishing a P2P connection using a POS device, the apparatus comprising:
[0032] Processor, memory, input / output units, and bus;
[0033] The processor is connected to the memory, the input / output unit, and the bus;
[0034] The memory stores a program, which the processor calls to execute the method for establishing a P2P connection by the POS device, as selected by the first aspect and any one of the first aspects.
[0035] The fourth aspect of this application provides a computer-readable storage medium storing a program that, when executed on a computer, performs the method of establishing a P2P connection by the POS device according to the first aspect and any one of the first aspects.
[0036] As can be seen from the above technical solutions, this application has the following advantages:
[0037] This application provides a method for a POS device to establish a P2P connection. First, a scanning signal is sent to the device being scanned, and a connection request is received from the device being scanned. The connection request includes the OUI information of the device being scanned. Second, a specified OUI information is compared with the OUI information of the device being scanned to obtain a comparison result. The specified OUI information is information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of devices allowed to establish P2P connections. When the comparison result indicates that the specified OUI information matches the OUI information of the device being scanned, a P2P connection is established with the device being scanned. OUI information is typically used to identify network device manufacturers. By adding specified OUI information to the main device type field as a prerequisite for allowing P2P connections, only devices from a specific manufacturer, i.e., whose OUI information matches the specified OUI, are allowed to establish P2P connections. This effectively prevents unauthorized access by unknown or malicious devices, greatly reducing the risk of data leakage and system attacks. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.
[0039] Figure 1 A schematic flowchart of an embodiment of the method for establishing a P2P connection for the POS device provided in this application;
[0040] Figure 2 A schematic flowchart of another embodiment of the method for establishing a P2P connection for the POS device provided in this application;
[0041] Figure 3 A schematic flowchart of another embodiment of the method for establishing a P2P connection for the POS device provided in this application;
[0042] Figure 4 A schematic diagram of an embodiment of the apparatus for establishing a P2P connection for the POS device provided in this application;
[0043] Figure 5 A schematic diagram of another embodiment of the apparatus for establishing a P2P connection for the POS device provided in this application. Detailed Implementation
[0044] This application provides a method, apparatus, and storage medium for establishing a P2P connection on a POS device, which improves the security of P2P communication on the POS device.
[0045] It should be noted that the method for establishing a P2P connection for a POS device provided in this application can be applied to a terminal, a system, or a server. For example, a terminal can be a smartphone, computer, tablet, portable computer terminal, or a fixed terminal such as a desktop computer.
[0046] It should also be noted that the terms "first," "second," etc., in the specification and drawings are used to distinguish similar objects and are not necessarily used to describe a specific order, sequence, or importance.
[0047] Please see Figure 1 This application provides an embodiment of a method for establishing a P2P connection using a POS device, the method comprising:
[0048] Step S101: Send a scanning signal to the device being scanned and receive a connection request from the device being scanned. The connection request includes the OUI information of the device being scanned.
[0049] Step S102: Compare the specified OUI information with the OUI information of the scanned device to obtain the comparison result; the specified OUI information is the information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection;
[0050] Step S103: When the comparison result indicates that the specified OUI information matches the OUI information of the scanned device, a P2P connection is established with the scanned device.
[0051] The method for establishing a P2P connection using a POS device according to the present invention first adds specified OUI information to the main device type field. The specified OUI information is the MAC address prefix of devices allowed to establish P2P connections. Then, a scanning signal is sent to the scanned device, and a connection request from the scanned device, including its OUI information, is received. Next, the specified OUI information is compared with the OUI information of the scanned device to obtain a comparison result. When the comparison result indicates that the specified OUI information matches the OUI information of the scanned device, a P2P connection is established with the scanned device. OUI information is typically used to identify network device manufacturers. By adding specified OUI (Organizationally Unique Identifier) information to the main device type field as a prerequisite for allowing P2P connections, only devices from a specific manufacturer, i.e., whose OUI information matches the specified OUI, are allowed to establish P2P connections. This effectively prevents unauthorized access by unknown or malicious devices, greatly reducing the risk of data leakage and system attacks.
[0052] In step S101 of some embodiments, a scanning signal is sent to the scanned device, and a connection request from the scanned device is received. The connection request includes the OUI information of the scanned device. The scanning signal is typically a broadcast signal transmitted via wireless communication technology. The scanning signal contains basic information about the POS device, such as device name, service type, and supported communication protocols, enabling the scanned device to identify itself. The POS device sends the scanning signal to devices in the surrounding environment. After receiving the scanning signal, the scanned device sends a connection request back to the POS device, indicating its willingness to establish a P2P connection with the POS device. This connection request includes the OUI information carried by the scanned device itself, which identifies the manufacturer of the scanned device, i.e., the company to which it belongs. In addition, further information such as the device name, model, supported encryption methods, and connection key can be obtained to verify the device's identity, determine whether to allow the connection, and establish a secure communication channel.
[0053] Reference Figure 2 Before sending the scan signal to the device being scanned in step S101, in order to avoid increasing the power consumption of the POS device due to invalid scanning operations, a P2P service switch can be preset to control the scanning operation. That is, when the user starts the P2P service, scanning is performed according to actual needs. Specifically, it may include, but is not limited to, the following:
[0054] Step S201: When the P2P service is started according to the user's instructions, the current P2P connection status is monitored periodically to obtain the monitoring results;
[0055] Step S202: If the monitoring result indicates that there is currently no P2P connection, a scanning signal is sent to the scanned device via broadcast scanning.
[0056] Step S203: If the monitoring results indicate that the current P2P connection is normal and active, then stop the scanning device.
[0057] In step S201 of some embodiments, when the P2P service is started according to a user instruction, the current P2P connection status is monitored periodically to obtain monitoring results. The user instruction is a request sent by the user to the device through a user interface (such as an application, system settings, etc.) to start the P2P (peer-to-peer) service. After receiving the user instruction, the relevant components and configurations of the P2P service are initialized. After the P2P service is started, the P2P connection status is monitored periodically. The monitoring process is periodic, that is, the P2P connection status is checked at predetermined time intervals (such as per second, per minute, etc.). The monitored content may include parameters such as whether the connection exists, the stability of the connection, the data transmission rate, and latency. After each monitoring is completed, the monitoring results are collected and stored for subsequent judgment and decision-making. It should be noted that the period for periodically monitoring the current P2P connection status is not always a fixed value; the period is set according to a specified method, which may include, but is not limited to, the following: Obtain the target formula: T = (1 + k) × T b , T≤t; where T is the period for the next periodic monitoring of the current P2P connection status, T b The period for periodically monitoring the current P2P connection status is defined by k, where k is the preset growth rate and t is the preset threshold. The period for periodically monitoring the current P2P connection status is calculated according to the target formula. When T exceeds the preset threshold, the preset threshold becomes the period for periodically monitoring the current P2P connection status. The preset growth rate k can be determined by data such as the frequency and number of P2P connections established by the POS device. t can be set according to actual needs, for example, 30 seconds. That is, when the period T increases to 30 seconds or greater, the calculation stops, and T remains at 30 seconds.
[0058] In some embodiments, in steps S202 to S203, if the monitoring result indicates that there is currently no P2P connection, a scan signal is sent to the scanned device via broadcast scanning; if the monitoring result indicates that the current P2P connection is normal and active, the scanning device is stopped. Subsequent steps are executed based on the monitoring result obtained in step S201. If the monitoring result indicates that there is currently no P2P connection (i.e., the POS device has not established a P2P connection with any other device), a broadcast scan is performed, i.e., scanning other devices near the POS device. Upon receiving the scan signal, the scanned device will respond to the scan signal and send a connection request to the POS device. If the monitoring result indicates that the current P2P connection is normal and active, it means that the POS device is already conducting P2P communication. To save resources and reduce power consumption, the scanning device should be stopped. After stopping the scan, both the POS device and the scanned device will continue to maintain the current P2P connection and perform necessary data transmission and communication. Simultaneously, the connection status is still monitored periodically to ensure the stability and reliability of the connection. If the connection status changes (e.g., connection interruption, performance degradation, etc.), broadcast scanning or other connection recovery operations can be restarted. This improves the efficiency of POS devices in establishing P2P connections.
[0059] In step S102 of some embodiments, the specified OUI information is compared with the OUI information of the scanned device to obtain a comparison result. The specified OUI information is information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection. After receiving a connection request, the OUI information of the scanned device in the connection request is extracted, and then the OUI information of the scanned device is compared with the specified OUI information added in step S101. The purpose of the comparison is to verify whether the scanned device requesting to establish a P2P connection belongs to a manufacturer or device type that allows connections. It should be noted that when the comparison result in step S102 indicates that the specified OUI information does not match the OUI information of the scanned device, it means that the scanned device is an illegal device, and the connection request of the scanned device should be rejected. A rejection message or error code can also be sent to the scanned device to indicate the reason for the connection request being rejected. It should also be noted that one or more specified OUI information can be configured in the main device type field of the POS device. These specified OUI information are protocol specifications, that is, unique identifiers assigned to manufacturers by IEEE, representing the MAC address prefix of the device that is allowed to establish a P2P connection with the POS device. By setting these specific OUI information, the system can restrict P2P connections to only devices from specific manufacturers or that meet specific conditions.
[0060] In step S103 of some embodiments, when the comparison result indicates that the specified OUI information matches the OUI information of the scanned device, a P2P connection is established with the scanned device. If the comparison result in step S102 indicates that the specified OUI information matches the OUI information of the scanned device, it means that the scanned device requesting the establishment of a P2P connection meets the requirements, i.e., it is allowed to establish a P2P connection with the current device. In this case, the POS device will accept the connection request and establish a P2P connection with the scanned device. Then, it can continue to execute the subsequent P2P connection establishment process, such as verifying other connection parameters, negotiating communication parameters, etc. Furthermore, the two devices can perform data transmission, file sharing, or other P2P communication activities.
[0061] Reference Figure 3 The connection request also includes the MAC address of the scanned device. To improve the intelligence and ease of use of the POS device, an automatic connection mechanism can be set up. That is, after establishing a P2P connection with the scanned device in step S103, the MAC address of the scanned device is stored in the scan list. Specifically, it may include, but is not limited to, the following:
[0062] Step S301: Add the MAC address of the device to be scanned to the scan list. The scan list is a list of devices that are allowed to connect automatically. The scan list is stored in the configuration information area.
[0063] Step S302: When the scan list stores several MAC addresses, obtain the communication status data of the P2P connection corresponding to each MAC address. The communication status data includes the signal strength and number of connections of the P2P connection.
[0064] Step S303: Sort several MAC addresses according to the communication status data so that a P2P connection can be established according to the order displayed in the scan list.
[0065] In some embodiments, steps S301 to S303 first involve adding the MAC address of the device to be scanned to a scan list. This scan list is a list of devices allowed to connect automatically and is stored in the configuration information area. When the scan list contains several MAC addresses, communication status data for the P2P connection corresponding to each MAC address is obtained. This communication status data includes the signal strength and number of connections for the P2P connection. The MAC addresses are then sorted according to the communication status data so that a P2P connection can be established based on the order displayed in the scan list. Devices that have established P2P connections with the POS device are eligible for connection. To reduce repetitive and meaningless comparison and verification processes, the MAC address of the device being scanned can be added to the POS device's scan list. The scan list is typically stored in the POS device's configuration information area for subsequent access and management.
[0066] When a scan list contains several MAC addresses, the communication status data of the P2P connection corresponding to each MAC address is obtained. This communication status data includes signal strength and connection count, which is used to make subsequent connection decisions. The MAC addresses are then sorted according to the communication status data to prompt for P2P connection establishment based on the order displayed in the scan list. A sorting algorithm (such as a weighted sort based on signal strength and connection count) is used to sort the MAC addresses in the scan list. The specific sorting rules can be customized according to actual needs, but generally, devices with strong signal strength and high connection counts are given priority. After sorting, the device updates the display order of the scan list to reflect the sorting results. Finally, based on the updated scan list order, the device can automatically or prompt the user to select a device to establish a P2P connection, thereby improving the connection success rate and stability.
[0067] It should be noted that in step S101, the connection request of the scanned device is received, and the MAC address of the scanned device is the only one displayed in the scan list in step S301. This means that the MAC address of the scanned device is a device that has previously been filtered and established a P2P connection, and there are no other selectable devices in the scan list. Therefore, there is no need to perform another OUI information matching filter, and the POS device can directly establish a P2P connection with the scanned device.
[0068] The above embodiments illustrate the method for establishing a P2P connection in a POS device provided in this application. The apparatus and storage medium for establishing a P2P connection in a POS device provided in this application will be described below:
[0069] Please see Figure 4 This application provides an embodiment of an apparatus for establishing a P2P connection using a POS device, the apparatus comprising:
[0070] The scanning unit 401 is used to send a scanning signal to the device being scanned and to receive a connection request from the device being scanned, the connection request including the OUI information of the device being scanned;
[0071] The comparison unit 402 is used to compare the specified OUI information with the OUI information of the scanned device to obtain the comparison result; the specified OUI information is the information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection;
[0072] P2P connection unit 403 is used to establish a P2P connection with the scanned device when the comparison result indicates that the specified OUI information matches the OUI information of the scanned device.
[0073] Optionally, prior to scanning unit 401, the following may also be included:
[0074] The periodic monitoring unit 404 is used to periodically monitor the current P2P connection status and obtain monitoring results when the P2P service is enabled according to user instructions. If the monitoring result indicates that there is no P2P connection, a scanning signal is sent to the scanned device through broadcast scanning. If the monitoring result indicates that the current P2P connection is normal and active, the scanning device is stopped.
[0075] Optionally, the period for periodically monitoring the current P2P connection status can be preset according to a specified method, which is as follows:
[0076] Obtain the target formula, which is:
[0077] T = (1 + k) × T b , T≤t;
[0078] Where T is the period for the next periodic monitoring of the current P2P connection status, T b The period for this periodic monitoring of the current P2P connection status is defined as k, where k is the preset growth rate and t is the preset threshold.
[0079] The period for periodically monitoring the current P2P connection status is calculated based on the target formula. When T exceeds the preset threshold, the preset threshold is used as the period for periodically monitoring the current P2P connection status.
[0080] Optionally, following the P2P connection unit 403, the following may also be included:
[0081] The scan list unit 405 is used to add the MAC address of the device to be scanned to the scan list. The scan list is a list of devices that are allowed to connect automatically, and the scan list is stored in the configuration information area.
[0082] Optionally, after scanning list cell 405, the following may also be included:
[0083] The communication status data unit 406 is used to obtain the communication status data of the P2P connection corresponding to each MAC address when the scan list stores several MAC addresses. The communication status data includes the signal strength and number of connections of the P2P connection.
[0084] The sorting unit 407 is used to sort several MAC addresses according to communication status data so as to establish a P2P connection according to the order displayed in the scan list.
[0085] Optionally, after scanning unit 401, the following may also be included:
[0086] The automatic connection unit 408 is used to directly establish a P2P connection with the scanned device if the MAC address of the scanned device is the only one displayed in the scan list.
[0087] Optionally, following the comparison unit 402, the following may also be included:
[0088] The rejection unit 409 is used to reject the connection request of the scanned device when the comparison result indicates that the specified OUI information does not match the OUI information of the scanned device.
[0089] This application also provides a device for establishing a P2P connection on a POS device; please refer to [link / reference]. Figure 5 The device includes:
[0090] Processor 501, memory 502, input / output unit 503, bus 504;
[0091] The processor 501 is connected to the memory 502, the input / output unit 503, and the bus 504;
[0092] The memory 502 stores a program, and the processor 501 calls the program to execute it, such as... Figure 1 , Figure 2 or Figure 3 The method for establishing a P2P connection using a POS device as shown in the embodiment.
[0093] This application also relates to a computer-readable storage medium on which a program is stored, which, when run on a computer, causes the computer to perform actions such as... Figure 1 , Figure 2 or Figure 3 The method for establishing a P2P connection using a POS device as shown in the embodiment.
[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0097] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0098] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for establishing a P2P connection, characterized in that, Applied to a POS device, the method includes: When the P2P service is started according to user instructions, the current P2P connection status is monitored periodically to obtain monitoring results. The period for periodically monitoring the current P2P connection status is preset according to a specified method, which is: obtaining a target formula, where the target formula is: T = (1 + k) × T b , T≤t; where T is the period for the next periodic monitoring of the current P2P connection status, T b The period for periodically monitoring the current P2P connection status is defined as k, where k is a preset growth rate and t is a preset threshold. The period for periodically monitoring the current P2P connection status is calculated according to the target formula. When T exceeds the preset threshold, the preset threshold is used as the period for periodically monitoring the current P2P connection status. If the monitoring result indicates that there is currently no P2P connection, a scanning signal is sent to the scanned device via broadcast scanning, and a connection request from the scanned device is received. The connection request includes the OUI information of the scanned device. The specified OUI information is compared with the OUI information of the scanned device to obtain the comparison result; the specified OUI information is the information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection; When the comparison result indicates that the specified OUI information matches the OUI information of the scanned device, a P2P connection is established with the scanned device. After periodically monitoring the current P2P connection status and obtaining the monitoring results, the process also includes: If the monitoring results indicate that the current P2P connection is normal and active, then the scanning device will stop.
2. The method according to claim 1, characterized in that, The connection request also includes the MAC address of the scanned device, and after establishing a P2P connection with the scanned device, it further includes: The MAC address of the scanned device is added to the scan list, which is a list of devices that are allowed to connect automatically. The scan list is stored in the configuration information area.
3. The method according to claim 2, characterized in that, After adding the MAC address of the scanned device to the scan list, the method further includes: When the scan list stores several MAC addresses, the communication status data of the P2P connection corresponding to each MAC address is obtained. The communication status data includes the signal strength and number of connections of the P2P connection. The MAC addresses are sorted according to the communication status data so that a P2P connection can be established according to the order displayed in the scan list.
4. The method according to claim 2, characterized in that, After receiving the connection request from the scanned device, the method further includes: If the MAC address of the scanned device is the only one displayed in the scan list, a P2P connection is established directly with the scanned device.
5. The method according to any one of claims 1-4, characterized in that, After comparing the specified OUI information with the OUI information of the scanned device to obtain the comparison result, the method further includes: When the comparison result indicates that the specified OUI information does not match the OUI information of the scanned device, the connection request of the scanned device is rejected.
6. A device for establishing a P2P connection in a POS device, characterized in that, The device for establishing a P2P connection in the POS device includes: The scanning unit is used to periodically monitor the current P2P connection status and obtain monitoring results when the P2P service is started according to user instructions. The periodic monitoring period is preset according to a specified method, which is to obtain a target formula, where the target formula is: T = (1 + k) × T. b , T≤t; where T is the period for the next periodic monitoring of the current P2P connection status, T b The period for periodically monitoring the current P2P connection status is defined as follows: k is a preset growth rate, and t is a preset threshold. The period for periodically monitoring the current P2P connection status is calculated according to the target formula. When T exceeds the preset threshold, the preset threshold is used as the period for periodically monitoring the current P2P connection status. If the monitoring result indicates that there is currently no P2P connection, a scanning signal is sent to the scanned device through broadcast scanning, and a connection request from the scanned device is received. The connection request includes the OUI information of the scanned device. The comparison unit is used to compare the specified OUI information with the OUI information of the scanned device to obtain a comparison result; the specified OUI information is information added to the main device type field of the POS device, and the specified OUI information is the MAC address prefix of the device that is allowed to establish a P2P connection; The P2P connection unit is used to establish a P2P connection with the scanned device when the comparison result indicates that the specified OUI information matches the OUI information of the scanned device. Following the scanning unit, a periodic monitoring unit is also included, which stops the scanning device if the monitoring result indicates that the current P2P connection is normal and active.
7. A device for establishing a P2P connection in a POS device, characterized in that, The device includes: Processor, memory, input / output units, and bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores a program, which the processor calls to execute the method for establishing a P2P connection by the POS device as described in any one of claims 1 to 5.
8. A computer-readable storage medium having a program stored thereon, the program, when executed on a computer, performing the method for establishing a P2P connection by a POS device as described in any one of claims 1 to 5.