CN113965917A - Communication method, device and terminal equipment - Google Patents

Communication method, device and terminal equipment Download PDF

Info

Publication number
CN113965917A
CN113965917A CN202111214249.9A CN202111214249A CN113965917A CN 113965917 A CN113965917 A CN 113965917A CN 202111214249 A CN202111214249 A CN 202111214249A CN 113965917 A CN113965917 A CN 113965917A
Authority
CN
China
Prior art keywords
equipment
application
character
information
serial port
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111214249.9A
Other languages
Chinese (zh)
Other versions
CN113965917B (en
Inventor
刘均
喻东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN202111214249.9A priority Critical patent/CN113965917B/en
Publication of CN113965917A publication Critical patent/CN113965917A/en
Application granted granted Critical
Publication of CN113965917B publication Critical patent/CN113965917B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/26Network addressing or numbering for mobility support

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephone Function (AREA)

Abstract

The application is applicable to the technical field of vehicle diagnosis, and provides a communication method, a device and terminal equipment, wherein the communication method comprises the following steps: acquiring a Bluetooth address of the application equipment successfully paired with the terminal equipment; searching a corresponding friendly name according to the Bluetooth address of the application equipment; determining the serial port number of the application equipment in the terminal equipment according to the friendly name; and communicating with the application equipment according to the serial port number of the application equipment at the terminal equipment. By the method, the serial port number of the application equipment at the terminal equipment can be accurately determined.

Description

Communication method, device and terminal equipment
Technical Field
The present application belongs to the field of communication technologies, and in particular, to a communication method, an apparatus, a terminal device, and a computer-readable storage medium.
Background
At present, most of terminal equipment and application equipment of a vehicle realize Bluetooth communication in a mode of converting Bluetooth into a serial port, and before the Bluetooth communication is realized, the number of the serial port to be converted needs to be determined.
The existing method is that a terminal device firstly uses a registry to obtain a current effective serial number of the terminal device, then performs pairing of an application device for converting Bluetooth into a serial port, then obtains a current new effective serial number of the terminal device, compares the two obtained effective serial numbers to obtain a newly added serial number, and judges that the newly added serial number is a serial number to be converted of the vehicle application device.
However, the serial port number to be converted of the application device may not be accurately determined by the method.
Disclosure of Invention
The embodiment of the application provides a communication method, a communication device and terminal equipment, and can improve the accuracy of the serial number of the obtained application equipment.
In a first aspect, an embodiment of the present application provides a communication method, which is applied to a terminal device, and includes:
acquiring a Bluetooth address of the application equipment successfully paired with the terminal equipment;
searching a corresponding friendly name according to the Bluetooth address of the application equipment;
determining the serial port number of the application equipment in the terminal equipment according to the friendly name;
and communicating with the application equipment according to the serial port number of the application equipment at the terminal equipment.
Optionally, the searching for the corresponding friendly name according to the bluetooth address of the application device includes:
determining all device information currently used by the terminal device;
determining target device information in all the device information according to the Bluetooth address of the application device, wherein the target device information is the device information of the application device in the terminal device;
and searching for the friendly name in the target equipment information.
Optionally, the determining, according to the bluetooth address of the application device, target device information in the all device information includes:
selecting unselected equipment information from all the equipment information, and if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment, extracting a target address of corresponding equipment from the currently selected equipment information;
if the extracted target address of the equipment is the same as the Bluetooth address of the application equipment, determining the currently selected equipment information as the target equipment information;
and if the currently selected device information does not contain a character string for indicating that the device is a Bluetooth device or the target address is different from the Bluetooth address of the application device, returning to the step of selecting unselected device information from all the device information and the subsequent steps until the target device information is determined.
Optionally, the extracting a target address of a corresponding device from the currently selected device information includes:
searching for a character which is the same as a preset first character from the currently selected device information, and searching for a character which is the same as a preset second character;
and taking a character string between the character which is the same as the preset first character and the character which is the same as the preset second character as a target address of the equipment to be extracted.
Optionally, in the character string between the character same as the preset first character and the character same as the preset second character, neither the character same as the preset first character nor the character same as the preset second character is included.
Optionally, the determining the serial port number of the application device at the terminal device according to the friendly name includes:
resolving the friendly name to obtain a corresponding resolving result;
and if the analysis result contains the specified character string, determining the specified character string and all characters behind the specified character string as the serial port number of the application equipment at the terminal equipment.
Optionally, after determining the serial port number of the application device at the terminal device according to the friendly name, the method includes:
and saving the serial port number into a configuration file.
In a second aspect, an embodiment of the present application provides a communication apparatus, which is applied to a terminal device, and includes:
the Bluetooth address acquisition module is used for acquiring the Bluetooth address of the application equipment successfully paired with the terminal equipment;
the friendly name searching module is used for searching a corresponding friendly name according to the Bluetooth address of the application equipment;
the serial port number determining module is used for determining the serial port number of the application equipment in the terminal equipment according to the friendly name;
and the communication module is used for communicating with the application equipment according to the serial port number of the application equipment at the terminal equipment.
In a third aspect, an embodiment of the present application provides a terminal device, including: a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the method according to the first aspect when executing the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method according to the first aspect.
In a fifth aspect, the present application provides a computer program product, which when run on a terminal device, causes the terminal device to execute the method of the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that:
in the embodiment of the application, the friendly names respectively correspond to the bluetooth address and the serial port number of the application device, so the serial port number determined according to the method is the serial port number corresponding to the bluetooth address of the application device, but not the serial port numbers corresponding to other application devices. That is, the serial port number of the application device at the terminal device can be accurately determined by the method, so that the terminal device can successfully perform Bluetooth communication with the application device through the determined serial port number. Meanwhile, the friendly name is searched only through the Bluetooth address of the application equipment, and the addresses in the two effective serial port lists are not required to be matched, so that the determination speed of the serial port number can be increased, and the starting time of the diagnosis application program software installed on the terminal equipment is prolonged.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below.
Fig. 1 is a flowchart of a communication method according to an embodiment of the present application;
fig. 2 is a flow chart of another communication method provided by an embodiment of the present application;
fig. 3 is a schematic diagram of a character string for indicating that a device is a bluetooth device according to an embodiment of the present application;
FIG. 4 is a diagram illustrating a first character and a second character according to an embodiment of the present application;
FIG. 5 is a diagram illustrating the result of resolving a friendly name provided by an embodiment of the present application;
fig. 6 is a schematic structural diagram of a communication device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise.
The first embodiment is as follows:
currently, the bluetooth serial number of the application device is usually determined by obtaining an effective serial list before and after the terminal device performs bluetooth pairing. However, when the serial port is not normally closed, the serial port number corresponding to the serial port still exists in the valid serial port list of the terminal device, and the serial port number corresponding to the serial port is actually an invalid serial port number, so that the serial port number of the bluetooth-to-serial port cannot be accurately determined by the serial port numbers in the valid serial port lists before and after bluetooth pairing.
In order to solve the above technical problem, an embodiment of the present application provides a communication method, which is applied to a terminal device, such as a PC (personal computer). In the method, after the terminal device and the application device are successfully paired, the Bluetooth address of the application device is obtained, the corresponding friendly name is obtained according to the Bluetooth address of the application device, the corresponding serial port number is determined according to the friendly name, and finally the terminal device and the application device communicate according to the determined serial port number. The friendly name corresponds to the Bluetooth address and the serial port number of the application device respectively, so that the serial port number determined according to the method is the serial port number corresponding to the Bluetooth address of the application device, namely, the serial port number of the application device at the terminal device can be accurately determined through the method, and therefore the terminal device can be ensured to be in Bluetooth communication with the application device through the determined serial port number successfully.
The following describes a communication method provided in an embodiment of the present application with reference to the drawings.
Fig. 1 shows a flowchart of a communication method provided in an embodiment of the present application, which is applied to a terminal device, where the terminal device may be a PC, and the following details are described as follows:
and step S11, acquiring the Bluetooth address of the application equipment successfully paired with the terminal equipment.
In this embodiment, after the PC is successfully paired with the application device by using the bluetooth name of the application device, the bluetooth address of the application device may be obtained.
In some embodiments, the PC may obtain a Bluetooth Address (BT _ Address) of the application device through a microsoft Bluetooth device-like communication interface.
And step S12, searching the corresponding friendly name according to the Bluetooth address of the application device. The friendly name is one of device information of an application device on a PC, and includes a lot of hardware information of the application device.
In this embodiment, the friendly name of the application device is obtained by setting the parameter of the microsoft PC driver function to a specified value. For example, the parameters of the drive function, setupsigetdeviceregistratiyperproperty, are set to SPDRP _ FRIENDLYNAME for acquisition.
And step S13, determining the serial port number of the application device on the terminal device according to the friendly name.
In this embodiment, the corresponding serial number is obtained by analyzing the value of the friendly name.
And step S14, communicating with the application device according to the serial port number of the application device in the terminal device.
In this embodiment, the PC performs bluetooth communication with the application device according to the determined serial number.
In the embodiment of the application, the friendly names respectively correspond to the bluetooth address and the serial port number of the application device, so the serial port number determined according to the method is the serial port number corresponding to the bluetooth address of the application device, but not the serial port numbers corresponding to other application devices. That is, the serial port number of the application device at the terminal device can be accurately determined by the method, so that the terminal device can successfully perform Bluetooth communication with the application device through the determined serial port number. Meanwhile, the friendly name is searched only through the Bluetooth address of the application equipment, and the addresses in the two effective serial port lists are not required to be matched, so that the speed of determining the serial port number can be increased, and the starting time of the diagnosis application program software installed on the terminal equipment is prolonged.
Example two:
fig. 2 shows a schematic flowchart of another communication method provided in this embodiment, and in this embodiment, the step S12 is mainly detailed, and the step S21, the step S25, and the step S26 are respectively the same as the step S11, the step S13, and the step S14, and are not described again here.
And step S21, acquiring the Bluetooth address of the application equipment successfully paired with the terminal equipment.
Step S22, determining all the device information currently used by the terminal device.
In this embodiment, all the device information currently used by the terminal device may be at least one of the following: plug and Play (PNP), Small Computer System Interface (SCSI), Universal Serial Bus (USB), bluetooth, and other communication device information.
In some embodiments, a microsoft PC driver function (e.g., setupigeretdeviceinfililist) may be used to create a device information block list for the current PC, and a microsoft PC driver function (e.g., setupigegtclassdevexex) may be used to add the requested device information to the created device information block list, such that the device information block list contains device information for all devices currently in use in the current PC.
Step S23, determining target device information in the all device information according to the bluetooth address of the application device, where the target device information is device information of the application device in the terminal device.
In this embodiment, if one of the pieces of device information includes the bluetooth address of the application device, it is indicated that the piece of device information is device information of the application device in the PC, that is, target device information.
Step S24, finding the friendly name in the target device information.
In this embodiment, the friendly name in the target device information is obtained by setting the parameter of the microsoft PC driver function to a specified value.
And step S25, determining the serial port number of the application device on the terminal device according to the friendly name.
And step S26, communicating with the application device according to the serial port number of the application device in the terminal device.
In the embodiment of the application, the target address is the same address as the bluetooth address of the application device in all the device information being used by the terminal device, so that the device information of the application device can be determined as one device information being used by the terminal device as long as the terminal device can determine the target address, and the device information being used by the terminal device corresponds to the friendly name, so that the friendly name corresponding to the bluetooth address of the application device can be found subsequently.
In some embodiments, the step S23 includes:
and A1, selecting one piece of unselected device information from all the device information, and if the currently selected device information contains a character string used for indicating that the device is a Bluetooth device, extracting the target address of the corresponding device from the currently selected device information.
Wherein a string of "bthennum" may be employed to indicate whether a device is a bluetooth device.
In this embodiment, the device information may be arranged first, the device information may be selected one by one according to a sequence from the front to the back, and the target address of the device corresponding to the device information may be extracted from the selected device information. Of course, the device information may be selected one by one in a back-to-front order, as long as it is ensured that the selected device information is not selected.
And A2, if the extracted target address of the device is the same as the Bluetooth address of the application device, determining that the currently selected device information is the target device information.
A3, if the currently selected device information does not contain a character string for indicating that the device is a bluetooth device, or the target address is not the same as the bluetooth address of the application device, returning to the step of selecting an unselected device information from all the device information and the subsequent steps until the target device information is determined, or until all the device information is selected.
In the above-mentioned a1 to A3, the device information may be a value of a device instance path, and at this time, a microsoft PC driver function (e.g., setupigegtdevice instance id) may be used to obtain a value of the device instance path, and determine whether the value of the "device instance path" includes a character string "BTHENUM", and if so, the device is a bluetooth device; otherwise, indicating that the device is not a bluetooth device, return to step a 1. For example: assuming that "bthenun" indicates that the corresponding device is a bluetooth device, as shown in fig. 3, if the value of the obtained device instance path is "bthenun \ 00001101-.
In the above-mentioned a 1-A3, because what needs to obtain is the serial number of the bluetooth to serial port of the application device at the terminal device, therefore, after judging that a device is a bluetooth device, just extract the address of the bluetooth device, can avoid extracting the address of the non-bluetooth device, thereby can improve the speed of determining the target address.
In some embodiments, the extracting the target address of the corresponding device from the currently selected device information in the step a1 includes:
and A11, searching the character which is the same as the preset first character from the currently selected device information, and searching the character which is the same as the preset second character.
The first character and the second character are different characters. As shown in fig. 4, the first character may be set to "&" and the second character may be set to "_". The address between these two characters is denoted as a specific bluetooth address. For example: the device instance path is BTHENUM \ 00001101-.
And A12, taking a character string between the character which is the same as the preset first character and the character which is the same as the preset second character as the target address of the equipment to be extracted.
In this embodiment, a first character and a second character are set in advance, and a character string corresponding to a target address of a device is between the first character and the second character. Therefore, when the target address of the equipment needs to be extracted, the target address of the equipment can be extracted by directly searching the character which is the same as the preset first character and searching the character which is the same as the preset second character, and therefore the required target address of the equipment can be extracted quickly and accurately. In some embodiments, the character string between the character identical to the preset first character and the character identical to the preset second character does not include the character identical to the preset first character and does not include the character identical to the preset second character.
In this embodiment, it is considered that there may be a plurality of first characters and/or a plurality of second characters in the value of the device information, and therefore, only the character string between two adjacent first characters and second characters is extracted, and the accuracy of the extracted target address of the device can be further ensured. Referring to fig. 4, only a character string between the marked "&" and the marked "_" is extracted as a target address of the device.
In some embodiments, the step S25 (or step S13) includes:
and B1, resolving the friendly names to obtain corresponding resolution results.
B2, if the analysis result includes the designated character string, determining the designated character string and all characters following the designated character string as the serial number of the application device in the terminal device.
The specified character string may be a character string including COM.
In this embodiment, whether the analysis result includes a COM string is queried, and a COMXX string is obtained. Referring to fig. 5, assuming that the analysis result of the friendly name is "standard serial over bluetooth link (COM3)", since the analysis result includes a COM character string, "COM" and all characters "3" following the "COM" are set as the serial number of the application device in the terminal device.
In some embodiments, if the COM string is not contained in the parsing result, the procedure returns to step a1 to continue checking the next device.
In some embodiments, after the step S25 (or step S13) above, the method includes:
and storing the serial port number into a configuration file.
In this embodiment, because the serial number is maintained in the configuration file, when the subsequent terminal device communicates with the application device, the corresponding serial number can be directly read from the configuration file, thereby improving the efficiency of communication between the terminal device and the application device.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example three:
fig. 6 shows a block diagram of a communication device provided in the embodiment of the present application, which corresponds to the above-described communication method in the first embodiment and the second embodiment, and only shows portions related to the embodiment of the present application for convenience of description.
Referring to fig. 6, the communication apparatus 6 is applied to a terminal device, and includes:
and a bluetooth address obtaining module 61, configured to obtain a bluetooth address of the application device successfully paired with the terminal device.
And the friendly name searching module 62 is used for searching the corresponding friendly name according to the bluetooth address of the application device.
And a serial port number determining module 63, configured to determine, according to the friendly name, a serial port number of the application device at the terminal device.
And a communication module 64, configured to communicate with the application device according to the serial number of the application device at the terminal device.
In the embodiment of the application, the friendly names respectively correspond to the bluetooth address and the serial port number of the application device, so the serial port number determined according to the method is the serial port number corresponding to the bluetooth address of the application device, but not the serial port numbers corresponding to other application devices. That is, the serial port number of the application device at the terminal device can be accurately determined by the method, so that the terminal device can successfully perform Bluetooth communication with the application device through the determined serial port number. Meanwhile, the friendly name is searched only through the Bluetooth address of the application equipment, and the addresses in the two effective serial port lists are not required to be matched, so that the speed of determining the serial port number can be increased, and the starting time of the diagnosis application program software installed on the terminal equipment is prolonged.
In some embodiments, the friendly name lookup module 62 includes:
and the all-equipment information determining unit is used for determining all the equipment information currently used by the terminal equipment.
And a target address determining unit, configured to determine target device information in the all device information according to the bluetooth address of the application device, where the target device information is device information of the application device in the terminal device.
And the friendly name searching unit is used for searching the friendly name in the target equipment information.
In some embodiments, the target address determining unit is specifically configured to:
selecting unselected equipment information from all the equipment information, and if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment, extracting a target address of corresponding equipment from the currently selected equipment information;
if the extracted target address of the equipment is the same as the Bluetooth address of the application equipment, determining that the currently selected equipment information is the target equipment information;
if the currently selected device information does not contain a character string for indicating that the device is a bluetooth device, or the target address is different from the bluetooth address of the application device, returning to the step of selecting unselected device information from all the device information and subsequent steps until the target device information is determined, or until all the device information is selected.
In some embodiments, the extracting the target address of the corresponding device from the currently selected device information includes:
searching for a character which is the same as a preset first character from the currently selected device information, and searching for a character which is the same as a preset second character;
and taking a character string between the character which is the same as the preset first character and the character which is the same as the preset second character as a target address of the equipment to be extracted.
In some embodiments, the character string between the character identical to the preset first character and the character identical to the preset second character does not include the character identical to the preset first character and does not include the character identical to the preset second character.
In some embodiments, the serial number determining module includes:
and the friendly name analyzing unit is used for analyzing the friendly name to obtain a corresponding analyzing result.
And a designated character string recognition unit configured to, if the analysis result includes a designated character string, determine the designated character string and all characters following the designated character string as the serial number of the application device at the terminal device.
In some embodiments, the communication device 6 further comprises:
and the serial number storage module is used for storing the serial number into a configuration file.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Example four:
fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 7, the terminal device 7 of this embodiment includes: at least one processor 70 (only one processor is shown in fig. 7), a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, the steps of any of the various method embodiments being implemented by the processor 70 when the computer program 72 is executed by the processor 70;
acquiring a Bluetooth address of the application equipment successfully paired with the terminal equipment;
searching a corresponding friendly name according to the Bluetooth address of the application equipment;
determining the serial port number of the application equipment in the terminal equipment according to the friendly name;
and communicating with the application equipment according to the serial port number of the application equipment in the terminal equipment.
Optionally, the searching for the corresponding friendly name according to the bluetooth address of the application device includes:
determining all device information currently used by the terminal device;
determining target device information in the all device information according to the bluetooth address of the application device, wherein the target device information is the device information of the application device in the terminal device;
and searching for the friendly name in the target equipment information.
Optionally, the determining target device information in all the device information according to the bluetooth address of the application device includes:
selecting unselected equipment information from all the equipment information, and if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment, extracting a target address of corresponding equipment from the currently selected equipment information;
if the extracted target address of the equipment is the same as the Bluetooth address of the application equipment, determining that the currently selected equipment information is the target equipment information;
if the currently selected device information does not contain a character string for indicating that the device is a Bluetooth device or the target address is different from the Bluetooth address of the application device, returning to the step of selecting unselected device information from all the device information and subsequent steps until the target device information is determined.
Optionally, the extracting a target address of a corresponding device from the currently selected device information includes:
searching for a character which is the same as a preset first character from the currently selected device information, and searching for a character which is the same as a preset second character;
and taking a character string between the character which is the same as the preset first character and the character which is the same as the preset second character as a target address of the equipment to be extracted.
Optionally, in the character string between the character identical to the preset first character and the character identical to the preset second character, neither the character identical to the preset first character nor the character identical to the preset second character is included.
Optionally, the determining the serial port number of the application device at the terminal device according to the friendly name includes:
resolving the friendly name to obtain a corresponding resolving result;
and if the analysis result contains a specified character string, determining the specified character string and all characters behind the specified character string as the serial port number of the application equipment at the terminal equipment.
Optionally, after determining the serial port number of the application device at the terminal device according to the friendly name, the method includes:
and storing the serial port number into a configuration file.
The terminal device 7 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 70, a memory 71. Those skilled in the art will appreciate that fig. 7 is only an example of the terminal device 7, and does not constitute a limitation to the terminal device 7, and may include more or less components than those shown, or combine some components, or different components, for example, and may further include input/output devices, network access devices, and the like.
The Processor 70 may be a Central Processing Unit (CPU), and the Processor 70 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 71 may be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7. In other embodiments, the memory 71 may also be an external storage device of the terminal device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 7. Further, the memory 71 may include both an internal storage unit and an external storage device of the terminal device 7. The memory 71 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer programs. The above-mentioned memory 71 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
An embodiment of the present application further provides a terminal device, where the terminal device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, the processor implementing the steps of any of the various method embodiments described above when executing the computer program.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a terminal device, enables the terminal device to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A communication method is applied to a terminal device and comprises the following steps:
acquiring a Bluetooth address of the application equipment successfully paired with the terminal equipment;
searching a corresponding friendly name according to the Bluetooth address of the application equipment;
determining the serial port number of the application equipment in the terminal equipment according to the friendly name;
and communicating with the application equipment according to the serial port number of the application equipment at the terminal equipment.
2. The communication method of claim 1, wherein said looking up the corresponding friendly name based on the bluetooth address of the application device comprises:
determining all device information currently used by the terminal device;
determining target device information in all the device information according to the Bluetooth address of the application device, wherein the target device information is the device information of the application device in the terminal device;
and searching for the friendly name in the target equipment information.
3. The communication method according to claim 2, wherein the determining the target device information among the all-device information according to the bluetooth address of the application device includes:
selecting unselected equipment information from all the equipment information, and if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment, extracting a target address of corresponding equipment from the currently selected equipment information;
if the extracted target address of the equipment is the same as the Bluetooth address of the application equipment, determining the currently selected equipment information as the target equipment information;
and if the currently selected device information does not contain a character string for indicating that the device is a Bluetooth device or the target address is different from the Bluetooth address of the application device, returning to the step of selecting unselected device information from all the device information and the subsequent steps until the target device information is determined.
4. The communication method according to claim 3, wherein the extracting the target address of the corresponding device from the currently selected device information comprises:
searching for a character which is the same as a preset first character from the currently selected device information, and searching for a character which is the same as a preset second character;
and taking a character string between the character which is the same as the preset first character and the character which is the same as the preset second character as a target address of the equipment to be extracted.
5. The communication method according to claim 4, wherein the character string between the character identical to the preset first character and the character identical to the preset second character does not contain the character identical to the preset first character nor the character identical to the preset second character.
6. The communication method according to any one of claims 1 to 5, wherein the determining the serial number of the application device at the terminal device according to the friendly name comprises:
resolving the friendly name to obtain a corresponding resolving result;
and if the analysis result contains the specified character string, determining the specified character string and all characters behind the specified character string as the serial port number of the application equipment at the terminal equipment.
7. The communication method according to any one of claims 1 to 5, wherein after determining the serial number of the application device at the terminal device according to the friendly name, the method comprises:
and saving the serial port number into a configuration file.
8. A communication device, applied to a terminal device, includes:
the Bluetooth address acquisition module is used for acquiring the Bluetooth address of the application equipment successfully paired with the terminal equipment;
the friendly name searching module is used for searching a corresponding friendly name according to the Bluetooth address of the application equipment;
the serial port number determining module is used for determining the serial port number of the application equipment in the terminal equipment according to the friendly name;
and the communication module is used for communicating with the application equipment according to the serial port number of the application equipment at the terminal equipment.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN202111214249.9A 2021-10-19 2021-10-19 Communication method, device and terminal equipment Active CN113965917B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111214249.9A CN113965917B (en) 2021-10-19 2021-10-19 Communication method, device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111214249.9A CN113965917B (en) 2021-10-19 2021-10-19 Communication method, device and terminal equipment

Publications (2)

Publication Number Publication Date
CN113965917A true CN113965917A (en) 2022-01-21
CN113965917B CN113965917B (en) 2024-04-02

Family

ID=79465116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111214249.9A Active CN113965917B (en) 2021-10-19 2021-10-19 Communication method, device and terminal equipment

Country Status (1)

Country Link
CN (1) CN113965917B (en)

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030165129A1 (en) * 2002-03-01 2003-09-04 Microsoft Corporation Method to obtain friendly names for bluetooth devices
US20030228844A1 (en) * 2002-06-11 2003-12-11 Alcatel Alternative to bluetooth cordless telephony profile
US20070155324A1 (en) * 2005-12-30 2007-07-05 Reo Lee Bluetooth communication through a single virtual port
CN101232682A (en) * 2008-01-21 2008-07-30 中兴通讯股份有限公司 Method for multiplexing serial port of number terminal
CN102394942A (en) * 2011-08-08 2012-03-28 北京登合科技有限公司 Method for automatically installing bluetooth serial port equipment
CN104811359A (en) * 2015-04-10 2015-07-29 深圳市元征科技股份有限公司 Serial port communication method and terminal
CN106162509A (en) * 2015-04-08 2016-11-23 张彤 A kind of information broadcast method setting bluetooth equipment name with a plurality of information content poll
WO2017101247A1 (en) * 2015-12-18 2017-06-22 广州广电运通金融电子股份有限公司 Self-service equipment hardware management method and device
CN107613453A (en) * 2017-09-15 2018-01-19 湖南恒茂高科股份有限公司 Control method and communication system
CN107786968A (en) * 2017-09-20 2018-03-09 陕西法士特齿轮有限责任公司 A kind of reliable communicating method between PC bluetooth modules and outside bluetooth
CN107980233A (en) * 2017-03-06 2018-05-01 深圳大趋智能科技有限公司 Automatic test approach, the apparatus and system of Bluetooth POS terminal
KR20190071482A (en) * 2017-12-14 2019-06-24 주식회사 빅솔론 Method for bluetooth pairing, and host apparatus performing the same
WO2019127476A1 (en) * 2017-12-29 2019-07-04 深圳前海达闼云端智能科技有限公司 Virtual system bluetooth communication method and device, virtual system, storage medium, and electronic apparatus
CN110244983A (en) * 2019-05-30 2019-09-17 百富计算机技术(深圳)有限公司 Method, terminal device and the storage medium of fixed serial port
CN111045737A (en) * 2019-11-29 2020-04-21 惠州Tcl移动通信有限公司 Equipment identifier acquisition method and device, terminal equipment and storage medium

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030165129A1 (en) * 2002-03-01 2003-09-04 Microsoft Corporation Method to obtain friendly names for bluetooth devices
US20030228844A1 (en) * 2002-06-11 2003-12-11 Alcatel Alternative to bluetooth cordless telephony profile
US20070155324A1 (en) * 2005-12-30 2007-07-05 Reo Lee Bluetooth communication through a single virtual port
CN101232682A (en) * 2008-01-21 2008-07-30 中兴通讯股份有限公司 Method for multiplexing serial port of number terminal
CN102394942A (en) * 2011-08-08 2012-03-28 北京登合科技有限公司 Method for automatically installing bluetooth serial port equipment
CN106162509A (en) * 2015-04-08 2016-11-23 张彤 A kind of information broadcast method setting bluetooth equipment name with a plurality of information content poll
CN104811359A (en) * 2015-04-10 2015-07-29 深圳市元征科技股份有限公司 Serial port communication method and terminal
WO2017101247A1 (en) * 2015-12-18 2017-06-22 广州广电运通金融电子股份有限公司 Self-service equipment hardware management method and device
CN107980233A (en) * 2017-03-06 2018-05-01 深圳大趋智能科技有限公司 Automatic test approach, the apparatus and system of Bluetooth POS terminal
CN107613453A (en) * 2017-09-15 2018-01-19 湖南恒茂高科股份有限公司 Control method and communication system
CN107786968A (en) * 2017-09-20 2018-03-09 陕西法士特齿轮有限责任公司 A kind of reliable communicating method between PC bluetooth modules and outside bluetooth
KR20190071482A (en) * 2017-12-14 2019-06-24 주식회사 빅솔론 Method for bluetooth pairing, and host apparatus performing the same
WO2019127476A1 (en) * 2017-12-29 2019-07-04 深圳前海达闼云端智能科技有限公司 Virtual system bluetooth communication method and device, virtual system, storage medium, and electronic apparatus
CN110244983A (en) * 2019-05-30 2019-09-17 百富计算机技术(深圳)有限公司 Method, terminal device and the storage medium of fixed serial port
CN111045737A (en) * 2019-11-29 2020-04-21 惠州Tcl移动通信有限公司 Equipment identifier acquisition method and device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN113965917B (en) 2024-04-02

Similar Documents

Publication Publication Date Title
US20040025089A1 (en) Enhanced VPD (Vital Product Data) structure
CN109814524B (en) Vehicle diagnosis method, device and system
CN111414374B (en) Block chain transaction concurrent processing method, device and equipment
CN112631657B (en) Byte comparison method for character string processing and instruction processing device
CN110597523A (en) Board card firmware burning method, device and system, board card and terminal equipment
CN113961919B (en) Malicious software detection method and device
CN111708353A (en) Data display method and system for vehicle diagnosis equipment and related equipment
CN112558584B (en) Diagnostic data acquisition method and device and diagnostic equipment
WO2021135603A1 (en) Intention recognition method, server and storage medium
CN112100092B (en) Information caching method, device, equipment and medium
CN111693294A (en) Vehicle detection method and device, terminal equipment and storage medium
CN109656592B (en) Card management method, device, terminal and computer readable storage medium
CN113835729A (en) Upgrading method and device, terminal equipment and computer readable storage medium
CN112783971A (en) Transaction recording method, transaction query method, electronic device and storage medium
CN111046393B (en) Vulnerability information uploading method and device, terminal equipment and storage medium
CN111143092B (en) Fault recording data processing method, system and terminal equipment
CN113886302A (en) Serial port number obtaining method and device of application equipment, terminal equipment and storage medium
US8645404B2 (en) Memory pattern searching via displaced-read memory addressing
CN112181479A (en) Method and device for determining difference between code file versions and electronic equipment
CN109783718B (en) Repeat request judgment method and device
CN113965917A (en) Communication method, device and terminal equipment
CN115840618A (en) Access method and device for virtual machine simulation equipment register in hypervisor
US6792610B2 (en) Attaching a device driver to multiple logical devices of one physical device
CN114697440B (en) Network management method and mobile terminal
CN113760237A (en) Compiling address updating method and device, terminal equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant