Device type determination method, device, device and storage medium
By establishing a Bluetooth connection with the second device, obtaining its protocol configuration information and finding the target function support, the problem of inaccurate identification of Device of Class field is solved, and efficient and accurate device type determination is achieved.
Patent Information
- Application Number
- CN202110932468.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-13
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-08-13
AI Technical Summary
In the prior art, when identifying the device type connected to the terminal through the Device of Class field, there is a problem of inaccurate writing, resulting in inaccurate identification of the device type.
By establishing a Bluetooth connection with the second device, obtaining its supported protocol configuration information, and finding the support status of the target function in the information. If supported, it is determined as an on-board device.
This avoids the inaccurate device type identification problem caused by inaccurate writing of Device of Class field, and realizes efficient and accurate device type determination, and does not need to read all protocol lists and instruction types of the second device.
Smart Images

Figure CN113660636B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Bluetooth technology, and in particular to a method, apparatus, device and storage medium for determining a device type. Background Art
[0002] Nowadays, intelligent terminals (referred to as “terminals”) can locate the parking position of a vehicle.
[0003] When the terminal locates the parking position of the vehicle, it is necessary to identify whether the device connected to the terminal is a vehicle-mounted device. In the related art, the terminal can read the device class (Device of Class) defined by the Bluetooth Special Interest Group (Bluetooth SIG) in the inquiry response (Inquiry Response). The Device of Class identifies the device type, and determines whether the device is a vehicle-mounted device through the Device of Class. Summary of the invention
[0004] The embodiment of the present application provides a method, apparatus, device and storage medium for determining a device type. The technical solution is as follows:
[0005] According to one aspect of the present application, a method for determining a device type is provided, which is applied to a first device, and the method includes:
[0006] Establishing a Bluetooth connection with a second device;
[0007] Acquire protocol configuration information of a protocol supported by the second device according to the Bluetooth connection, where the protocol configuration information is used to describe capabilities of the second device;
[0008] In a case where the protocol configuration information indicates that the second device supports the target function, it is determined that the second device is an in-vehicle device; wherein the target function is a function supported only by the in-vehicle device.
[0009] According to another aspect of the present application, a device for determining a device type is provided, the device comprising:
[0010] A connection module, used to establish a Bluetooth connection with a second device;
[0011] An acquisition module, used to acquire protocol configuration information of a protocol supported by the second device according to the Bluetooth connection, where the protocol configuration information is used to describe capabilities of the second device;
[0012] The determination module is used to determine that the second device is a vehicle-mounted device when the protocol configuration information indicates that the second device supports a target function; wherein the target function is a function supported only by the vehicle-mounted device.
[0013] According to another aspect of the present application, a terminal is provided, comprising a processor, a memory connected to the processor, and program instructions stored on the memory, wherein when the processor executes the program instructions, a method for determining a device type as provided in various aspects of the present application is implemented.
[0014] According to another aspect of the present application, a computer-readable storage medium is provided, wherein program instructions are stored in the storage medium, and when the program instructions are executed by a processor, a method for determining a device type as provided in various aspects of the present application is implemented.
[0015] According to another aspect of the present application, a computer program product is provided, the computer program product comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the above-mentioned method for determining the device type.
[0016] The beneficial effects brought by the technical solution provided by the embodiments of the present application may include:
[0017] In the method, a first device establishes a Bluetooth connection with a second device, and obtains functions supported by the second device through protocol configuration information of the second device, so as to determine whether the second device is a vehicle-mounted device through the functions supported by the second device. When the protocol configuration information of the second device indicates that the second device supports the target functions possessed by the vehicle-mounted device, the second device can be determined to be a vehicle-mounted device. This method can avoid the problem of inaccurate writing of the Device of Class field on many vehicle-mounted devices, resulting in inaccurate device types identified through the Device of Class field. This method also does not need to read all protocol lists and instruction types of the second device, and can ultimately determine the device type of the second device efficiently and accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly introduce the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A schematic diagram of a Bluetooth communication system provided by an exemplary embodiment of the present application is shown;
[0020] Figure 2A flow chart showing a method for determining a device type provided by an exemplary embodiment of the present application is shown;
[0021] Figure 3 A flowchart showing a method for determining a device type provided by another exemplary embodiment of the present application is shown;
[0022] Figure 4 A flowchart showing a method for determining a device type provided by another exemplary embodiment of the present application is shown;
[0023] Figure 5 A block diagram showing an apparatus for determining a device type provided by an exemplary embodiment of the present application is shown;
[0024] Figure 6 A block diagram of a computer device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0026] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.
[0027] In the description of the present application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of the present application, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" means two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0028] In order to facilitate the understanding of the scheme shown in the embodiments of the present application, several nouns appearing in the embodiments of the present application are introduced below.
[0029] Bluetooth technology is a wireless connection technology that supports short-range communication between devices. Its essence is to establish a universal radio air interface (Radio Air Interface) for the communication environment between fixed devices or mobile devices, further combining communication technology with computer technology, so that various 3C devices can communicate or operate with each other in a short range without being connected by wires or cables. Simply put, Bluetooth technology is a technology that uses low-power radio to transmit data between various 3C devices. Among them, 3C devices refer to communication products (Communication), computer products (Computer), and consumer electronics products (Consumer).
[0030] Bluetooth technology is widely used in: the automotive field, such as Bluetooth hands-free communication, in-car Bluetooth entertainment systems, Bluetooth vehicle remote condition diagnosis, and car Bluetooth anti-theft technology; industrial production field, such as technicians' wireless monitoring of CNC machine tools, detection of component wear, power output standardization, and Bluetooth monitoring systems' real-time and complete recording of the operating status of CNC systems; medical field, such as the transmission of diagnostic results and ward monitoring.
[0031] In the automotive field, when locating the parked position of a car through a mobile device (including a terminal), it is necessary to identify whether the device connected to the mobile device is a vehicle-mounted device. At this time, the mobile device can read the Device of Class defined by BluetoothSIG in the Inquiry Response, and determine whether the device is a vehicle-mounted device through the Device of Class. However, the vehicle-mounted equipment manufacturers on the market today do not strictly abide by the Bluetooth specification, and the writing of the Device of Class is often inaccurate, so identifying the device type through the Device of Class lacks accuracy in many scenarios. Therefore, this application provides a method for determining the device type. Please refer to the following embodiment for the detailed steps of this method.
[0032] Figure 1 A schematic diagram of a Bluetooth communication system provided by an exemplary embodiment of the present application is shown. The Bluetooth communication system includes a first device 120 and a second device 140. The first device 120 and the second device 140 both have Bluetooth functions.
[0033] Exemplarily, when the Bluetooth function of the first device 120 is turned on and the Bluetooth function of the second device 140 is turned on, the first device 120 searches for Bluetooth devices within the allowed distance range, and displays a list of searched Bluetooth devices on the display of the first device 120, wherein, if the second device 140 is within the allowed distance range, the list includes a selection control for the second device 140, and the selection control includes the device name of the second device 140; the first device 120 receives the selection operation on the selection control of the triggered second device 140, and establishes a Bluetooth connection between the first device 120 and the second device 140.
[0034] Exemplarily, a Bluetooth automatic connection function is set between the first device 120 and the second device 140; when the Bluetooth function of the first device 120 is turned on and the Bluetooth function of the second device 140 is turned on, the first device 120 detects that the second device 140 is within the allowed distance range, and the first device 120 automatically establishes a Bluetooth connection with the second device 140.
[0035] The above-mentioned distance allowance range refers to the distance range within which a Bluetooth connection is allowed to be established between two Bluetooth devices. A Bluetooth connection can be established between two Bluetooth devices within the distance allowance range, and a Bluetooth connection cannot be established between two Bluetooth devices outside the distance allowance range.
[0036] In the embodiment of the present application, the first device 120 supports the operation of the device type determination method provided in the embodiment of the present application to determine the device type of the second device 140. Exemplarily, the first device may include a mobile phone, a tablet computer, a laptop computer, smart glasses, a smart watch, an MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) playback terminal, an MP5 (Moving Picture Experts Group AudioLayer V, Moving Picture Experts Group AudioLayer 5) playback terminal, a virtual reality (Virtual Reality, VR) playback terminal or an augmented reality (Augmented Reality, AR) playback terminal, etc. Exemplarily, the second device may include headphones, speakers, vehicle-mounted equipment, a tablet computer, a mobile phone, a smart TV, a smart phone, etc.
[0037] Exemplarily, an application is installed and running in the first device 120, and the application is an application that supports the positioning function of the vehicle parking position. When the positioning function of the vehicle parking position is used on the first device 120, a Bluetooth connection is established between the first device 120 and the second device 140, and protocol configuration information and input output (IO) configuration information of the protocol supported by the second device 140 are obtained through the Bluetooth connection. Based on the protocol configuration information and the IO configuration information, it is determined whether the second device 140 is a vehicle-mounted device, and if so, the vehicle parking position is located.
[0038] It should be noted that this embodiment is only an exemplary description of the application scenario of the method for determining the device type.
[0039] Figure 2 A flowchart of a method for determining a device type provided by an exemplary embodiment of the present application is shown. The method for determining a device type can be applied to the first device 120 described above. Figure 2 In the method of determining the device type, the following methods are used:
[0040] Step 210: Establish a Bluetooth connection with the second device.
[0041] Exemplarily, when the Bluetooth functions of the first device and the second device are both turned on, the first device receives a search operation for Bluetooth devices triggered by the input device, and searches for a second device within an allowed distance range; receives a connection operation with the second device triggered by the input device, such as a click operation, a double-click operation, or a sliding operation on a selection control corresponding to the second device, to establish a Bluetooth connection between the first device and the second device.
[0042] Exemplarily, when the Bluetooth functions of the first device and the second device are both turned on and an automatic connection function is set between the first device and the second device, the first device automatically searches for the second device within the allowed distance range and automatically establishes a Bluetooth connection with the second device.
[0043] Exemplarily, when the Bluetooth function of the first device is not turned on, first, the first device receives a Bluetooth turning-on operation on the input device to turn on the Bluetooth function of the first device. Exemplarily, the input device includes at least one of a touch screen and a physical button.
[0044] Step 220: Acquire protocol configuration information of a protocol supported by the second device according to the Bluetooth connection.
[0045] In the process of determining the device type, the first device communicates with the second device via a Bluetooth connection and obtains protocol configuration information from the second device, where the protocol configuration information is used to describe the capabilities and characteristics of the second device. Exemplarily, the above protocol configuration information can also be referred to as "protocol support capability", which is the capability provided by the protocol supported by the second device. Exemplarily, the first device obtains the configuration information (profile) supported by the second device via a Bluetooth connection.
[0046] Exemplarily, after the first device and the second device establish a Bluetooth connection, the first device and the second device exchange information through transmission frames, and the information interaction is the capability information interaction after the Bluetooth connection is established between the two Bluetooth devices; the first device receives the interaction information sent by the second device through the transmission frame, and the protocol configuration information of the second device exists in the first designated flag bit of the transmission frame; the first device obtains the protocol configuration information of the second device from the first designated flag bit.
[0047] Optionally, the protocol configuration information includes protocol configuration information related to communication between devices; therefore, the first device obtains the protocol configuration information related to communication between devices of the second device. This method can exclude protocol configuration information that is not related to communication between devices, thereby reducing the amount of data that needs to be processed and improving the execution efficiency of the overall solution.
[0048] In some embodiments, the first device sends first specified information to the second device, where the first specified information refers to an inter-device communication message supported by a target function, and the target function is a function supported only by the vehicle-mounted device; the first device receives first feedback information sent by the second device, and the first feedback information is information that the second device feeds back to the first device in response to the first specified information; when the first feedback information is the first specified feedback information, the first device determines that the second device supports the target function, and the first specified feedback information is feedback information that matches the first specified information under the target function.
[0049] For example, under the target function, the target configuration information exists in the second device, and the first device requests the target configuration information from the second device; when the second device returns the target configuration information to the first device, the first device determines that the protocol support capability supports the target function. Exemplarily, the target configuration information may be at least one protocol configuration information of at least one protocol.
[0050] Step 230: When the protocol configuration information indicates that the second device supports the target function, determine that the second device is an in-vehicle device; wherein the target function is a function supported only by the in-vehicle device.
[0051] Optionally, the target function includes at least one of the following:
[0052] Support device information exchange protocol (Message Access Profile, MAP);
[0053] Supports the browsing function in the Audio Video Remote Control Profile (AVRCP).
[0054] Exemplarily, the first device determines whether the protocol configuration information indicates that the second device supports MAP; if the protocol configuration information indicates that the second device supports MAP, it is determined that the second device is a vehicle-mounted device.
[0055] Alternatively, the first device determines whether the protocol configuration information supports the Browsing function in AVRCP; if the protocol configuration information indicates that the second device supports the Browsing function in AVRCP, it is determined that the second device is a vehicle-mounted device.
[0056] It can also be described as: the first device determines whether the second device supports MAP through the protocol configuration information; if the first device determines that the second device supports MAP, it determines that the second device is a vehicle-mounted device;
[0057] Alternatively, the first device determines whether the second device supports the Browsing function in AVRCP through protocol configuration information; if the first device determines that the second device supports the Browsing function in AVRCP, it determines that the second device is a vehicle-mounted device.
[0058] It may also be described as, the first device determines that the protocol support capability of the second device supports MAP, and then determines that the second device supports MAP;
[0059] Alternatively, the first device determines that the protocol support capability of the second device supports the Browsing function in AVRCP, and then determines that the second device is a vehicle-mounted device.
[0060] To summarize, the method for determining the device type provided in this embodiment establishes a Bluetooth connection between a first device and a second device, and then the first device determines the functions supported by the second device through the protocol configuration information of the second device to determine whether the second device is a vehicle-mounted device. Since the target function is a function supported only by the second device, when the protocol configuration information of the second device indicates that the second device supports the target function, the second device can be determined to be a vehicle-mounted device. This method can avoid the problem of inaccurate writing of the Device of Class field on many vehicle-mounted devices, resulting in inaccurate device types identified by the Device of Class field. This method also does not need to read all protocol lists and instruction types of the second device, and can ultimately determine the device type of the second device efficiently and accurately.
[0061] There are also some scenarios where the vehicle-mounted device does not support the target function. In these scenarios, the process of determining the device type can be as follows: Figure 3 As shown, the method for determining the device type can be applied to the first device 120. Figure 3 In the method of determining the device type, the following methods are used:
[0062] Step 310: Establish a Bluetooth connection with a second device.
[0063] When the Bluetooth functions of the first device and the second device are both turned on, the first device then establishes a Bluetooth connection with the second device.
[0064] Step 320: Acquire the protocol configuration information and IO configuration information of the second device according to the Bluetooth connection.
[0065] In the process of determining the device type, the first device communicates with the second device via a Bluetooth connection, and obtains the above-mentioned protocol configuration information and IO configuration information from the second device. Among them, the above-mentioned protocol configuration information refers to the configuration information of the protocol supported by the second device, and the above-mentioned protocol configuration information is used to describe the capabilities and characteristics of the second device; the protocol configuration information can also be called "protocol support capability", and the protocol support capability is the capability provided by the protocol supported by the second device. The above-mentioned IO configuration information is used to describe the functions supported by the IO interface of the second device, and the IO configuration information can also be called IO support capability, and the IO support capability is the IO capability supported by the second device.
[0066] Exemplarily, after the first device and the second device establish a Bluetooth connection, the first device and the second device exchange information through transmission frames, and the information interaction is capability information interaction after the Bluetooth connection is established between the two Bluetooth devices; the first device receives the interaction information sent by the second device through the transmission frame, and the first designated flag bit of the transmission frame is used for the transmission of protocol configuration information of the second device, and the second designated flag bit of the transmission frame is used for the transmission of IO configuration information of the second device; the first device obtains the protocol configuration information of the second device from the first designated flag bit, and obtains the IO configuration information of the second device from the second designated flag bit.
[0067] Alternatively, the first device receives interactive information sent by the second device through a transmission frame, the above-mentioned transmission frame includes a first transmission frame and a second transmission frame, the first designated flag bit of the first transmission frame is used for the transmission of protocol configuration information of the second device, and the second designated flag bit of the second transmission frame is used for the transmission of IO configuration information of the second device; the first device obtains the protocol configuration information of the second device from the first designated flag bit, and obtains the IO configuration information of the second device from the second designated flag bit.
[0068] The above information interaction is an information interaction process after a successful Bluetooth connection as specified by the Bluetooth protocol.
[0069] In some embodiments, the first device sends first specified information to the second device, where the first specified information refers to an inter-device communication message supported by a target function, and the target function is a function supported only by the vehicle-mounted device; the first device receives first feedback information sent by the second device, and the first feedback information is information that the second device feeds back to the first device in response to the first specified information; when the first feedback information is the first specified feedback information, the first device determines that the second device supports the target function, and the first specified feedback information is feedback information that matches the first specified information under the target function.
[0070] In some embodiments, the first device determines whether the second device supports the target function through the protocol configuration information. On the premise that the protocol configuration information indicates that the second device does not support the target function, the first device sends the second specified information to the second device, and the second specified information is used to determine whether the second device supports the screen display function (Display); the first device receives the second feedback information sent by the second device, and the second feedback information is the information fed back to the first device by the second device in response to the second specified information; when the second feedback information is the second specified feedback information, the first device determines that the second device supports the screen display function, and the second feedback information is the feedback information that matches the second specified information when the second device supports the screen display function. Exemplarily, the above-mentioned second specified information may be information related to the IO configuration information, for example, the above-mentioned second specified information may be acquisition information for at least one item of IO configuration information.
[0071] In some embodiments, the first device sends third designated information to the second device, the third designated information refers to the inter-device communication message supported by the Hands Free Profile (HFP); the first device receives third feedback information sent by the second device, the third feedback information is information fed back to the first device by the second device for the third designated information; when the third feedback information is the third designated feedback information, the first device determines that the second device supports HFP, and the third designated feedback information is feedback information that matches the third designated information when the second device supports HFP. Exemplarily, the third designated information may be acquisition information of the protocol configuration information, for example, the third execution information may be acquisition information of the configuration information of HFP.
[0072] It should be noted that, after determining that the second device does not support the target function, the first device may also obtain the IO configuration information from the second device.
[0073] Step 330: When the protocol configuration information indicates that the second device supports the target function, determine that the second device is an in-vehicle device; wherein the target function is a function supported only by the in-vehicle device.
[0074] Optionally, the target function includes at least one of the following:
[0075] Support device information exchange protocol (Message Access Profile, MAP);
[0076] Supports the browsing function in the Audio Video Remote Control Profile (AVRCP).
[0077] Exemplarily, the first device determines whether the second device supports MAP through protocol configuration information; if the first device determines that the second device supports MAP, it determines that the second device is a vehicle-mounted device.
[0078] Alternatively, the first device determines whether the second device supports the Browsing function in AVRCP through the protocol configuration information; if the first device determines that the second device supports the Browsing function in AVRCP, it determines that the second device is a vehicle-mounted device.
[0079] Step 340: Under the premise that the protocol configuration information indicates that the second device does not support the target function, it is determined through the IO configuration information that the second device supports the screen display function, and through the protocol configuration information that the second device supports the handheld hands-free protocol HFP, then it is determined that the second device is a vehicle-mounted device.
[0080] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports the screen display function through the IO configuration information; when the IO configuration information indicates that the second device supports the screen display function, the first device determines whether the second device supports HFP through the protocol configuration information; when the protocol configuration information indicates that the second device supports HFP, it is determined that the second device is a vehicle-mounted device.
[0081] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports HFP through the protocol configuration information; when the protocol configuration information indicates that the second device supports HFP, the first device determines whether the second device supports the screen display function through the IO configuration information; when the IO configuration information indicates that the second device supports the screen display function, it is determined that the second device is a vehicle-mounted device.
[0082] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports the screen display function through the IO configuration information, and determines whether the second device supports HFP through the protocol configuration information; when the IO configuration information indicates that the second device supports the screen display function, and the protocol configuration information indicates that the second device supports HFP, it is determined that the second device is a vehicle-mounted device.
[0083] Step 350: When the protocol configuration information indicates that the second device does not support the target function, it is determined through the IO configuration information that the second device does not support the screen display function, and then it is determined that the second device is not a vehicle-mounted device.
[0084] When the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports the screen display function through the IO configuration information; when the IO configuration information indicates that the second device does not support the screen display function, it is determined that the second device is not a vehicle-mounted device.
[0085] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports HFP through the protocol configuration information; when the protocol configuration information indicates that the second device supports HFP, the first device determines whether the second device supports the screen display function through the IO configuration information; when the IO configuration information indicates that the second device does not support the screen display function, it is determined that the second device is not a vehicle-mounted device.
[0086] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports the screen display function through the IO configuration information, and determines whether the second device supports HFP through the protocol configuration information; when the IO configuration information indicates that the second device does not support the screen display function, and the protocol configuration information indicates that the second device supports or does not support HFP, it is determined that the second device is not a vehicle-mounted device.
[0087] Step 360: When the protocol configuration information indicates that the second device does not support the target function, and when it is determined through the protocol configuration information that the second device does not support HFP, it is determined that the second device is not a vehicle-mounted device.
[0088] When the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports HFP through the protocol configuration information; when the protocol configuration information indicates that the second device does not support HFP, it determines that the second device is not a vehicle-mounted device.
[0089] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports the screen display function through the IO configuration information; when the IO configuration information indicates that the second device supports the screen display function, the first device determines whether the second device supports HFP through the protocol configuration information; when the protocol configuration information indicates that the second device does not support HFP, it is determined that the second device is not a vehicle-mounted device.
[0090] In some embodiments, when the protocol configuration information indicates that the second device does not support the target function, the first device determines whether the second device supports the screen display function through the IO configuration information, and determines whether the second device supports HFP through the protocol configuration information; when the IO configuration information indicates that the second device supports or does not support the screen display function, and the protocol configuration information indicates that the second device does not support HFP, it is determined that the second device is not a vehicle-mounted device.
[0091] To sum up, the method for determining the device type provided in this embodiment is that when the second device does not support the target function, the first device determines whether the second device is a vehicle-mounted device through the protocol support capability coordinated with the IO support capability. This can accurately identify the vehicle-mounted device and avoid misjudging the vehicle-mounted device as a non-vehicle-mounted device because the second device does not support the target function.
[0092] The design idea of the overall solution of the method provided in this application is described as follows: Figure 4 , shows a flow chart of a method for determining a device type provided by an exemplary embodiment of the present application. The method for determining a device type can be applied to the first device 120 described above. Figure 4 In the method of determining the device type, the following methods are used:
[0093] Step 410: Establish a Bluetooth connection with a second device.
[0094] When the Bluetooth functions of the first device and the second device are both turned on, the first device then establishes a Bluetooth connection with the second device.
[0095] Step 420: Acquire the protocol configuration information and IO configuration information of the second device according to the Bluetooth connection.
[0096] After a Bluetooth connection is established between the first device and the second device, the first device and the second device exchange information in accordance with the provisions of the Bluetooth protocol, and the first device receives information sent by the second device through a transmission frame; the first device obtains protocol configuration information from the first designated flag bit, and obtains IO configuration information from the second designated flag bit. Among them, the first designated flag bit is a flag bit used for protocol configuration information transmission, and the first designated flag bit is pre-configured; the second designated flag bit is a flag bit used for IO configuration information transmission, and the second designated flag bit is pre-configured.
[0097] It should be noted that, in the embodiment of the present application, there is no limitation on the order in which the first device acquires the protocol configuration information and the IO configuration information.
[0098] Step 430: Determine whether the second device supports the target function through the protocol configuration information.
[0099] When the protocol configuration information indicates that the second device supports the target function, the first device executes step 460 ; when the protocol configuration information indicates that the second device does not support the target function, the first device executes step 440 .
[0100] Optionally, the target function includes at least one of the Browsing functions in MAP or AVRCP. Exemplarily, the first device determines whether the second device supports the Browsing function in MAP or AVRCP through the protocol configuration information; if the protocol configuration information indicates that the second device supports the Browsing function in MAP or AVRCP, step 460 is performed; if the protocol configuration information indicates that the second device does not support the Browsing function in MAP or AVRCP, step 440 is performed.
[0101] Exemplarily, the first device obtains configuration information of MAP from the first designated flag bit and executes step 460 ; or, the first device obtains configuration information of the Browsing function in AVRCP from the first designated flag bit and executes step 460 .
[0102] By judging the device type based on the target function, most of the vehicle-mounted devices can be efficiently screened out from many types of devices. If the condition that the protocol support capability supports the target function is met, there is no need to perform subsequent judgment steps; if the protocol support capability does not support the target function, then execute step 440 to continue judging the device type.
[0103] Step 440: Determine whether the second device supports the screen display function through the IO configuration information.
[0104] When the IO configuration information indicates that the second device supports the screen display function, the first device executes step 450 ; when the IO configuration information indicates that the second device does not support the screen display function, the first device executes step 470 .
[0105] Exemplarily, the first device obtains configuration information of the screen display function from the second designated flag bit and executes step 450 .
[0106] Since devices such as Bluetooth headsets and Bluetooth speakers rarely have displays, but car-mounted devices must have displays, the input and output stream support features of the second device can be read to exclude many common audio devices.
[0107] Step 450: Determine whether the second device supports HFP through the protocol configuration information.
[0108] If the protocol configuration information indicates that the second device supports HFP, the first device executes step 460 ; if the protocol configuration information indicates that the second device does not support HFP, the first device executes step 470 .
[0109] Exemplarily, the transmission frame includes a third designated flag, and the first device obtains the configuration information of the HFP from the third designated flag, and executes step 460. Exemplarily, the flag where the configuration information of the HFP is located is different from the flag where the configuration information of the target function is located.
[0110] The determination of whether the protocol support capability of the second device supports HFP is mainly used to exclude devices with Bluetooth function such as televisions and tablets that cannot be screened out in step 440 .
[0111] Step 460: Determine whether the second device is a vehicle-mounted device.
[0112] The first device determines that the second device is an in-vehicle device.
[0113] Step 470: Determine that the second device is not a vehicle-mounted device.
[0114] The first device determines that the second device is not an in-vehicle device.
[0115] To summarize, the method for determining the device type provided in this embodiment establishes a Bluetooth connection between a first device and a second device, and then the first device obtains the functions supported by the second device through the protocol configuration information of the second device, so as to determine whether the second device is a vehicle-mounted device through the functions supported by the second device. When the protocol configuration information of the second device indicates that the second device supports the target functions possessed by the vehicle-mounted device, the second device can be determined to be a vehicle-mounted device. This method can avoid the problem of inaccurate writing of the Device of Class field on many vehicle-mounted devices, resulting in inaccurate device types identified by the Device of Class field. This method also does not need to read all protocol lists and instruction types of the second device, and ultimately can efficiently and accurately determine the device type of the second device without increasing the power consumption of the first device.
[0116] When the second device does not support the target function, the first device also determines whether the second device is a vehicle-mounted device through the protocol support capability and the coordinated IO support capability, so as to accurately identify the vehicle-mounted device and avoid misjudging the vehicle-mounted device as a non-vehicle-mounted device because the second device does not support the target function.
[0117] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0118] Figure 5 The structural block diagram of a device type determination device provided by an exemplary embodiment of the present application is shown. The device type determination device can be implemented as all or part of the first device through software, hardware, or a combination of both. The device includes:
[0119] A connection module 510, configured to establish a Bluetooth connection with a second device;
[0120] An acquisition module 520, configured to acquire protocol configuration information of a protocol supported by the second device according to the Bluetooth connection, where the protocol configuration information is used to describe capabilities of the second device;
[0121] The determination module 530 is used to determine that the second device is a vehicle-mounted device when the protocol configuration information indicates that the second device supports a target function; wherein the target function is a function supported only by the vehicle-mounted device.
[0122] In some embodiments, the acquisition module 520 is used to acquire protocol configuration information related to inter-device communication of the second device according to the Bluetooth connection.
[0123] In some embodiments, the target function includes at least one of the following:
[0124] Support device information exchange protocol MAP;
[0125] Supports browsing function in audio and video remote control protocol AVRCP.
[0126] In some embodiments,
[0127] The acquisition module 520 is further used to acquire IO configuration information of the second device according to the Bluetooth connection, where the IO configuration information is used to describe functions supported by the IO interface of the second device;
[0128] The determination module 530 is also used to determine that the second device supports the screen display function through the IO configuration information and supports the handheld hands-free protocol HFP through the protocol configuration information when the protocol configuration information indicates that the second device does not support the target function, and determine that the second device is a vehicle-mounted device.
[0129] In some embodiments,
[0130] The acquisition module 520 is further used to acquire IO configuration information of the second device according to the Bluetooth connection, where the IO configuration information is used to describe functions supported by the IO interface of the second device;
[0131] The determination module 530 is further used to determine, through the IO configuration information, that the second device does not support the screen display function and that the second device is not a vehicle-mounted device when the protocol configuration information indicates that the second device does not support the target function.
[0132] In some embodiments,
[0133] The acquisition module 520 is further used to acquire IO configuration information of the second device according to the Bluetooth connection, where the IO configuration information is used to describe functions supported by the IO interface of the second device;
[0134] The determination module 530 is further configured to determine, through the protocol configuration information, that the second device does not support HFP and that the second device is not a vehicle-mounted device when the protocol configuration information indicates that the second device does not support the target function.
[0135] To summarize, the device type determination apparatus provided in the present embodiment establishes a Bluetooth connection between a first device and a second device, and then the apparatus obtains the functions supported by the second device through the protocol configuration information of the second device, so as to determine whether the second device is a vehicle-mounted device through the functions supported by the second device. When the protocol configuration information of the second device indicates that the second device supports the target functions possessed by the vehicle-mounted device, the second device can be determined to be a vehicle-mounted device, thereby avoiding the problem of inaccurate writing of the Device of Class field on many vehicle-mounted devices, resulting in inaccurate device types identified through the Device of Class field, and there is no need to read all protocol lists and instruction types of the second device. Ultimately, the device type of the second device can be determined efficiently and accurately without increasing the power consumption of the first device.
[0136] When the second device does not support the target function, the device also determines whether the second device is a vehicle-mounted device through the protocol support capability and the coordinated IO support capability, and can accurately identify the vehicle-mounted device to avoid misjudging the vehicle-mounted device as a non-vehicle-mounted device because the second device does not support the target function.
[0137] Figure 6 A schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application is shown. The computer device may be a device that executes the method for determining the device type provided by the present application, and the computer device may be a terminal. Specifically:
[0138] The computer device 600 includes a central processing unit (CPU) 601, a system memory 604 including a random access memory (RAM) 602 and a read only memory (ROM) 603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The computer device 600 also includes a basic input / output system (I / O system) 606 for facilitating information transmission between various components in the computer, and a large-capacity storage device 607 for storing an operating system 613, application programs 614, and other program modules 615.
[0139] The basic input / output system 606 includes a display 608 for displaying information and an input device 609 such as a mouse and a keyboard for user inputting information. The display 608 and the input device 609 are connected to the central processing unit 601 through an input / output controller 610 connected to the system bus 605. The basic input / output system 606 may also include an input / output controller 610 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 610 also provides output to a display screen, a printer, or other types of output devices.
[0140] The mass storage device 607 is connected to the central processing unit 601 through a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer readable media provide non-volatile storage for the computer device 600. That is, the mass storage device 607 may include a computer readable medium (not shown) such as a hard disk or a compact disc read only memory (CD-ROM) drive.
[0141] Computer readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash memory or other solid-state storage technologies, CD-ROM, Digital Versatile Disc (DVD) or Solid State Drive (SSD), other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Among them, random access memory may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM). Of course, those skilled in the art will know that computer storage media are not limited to the above. The above-mentioned system memory 604 and large-capacity storage device 607 can be collectively referred to as memory.
[0142] According to various embodiments of the present application, the computer device 600 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 600 can be connected to the network 612 through the network interface unit 611 connected to the system bus 605, or the network interface unit 611 can be used to connect to other types of networks or remote computer systems (not shown).
[0143] The above-mentioned memory also includes one or more programs, and the one or more programs are stored in the memory and configured to be executed by the CPU.
[0144] In an optional embodiment, a computer device is provided, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the method for determining the device type as described above.
[0145] In an optional embodiment, a computer-readable storage medium is provided, in which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the device type determination method as described above.
[0146] Optionally, the computer readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a solid state drive (SSD), or an optical disk. Among them, the random access memory may include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0147] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0148] An embodiment of the present application further provides a computer-readable medium storing at least one instruction, wherein the at least one instruction is loaded and executed by the processor to implement the method for determining the device type as described in the above embodiments.
[0149] It should be noted that: when the device type determination device provided in the above embodiment executes the device type determination method, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device type determination device provided in the above embodiment and the device type determination method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0150] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0151] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0152] The above description is only an illustrative embodiment that can be implemented in the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A method for determining a device type, characterized in that: Applied in a first device, the method includes: Establishing a Bluetooth connection with a second device; Acquire protocol configuration information and input / output (IO) configuration information of a protocol supported by the second device according to the Bluetooth connection, wherein the protocol configuration information is used to describe capabilities of the second device; In a case where the protocol configuration information indicates that the second device supports a target function, determining that the second device is an in-vehicle device; wherein the target function is a function supported only by the in-vehicle device; In a case where the protocol configuration information indicates that the second device does not support a browsing function in a device information exchange protocol MAP or an audio and video remote control protocol AVRCP, determining whether the second device supports a screen display function through the IO configuration information; In a case where the IO configuration information indicates that the second device supports a screen display function, determining whether the second device supports a handheld hands-free protocol HFP according to the protocol configuration information; When the protocol configuration information indicates that the second device supports HFP, determining that the second device is a vehicle-mounted device; The supported target function includes at least one of the following: Support device information exchange protocol MAP; Supports browsing function in audio and video remote control protocol AVRCP.
2. The method according to claim 1, characterized in that: The acquiring, according to the Bluetooth connection, protocol configuration information of a protocol supported by the second device includes: The protocol configuration information of the second device related to inter-device communication is obtained according to the Bluetooth connection.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the protocol configuration information indicates that the second device does not support the target function, it is determined through the IO configuration information that the second device does not support the screen display function, and it is determined that the second device is not the vehicle-mounted device.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: When the protocol configuration information indicates that the second device does not support the target function, it is determined through the protocol configuration information that the second device does not support HFP, and it is determined that the second device is not the in-vehicle device.
5. A device for determining a device type, characterized in that: The device comprises: A connection module, used to establish a Bluetooth connection with a second device; an acquisition module, configured to acquire protocol configuration information and input / output (IO) configuration information of a protocol supported by the second device according to the Bluetooth connection, wherein the protocol configuration information is used to describe capabilities of the second device; a determination module, configured to determine that the second device is an in-vehicle device when the protocol configuration information indicates that the second device supports a target function; wherein the target function is a function supported only by the in-vehicle device; In a case where the protocol configuration information indicates that the second device does not support a browsing function in a device information exchange protocol MAP or an audio and video remote control protocol AVRCP, determining whether the second device supports a screen display function through the IO configuration information; In a case where the IO configuration information indicates that the second device supports a screen display function, determining whether the second device supports a handheld hands-free protocol HFP according to the protocol configuration information; When the protocol configuration information indicates that the second device supports HFP, determining that the second device is a vehicle-mounted device; The supported target function includes at least one of the following: Support device information exchange protocol MAP; Supports browsing function in audio and video remote control protocol AVRCP.
6. The device according to claim 5, characterized in that The acquisition module is used to acquire the protocol configuration information related to inter-device communication of the second device according to the Bluetooth connection.
7. The device according to claim 5 or 6, characterized in that The determination module is further configured to determine, through the IO configuration information, that the second device does not support the screen display function and that the second device is not the vehicle-mounted device when the protocol configuration information indicates that the second device does not support the target function.
8. The device according to claim 5 or 6, characterized in that The determination module is further configured to, when the protocol configuration information indicates that the second device does not support the target function, determine through the protocol configuration information that the second device does not support HFP, and determine that the second device is not the vehicle-mounted device.
9. A terminal, characterized in that: The terminal includes a processor, a memory connected to the processor, and program instructions stored in the memory, and the processor implements the method for determining the device type according to any one of claims 1 to 4 when executing the program instructions.
10. A computer-readable storage medium, wherein program instructions are stored in the storage medium, characterized in that: When the program instructions are executed by a processor, the method for determining the device type according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Apparatus and method for transmitting moving picture stream using bluetooth
CN101123730A
Vehicle-mounted Bluetooth equipment identification method and device, electronic equipment and storage medium
CN110784846A