CN113965917B - Communication method, device and terminal equipment - Google Patents
Communication method, device and terminal equipment Download PDFInfo
- Publication number
- CN113965917B CN113965917B CN202111214249.9A CN202111214249A CN113965917B CN 113965917 B CN113965917 B CN 113965917B CN 202111214249 A CN202111214249 A CN 202111214249A CN 113965917 B CN113965917 B CN 113965917B
- Authority
- CN
- China
- Prior art keywords
- equipment
- application
- character
- information
- serial number
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 61
- 238000004891 communication Methods 0.000 title claims abstract description 45
- 238000004590 computer program Methods 0.000 claims description 21
- 238000003745 diagnosis Methods 0.000 abstract 1
- 230000006870 function Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 238000006243 chemical reaction Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000002035 prolonged effect Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W8/00—Network data management
- H04W8/26—Network addressing or numbering for mobility support
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Telephone Function (AREA)
- Mobile Radio Communication Systems (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 after successful pairing with the terminal equipment; searching a corresponding friendly name according to the Bluetooth address of the application equipment; determining a serial number of the application equipment at the terminal equipment according to the friendly name; and communicating with the application equipment according to the serial number of the application equipment at the terminal equipment. By the method, the serial number of the application equipment in the terminal equipment can be accurately determined.
Description
Technical Field
The present application belongs to the field of communication technologies, and in particular, relates to a communication method, a device, a terminal device, and a computer readable storage medium.
Background
At present, most of terminal devices and application devices of vehicles use a bluetooth to serial port mode to realize bluetooth communication, and before the bluetooth communication is realized, it is required to determine what serial port number to be converted.
The existing method comprises the steps that a terminal device firstly obtains the current effective serial number of the terminal device by using a registry, then carries out pairing of application devices of a Bluetooth conversion serial port, then obtains the current new effective serial number of the terminal device, compares the two obtained effective serial numbers to obtain a new added serial number, and judges that the new added serial number is the serial number to be converted by the vehicle application device.
However, by the method, the serial number to be transferred by the application device may not be accurately determined.
Disclosure of Invention
The embodiment of the application provides a communication method, a communication device and terminal equipment, which can improve the accuracy of the obtained serial numbers of the application equipment.
In a first aspect, an embodiment of the present application provides a communication method, which is applied to a terminal device, including:
acquiring a Bluetooth address of the application equipment after successful pairing with the terminal equipment;
searching a corresponding friendly name according to the Bluetooth address of the application equipment;
determining a serial number of the application equipment at the terminal equipment according to the friendly name;
and communicating with the application equipment according to the serial 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 equipment information currently used by the terminal equipment;
determining target equipment information in all the equipment information according to the Bluetooth address of the application equipment, wherein the target equipment information is the equipment information of the application equipment in the terminal equipment;
and searching friendly names in the target equipment information.
Optionally, the determining the target device information in the all device information according to the bluetooth address of the application device includes:
selecting one piece of unselected equipment information from all pieces of equipment information, and extracting a target address of a corresponding equipment from the currently selected equipment information if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment;
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 target equipment information;
and if the currently selected device information does not contain a character string for indicating that the device is Bluetooth device or the target address is different from the Bluetooth address of the application device, returning to the step of selecting one piece of unselected device information from all pieces of device information and the subsequent step until the target device information is determined.
Optionally, the extracting the target address of the corresponding device from the currently selected device information includes:
searching for the character identical to the preset first character from the currently selected equipment information, and searching for the character identical to the preset second character;
and taking the character string between the character identical to the preset first character and the character identical to the preset second character as a target address of the equipment to be extracted.
Optionally, 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 or the character identical to the preset second character.
Optionally, the determining the serial number of the application device at the terminal device according to the friendly name includes:
analyzing the friendly names to obtain corresponding analysis results;
and if the analysis result contains the appointed character string, determining the appointed character string and all characters after the appointed character string as the serial number of the application equipment at the terminal equipment.
Optionally, after the determining, according to the friendly name, a serial number of the application device at the terminal device, the method includes:
and saving the serial 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, including:
the Bluetooth address acquisition module is used for acquiring the Bluetooth address of the application equipment after the terminal equipment is successfully paired;
the friendly name searching module is used for searching the corresponding friendly name according to the Bluetooth address of the application equipment;
a serial number determining module, configured to determine a serial number of the application device at the terminal device according to the friendly name;
and the communication module is used for communicating with the application equipment according to the serial 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, embodiments of the present application provide a computer-readable storage medium storing a computer program which, when executed by a processor, implements a method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product for causing a terminal device to perform the method of the first aspect described above when the computer program product is run on the terminal device.
Compared with the prior art, the embodiment of the application has the beneficial effects that:
in this embodiment of the present application, since the friendly names respectively correspond to the bluetooth address and the serial number of the application device, the serial number determined according to the above method is the serial number corresponding to the bluetooth address of the application device, and not the serial numbers corresponding to other application devices. That is, by the method, the serial number of the application device at the terminal device can be accurately determined, so that the terminal device can successfully carry out Bluetooth communication with the application device through the determined serial number. Meanwhile, the friendly name is searched only through the Bluetooth address of the application device, and each address in the two effective serial port lists is not required to be matched, so that the speed of determining the serial port number can be improved, and the starting time of diagnostic application software installed in the terminal device is prolonged.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flow chart of a communication method according to an embodiment of the present application;
FIG. 2 is a flow chart of another communication method provided in 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 schematic diagram of a first character and a second character according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a friendly name resolution result according to 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 configurations, 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 should 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 any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Furthermore, the terms first, second and the like in the description and in the claims, are used for distinguishing between the descriptions and not necessarily for indicating or implying relative importance.
Reference in the 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 application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise.
Embodiment one:
currently, the bluetooth serial number of an application device is generally determined by acquiring a valid serial list before and after bluetooth pairing of the terminal device. However, when the serial port is not normally closed, the serial port number corresponding to the serial port still exists in the effective 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 conversion serial port is difficult to accurately determine by comparing with the serial port numbers in the effective serial port list before and after bluetooth pairing.
In order to solve the above technical problems, embodiments of the present application provide a communication method, which is applied to a terminal device, such as a PC (personal computer). In the method, after terminal equipment and application equipment are successfully paired, a Bluetooth address of the application equipment is obtained, a corresponding friendly name is obtained according to the Bluetooth address of the application equipment, a corresponding serial number is determined according to the friendly name, and finally communication is carried out with the application equipment according to the determined serial number. The friendly names respectively correspond to the Bluetooth address and the serial port number of the application equipment, so that the serial port number determined according to the method is the serial port number corresponding to the Bluetooth address of the application equipment, namely, the serial port number of the application equipment at the terminal equipment can be accurately determined through the method, and the terminal equipment can successfully carry out Bluetooth communication with the application equipment through the determined serial port number.
The following describes a communication method provided in the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 shows a flowchart of a communication method provided in an embodiment of the present application, where the communication method is applied to a terminal device, and the terminal device may be a PC, and is described in detail as follows:
step S11, the Bluetooth address of the application device after successful pairing with the terminal device is obtained.
In this embodiment, the PC may obtain the bluetooth address of the application device after successful pairing with the application device by using the bluetooth name of the application device.
In some embodiments, the PC may obtain the Bluetooth ADDRESS (Bluetooth Address, BT_ADDRESS) of the application device via a Microsoft Bluetooth device type communication interface.
Step S12, searching the corresponding friendly name according to the Bluetooth address of the application device. The friendly name is one of the device information of the application device on the PC, which contains a lot of hardware information of the application device.
In this embodiment, the friendly name of the application device is acquired by setting the parameter of the microsoft PC driver function to a specified value. The parameters of the driving function, i.e., setupdigeteviceregistyperferty, are set to spdrp_ FRIENDLYNAME to obtain the parameters.
And step S13, determining the serial number of the application equipment at the terminal equipment according to the friendly name.
In this embodiment, the corresponding serial number is resolved by resolving the value of the friendly name.
And step S14, communicating with the application equipment according to the serial number of the application equipment at the terminal equipment.
In this embodiment, the PC performs bluetooth communication with the application device according to the determined serial number.
In this embodiment of the present application, since the friendly names respectively correspond to the bluetooth address and the serial number of the application device, the serial number determined according to the above method is the serial number corresponding to the bluetooth address of the application device, and not the serial numbers corresponding to other application devices. That is, by the method, the serial number of the application device at the terminal device can be accurately determined, so that the terminal device can successfully carry out Bluetooth communication with the application device through the determined serial number. Meanwhile, the friendly name is searched only through the Bluetooth address of the application device, and each address in the two effective serial port lists is not required to be matched, so that the speed of determining the serial port number can be improved, and the starting time of diagnostic application software installed in the terminal device is prolonged.
Embodiment two:
fig. 2 shows a flow chart of another communication method provided in the embodiment of the present application, in this embodiment, the step S12 is mainly refined, and the step S21, the step S25, and the step S26 are the same as the step S11, the step S13, and the step S14, respectively, which are not described herein again.
Step S21, the Bluetooth address of the application device after successful pairing with the terminal device is obtained.
Step S22, all the equipment information currently used by the terminal equipment is determined.
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 (Small Computer System Interface, SCSI), universal serial bus (Universal Serial Bus, USB), bluetooth, etc.
In some embodiments, a device information block list of the current PC may be created using a microsoft PC driver function (e.g., setupdyeateddeviceinfolist), and the requested device information may be added to the created device information block list using a microsoft PC driver function (e.g., setupdygetclassdevex) such that the device information block list contains device information for all devices in use in the current PC.
And step S23, determining target equipment information in all the equipment information according to the Bluetooth address of the application equipment, wherein the target equipment information is the equipment information of the application equipment in the terminal equipment.
In this embodiment, if one of the device information includes the bluetooth address of the application device, it is indicated that the device information is the device information of the application device in the PC, that is, the target device information.
Step S24, searching friendly names in the target equipment information.
In this embodiment, the friendly name in the target device information is acquired by setting the parameter of the microsoft PC driver function to a specified value.
And S25, determining the serial number of the application equipment at the terminal equipment according to the friendly name.
And step S26, communicating with the application equipment according to the serial number of the application equipment at the terminal equipment.
In the embodiment of the present invention, since 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, the terminal device can determine that the device information of the application device is 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, thereby ensuring that the friendly name corresponding to the bluetooth address of the application device can be found later.
In some embodiments, the step S23 includes:
a1, selecting one piece of unselected device information from all pieces of device information, and extracting a target address of a corresponding device from the currently selected device information if the currently selected device information contains a character string for indicating that the device is a Bluetooth device.
Wherein a string of "BTHENUM" may be employed to indicate whether a device is a bluetooth device.
In this embodiment, the device information may be arranged first, then the device information may be selected one by one according to the sequence from front to 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 sequence from back to front, so long as the selected device information is guaranteed to be not selected.
A2, if the extracted target address of the device is the same as the Bluetooth address of the application device, determining the currently selected device information as 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 different from the Bluetooth address of the application device, returning to the step of selecting one piece of unselected device information from all pieces of device information and the subsequent step until the target device information is determined, or until all pieces of device information are selected.
In the above-mentioned A1 to A3, the above-mentioned device information may be a value of a device instance path, at this time, a microsoft PC driving function (e.g. setupdigeteviceinstanceid) may be used to obtain the value of the device instance path, and determine whether the value of the "device instance path" includes a string "BTHENUM", if so, it indicates that the device is a bluetooth device; otherwise, the device is not a Bluetooth device, and the step A1 is returned. For example: assuming that "BTHENUM" indicates that the corresponding device is a bluetooth device, as shown in fig. 3, if the obtained value of the device instance path is "bthenum\ {00001101-0000-1000-8000-00805F9B34FB } _ LOCALMFG &000 a/7 &1F 3874212 &0& aabbcc112233_c00000000", it indicates that the device corresponding to the obtained value of the device instance path is a bluetooth device.
In the above-mentioned A1 to A3, since the serial number of the bluetooth conversion port of the application device at the terminal device needs to be obtained, the address of the bluetooth device is extracted after judging that one device is the bluetooth device, so that the extraction of the address of the non-bluetooth device can be avoided, and the speed of determining the target address can be improved.
In some embodiments, extracting the target address of the corresponding device from the currently selected device information in the step A1 includes:
a11, searching the character which is the same as the preset first character from the currently selected equipment information, and searching the character which is the same as the preset second character.
Wherein 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-0000-1000-8000-00805F9B34FB } _ local g &000a \7&1F 3874212 &0& AABBCC112233_c00000000, where AABBCC112233 is a string between "&" and "_", indicating a bluetooth address.
A12, taking the character string between the character identical to the preset first character and the character identical to 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 preset, and a character string corresponding to a target address of the device is between the first character and the second character. Thus, 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 identical to the preset first character and the character identical to the preset second character, so that the target address of the required equipment can be extracted quickly and accurately. In some embodiments, the character string between the same character as the preset first character and the same character as the preset second character does not include the same character as the preset first character or the same character as the preset second character.
In this embodiment, considering that there may be a plurality of first characters and/or a plurality of second characters in the value of the device information, only character strings between two adjacent first characters and second characters are extracted, so that the accuracy of the target address of the extracted device can be further ensured. Referring to fig. 4, only the character string between the marked "&" and the marked "_" is extracted as the target address of the device.
In some embodiments, the step S25 (or step S13) includes:
b1, analyzing the friendly names to obtain corresponding analysis results.
And B2, if the analysis result contains a designated character string, determining the designated character string and all characters after the designated character string as the serial number of the application equipment at the terminal equipment.
The specified character string may be a character string including COM.
In this embodiment, whether the analysis result contains a COM string is queried, and the COMXX string is obtained. Referring to fig. 5, assuming that the resolution result of the friendly name is "standard serial on bluetooth link (COM 3)", since the above resolution result contains COM character strings, the COM and all characters "3" following the COM are taken as the serial numbers of the application devices at the above terminal devices.
In some embodiments, if the parsing result does not include the COM string, the process returns to step A1 to continue checking the next device.
In some embodiments, after the step S25 (or step S13), the method includes:
and saving the serial number into a configuration file.
In this embodiment, since 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 number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic of each process, and should not limit the implementation process of the embodiment of the present application in any way.
Embodiment III:
corresponding to the communication methods described in the first and second embodiments, fig. 6 shows a block diagram of the communication device provided in the embodiment of the present application, and for convenience of explanation, only the portion related to the embodiment of the present application is shown.
Referring to fig. 6, the communication apparatus 6 is applied to a terminal device, and includes:
the bluetooth address obtaining module 61 is configured to obtain a bluetooth address of the application device after the application device is successfully paired with the terminal device.
The friendly name searching module 62 is configured to search for a corresponding friendly name according to the bluetooth address of the application device.
A serial number determining module 63, configured to determine a serial number of the application device at the terminal device according to the friendly name.
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 this embodiment of the present application, since the friendly names respectively correspond to the bluetooth address and the serial number of the application device, the serial number determined according to the above method is the serial number corresponding to the bluetooth address of the application device, and not the serial numbers corresponding to other application devices. That is, by the method, the serial number of the application device at the terminal device can be accurately determined, so that the terminal device can successfully carry out Bluetooth communication with the application device through the determined serial number. Meanwhile, the friendly name is searched only through the Bluetooth address of the application device, and each address in the two effective serial port lists is not required to be matched, so that the speed of determining the serial port number can be improved, and the starting time of diagnostic application software installed in the terminal device 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 the target address determining unit is used for determining target equipment information in all the equipment information according to the Bluetooth address of the application equipment, wherein the target equipment information is equipment information of the application equipment in the terminal equipment.
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 one piece of unselected equipment information from all pieces of equipment information, and extracting a target address of a corresponding equipment from the piece of currently selected equipment information if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment;
if the extracted target address of the device is the same as the Bluetooth address of the application device, determining the currently selected device information as target device information;
if the currently selected device information does not include a 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 one unselected device information from all device information and the subsequent steps until the target device information is determined, or until all device information is selected.
In some embodiments, the extracting the target address of the corresponding device from the currently selected device information includes:
searching the character identical to the preset first character from the currently selected equipment information, and searching the character identical to the preset second character;
and taking the character string between the character identical to the preset first character and the character identical to the preset second character as a target address of the equipment to be extracted.
In some embodiments, the character string between the same character as the preset first character and the same character as the preset second character does not include the same character as the preset first character or the same character as the preset second character.
In some embodiments, the serial number determining module includes:
and the friendly name analysis unit is used for analyzing the friendly names to obtain corresponding analysis results.
And a specified character string identification unit configured to determine the specified character string and all characters following the specified character string as a string number of the application device at the terminal device if the analysis result includes the specified character string.
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, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein again.
Embodiment 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 processor 70 implementing the steps in any of the various method embodiments described above when executing the computer program 72;
acquiring a Bluetooth address of the application equipment after successful pairing with the terminal equipment;
searching a corresponding friendly name according to the Bluetooth address of the application equipment;
determining a serial number of the application device at the terminal device according to the friendly name;
and communicating with the application device according to the serial number of the application device at the terminal device.
Optionally, the searching for the corresponding friendly name according to the bluetooth address of the application device includes:
determining all equipment information currently used by the terminal equipment;
determining target equipment information in all the equipment information according to the Bluetooth address of the application equipment, wherein the target equipment information is the equipment information of the application equipment in the terminal equipment;
and searching friendly names in the target equipment information.
Optionally, the determining the target device information in the all device information according to the bluetooth address of the application device includes:
selecting one piece of unselected equipment information from all pieces of equipment information, and extracting a target address of a corresponding equipment from the piece of currently selected equipment information if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment;
if the extracted target address of the device is the same as the Bluetooth address of the application device, determining the currently selected device information as target device information;
if the currently selected device information does not include a string for indicating that the device is a bluetooth device, or the target address is different from the bluetooth address of the application device, the step of selecting one unselected device information from all device information and the subsequent steps are returned until the target device information is determined.
Optionally, the extracting the target address of the corresponding device from the currently selected device information includes:
searching the character identical to the preset first character from the currently selected equipment information, and searching the character identical to the preset second character;
and taking the character string between the character identical to the preset first character and the character identical to the preset second character as a target address of the equipment to be extracted.
Optionally, the character string between the same character as the preset first character and the same character as the preset second character does not include the same character as the preset first character or the same character as the preset second character.
Optionally, the determining the serial number of the application device at the terminal device according to the friendly name includes:
analyzing the friendly names to obtain corresponding analysis results;
and if the analysis result contains a designated character string, determining the designated character string and all characters after the designated character string as the serial number of the application device at the terminal device.
Optionally, after determining the serial number of the application device on the terminal device according to the friendly name, the method includes:
and saving the serial number into a configuration file.
The terminal device 7 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The terminal device may include, but is not limited to, a processor 70, a memory 71. It will be appreciated by those skilled in the art that fig. 7 is merely an example of the terminal device 7 and is not limiting of the terminal device 7, and may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The processor 70 may be a central processing unit (Central Processing Unit, CPU) and the processor 70 may be any other general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may in some embodiments be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7. The memory 71 may also be an external storage device of the terminal device 7 in other embodiments, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device 7. Further, the memory 71 may include both the internal storage unit and the external storage device of the terminal device 7. The memory 71 is used for storing an operating system, an application program, a boot loader (BootLoader), data, other programs, and the like, such as program codes of the computer programs. The above-described 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-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a 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 process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
The embodiment of the application also provides a terminal device, which comprises: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, which when executed by the processor performs the steps of any of the various method embodiments described above.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps that may implement the various method embodiments described above.
The present embodiments provide a computer program product which, when run on a terminal device, causes the terminal device to perform steps that enable the respective method embodiments described above to be implemented.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, 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 device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
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 solution. 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 manners. For example, the apparatus/network device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown 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 may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.
Claims (10)
1. A communication method, applied to a terminal device, comprising:
acquiring a Bluetooth address of the application equipment after successful pairing with the terminal equipment;
searching a corresponding friendly name according to the Bluetooth address of the application device, wherein the friendly name is one of device information of the application device on the terminal device, and the friendly name contains hardware information of the application device;
determining a serial number of the application equipment at the terminal equipment according to the friendly name;
and communicating with the application equipment according to the serial number of the application equipment at the terminal equipment.
2. The communication method according to claim 1, wherein the searching for the corresponding friendly name according to the bluetooth address of the application device comprises:
determining all equipment information currently used by the terminal equipment;
determining target equipment information in all the equipment information according to the Bluetooth address of the application equipment, wherein the target equipment information is the equipment information of the application equipment in the terminal equipment;
and searching friendly names 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 one piece of unselected equipment information from all pieces of equipment information, and extracting a target address of a corresponding equipment from the currently selected equipment information if the currently selected equipment information contains a character string for indicating that the equipment is Bluetooth equipment;
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 target equipment information;
and if the currently selected device information does not contain a character string for indicating that the device is Bluetooth device or the target address is different from the Bluetooth address of the application device, returning to the step of selecting one piece of unselected device information from all pieces of device information and the subsequent step until the target device information is determined.
4. The communication method as claimed in claim 3, wherein said extracting the target address of the corresponding device from the currently selected device information comprises:
searching for the character identical to the preset first character from the currently selected equipment information, and searching for the character identical to the preset second character;
and taking the character string between the character identical to the preset first character and the character identical to 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 same character as the preset first character and the same character as the preset second character does not contain the same character as the preset first character nor the same character as 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 includes:
analyzing the friendly names to obtain corresponding analysis results;
and if the analysis result contains the appointed character string, determining the appointed character string and all characters after the appointed character string as the serial number of the application equipment at the terminal equipment.
7. The communication method according to any one of claims 1 to 5, characterized by, after said determining the serial number of the application device at the terminal device according to the friendly name, comprising:
and saving the serial number into a configuration file.
8. A communication apparatus, characterized by being applied to a terminal device, comprising:
the Bluetooth address acquisition module is used for acquiring the Bluetooth address of the application equipment after the terminal equipment is successfully paired;
the friendly name searching module is used for searching a corresponding friendly name according to the Bluetooth address of the application device, wherein the friendly name is one of device information of the application device on the terminal device, and the friendly name comprises hardware information of the application device;
a serial number determining module, configured to determine a serial number of the application device at the terminal device according to the friendly name;
and the communication module is used for communicating with the application equipment according to the serial 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 storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 7.
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 CN113965917A (en) | 2022-01-21 |
CN113965917B true 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 (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
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 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7110382B2 (en) * | 2002-03-01 | 2006-09-19 | Microsoft Corporation | Method to obtain friendly names for Bluetooth devices |
EP1372329A1 (en) * | 2002-06-11 | 2003-12-17 | Alcatel | Cordless telephony profile |
US7570917B2 (en) * | 2005-12-30 | 2009-08-04 | Psion Teklogix Inc. | Bluetooth communication through a single virtual port |
CN107786968A (en) * | 2017-09-20 | 2018-03-09 | 陕西法士特齿轮有限责任公司 | A kind of reliable communicating method between PC bluetooth modules and outside bluetooth |
-
2021
- 2021-10-19 CN CN202111214249.9A patent/CN113965917B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
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 |
---|---|
CN113965917A (en) | 2022-01-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9348784B2 (en) | Systems and methods for managing endian mode of a device | |
US20040025089A1 (en) | Enhanced VPD (Vital Product Data) structure | |
CN113127338A (en) | Firmware testing method, server and computer readable storage medium | |
CN109814524B (en) | Vehicle diagnosis method, device and system | |
CN113703868B (en) | Vehicle diagnosis software configuration method, electronic device and readable storage medium | |
CN111414374B (en) | Block chain transaction concurrent processing method, device and equipment | |
CN112558584B (en) | Diagnostic data acquisition method and device and diagnostic equipment | |
US20230315213A1 (en) | Program download method for intelligent terminal and intelligent terminal | |
CN113835729B (en) | Upgrading method, upgrading device, terminal equipment and computer readable storage medium | |
CN113965917B (en) | Communication method, device and terminal equipment | |
CN112199272B (en) | Intelligent terminal testing method and device, terminal equipment and medium | |
CN112783971A (en) | Transaction recording method, transaction query method, electronic device and storage medium | |
CN113886302A (en) | Serial port number obtaining method and device of application equipment, terminal equipment and storage medium | |
CN112559482A (en) | Binary data classification processing method and system based on distribution | |
CN111258628B (en) | Rule file comparison method and device, readable storage medium and terminal equipment | |
CN113342430B (en) | Fault code processing method and device, terminal equipment and readable storage medium | |
CN117667228A (en) | Method, system, computer equipment and storage medium for calibrating chip parameters | |
CN115840618A (en) | Access method and device for virtual machine simulation equipment register in hypervisor | |
CN112434195A (en) | Data analysis method and device, electronic equipment and computer readable storage medium | |
CN111813474A (en) | Multi-language display method and device and electronic equipment | |
CN111181948B (en) | Method and device for driving existing functions by non-standard message | |
CN113568349B (en) | Data processing method, device, terminal equipment and readable storage medium | |
CN117687704B (en) | Display card initialization method, device, equipment and storage medium | |
CN112015686B (en) | Equipment access port positioning method and equipment access device | |
CN114090840A (en) | Sequence searching method, device, equipment and 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 |