CN106303824A - Audio frequency apparatus changing method and device - Google Patents
Audio frequency apparatus changing method and device Download PDFInfo
- Publication number
- CN106303824A CN106303824A CN201610620676.XA CN201610620676A CN106303824A CN 106303824 A CN106303824 A CN 106303824A CN 201610620676 A CN201610620676 A CN 201610620676A CN 106303824 A CN106303824 A CN 106303824A
- Authority
- CN
- China
- Prior art keywords
- equipment
- usb audio
- usb
- audio equipment
- audio
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R3/00—Circuits for transducers, loudspeakers or microphones
Abstract
The invention discloses a kind of audio frequency apparatus changing method and device, belong to field of terminal technology, the method includes: when the access events of multiple general-purpose serial bus USB audio frequency apparatus being detected, by system kernel, the access events of each usb audio equipment being reported application framework layer, the access events of this each usb audio equipment includes the audio-frequency information of this each usb audio equipment;Audio-frequency information based on this each usb audio equipment, obtains the equipment serial number of this each usb audio equipment by application framework layer;Equipment serial number based on this each usb audio equipment, is sent to upper layer application by application framework layer by the access events of this each usb audio equipment;The audio-frequency information that access events based on this each usb audio equipment includes, audio frequency apparatus intelligent terminal carried by upper layer application switches to target usb audio equipment.The present invention is by being identified the multiple usb audio equipment accessed, thus improves reliability and the efficiency of audio frequency apparatus switching.
Description
Technical field
The present invention relates to field of terminal technology, particularly to a kind of audio frequency apparatus changing method and device.
Background technology
Along with the development of technology, the audio frequency apparatus that intelligent terminal can be external gets more and more, such as, and wired earphone, bluetooth
Audio frequency apparatus, USB (Universal Serial Bus, USB (universal serial bus)) audio frequency apparatus etc..Wherein, usb audio is set
Standby, when multiple usb audio equipment access intelligent terminal, the audio frequency apparatus switching that this intelligent terminal can will carry after powering
For external usb audio equipment.
At present, the system of intelligent terminal generally uses Android (Android) system, and the kernel of this android system is permissible
Automatically multiple usb audio equipment that intelligent terminal is external are detected, to determine a plurality of audio-frequency information, this plurality of audio-frequency information
With the plurality of usb audio equipment one_to_one corresponding, this plurality of audio-frequency information is reported the application framework layer of this android system.
Owing to the plurality of usb audio equipment is all outer being connected on this intelligent terminal, that is to say, this intelligent terminal is for the plurality of USB sound
Frequently equipment Inspection to be all access events, therefore the application framework layer of this android system receiving this plurality of audio frequency letter
After breath, the audio-frequency information finally received, and will finally received can be selected from this plurality of audio-frequency information
Audio-frequency information is sent to the upper layer application in this intelligent terminal, upper layer application judge current based on the audio-frequency information received
The device type of usb audio equipment, and then judge whether the device type of this usb audio equipment meets cutting of current intelligent terminal
Change requirement, when the switching that the device type of this usb audio equipment meets current intelligent terminal requires, this intelligent terminal is carried
Audio frequency apparatus switch to this usb audio equipment.
Owing to the application framework layer of android system is when multiple similar events being detected, generally will finally receive
Article one, audio-frequency information reports upper layer application, therefore, when this intelligent terminal accesses multiple usb audio equipment, and this intelligent terminal
Upper layer application can only identify the device type of usb audio equipment that the audio-frequency information finally received is corresponding.If intelligence
The audio output apparatus that energy terminal is currently needed for carrying switches over, and the device type that upper layer application recognizes is that audio frequency is defeated
Enter equipment, and not audio output apparatus, then this intelligent terminal will be unable to the audio output apparatus carried is switched to USB sound
Frequently outut device.
Summary of the invention
In order to solve problem of the prior art, embodiments provide a kind of audio switching method and device.Described
Technical scheme is as follows:
On the one hand, it is provided that a kind of audio frequency apparatus changing method, described method includes:
When the access events of multiple general-purpose serial bus USB audio frequency apparatus being detected, by system kernel by each USB
The access events of audio frequency apparatus reports application framework layer, the access events of each usb audio equipment described include described respectively
The audio-frequency information of individual usb audio equipment;
Audio-frequency information based on each usb audio equipment described, obtains each USB sound described by described application framework layer
Frequently the equipment serial number of equipment;
Equipment serial number based on each usb audio equipment described, by described application framework layer by each usb audio described
The access events of equipment is sent to upper layer application;
The audio-frequency information that access events based on each usb audio equipment described includes, will by described upper layer application
The audio frequency apparatus that intelligent terminal carries switches to target usb audio equipment, and the device type of described target usb audio equipment with
The device type of the described audio frequency apparatus carried is identical, and described device type includes that audio input device or audio frequency output set
Standby.
Alternatively, described audio-frequency information based on each usb audio equipment described, obtain institute by described application framework layer
State the equipment serial number of each usb audio equipment, including:
The device identification of each usb audio equipment described is obtained from the audio-frequency information of each usb audio equipment described;
Device identification based on each usb audio equipment described, obtains each USB sound described from the file of specified path
Frequently the equipment serial number of equipment.
Alternatively, described device identification based on each usb audio equipment described, from the file of specified path, obtain institute
After stating the equipment serial number of each usb audio equipment, also include:
Device identification and the equipment serial number of each usb audio equipment described are carried out corresponding storage.
Alternatively, described equipment serial number based on each usb audio equipment described, by described application framework layer by described
The access events of each usb audio equipment is sent to upper layer application, including:
By described application framework layer the equipment serial number of each usb audio equipment described is respectively added to described each
In the access events of usb audio equipment;
After adding the equipment serial number of each usb audio equipment described, by the access thing of each usb audio equipment described
Part broadcasts to upper layer application by viscosity.
Alternatively, the audio-frequency information that described access events based on each usb audio equipment described includes, by described
The audio frequency apparatus that intelligent terminal is carried by upper layer application switches to the target usb audio equipment in the plurality of usb audio equipment,
Including:
The audio-frequency information included the access events of each usb audio equipment described by described upper layer application is solved
Analysis, obtains the device type of each usb audio equipment described;
Device type based on each usb audio equipment described, determines described target from the plurality of usb audio equipment
Usb audio equipment;
The audio frequency apparatus that described intelligent terminal carries is switched to described target usb audio equipment.
On the other hand, it is provided that a kind of audio frequency apparatus switching device, described device includes:
Reporting module, for when the access events of multiple general-purpose serial bus USB audio frequency apparatus being detected, passes through system
The access events of each usb audio equipment is reported application framework layer, the access events of each usb audio equipment described by kernel
Include the audio-frequency information of each usb audio equipment described;
Acquisition module, for audio-frequency information based on each usb audio equipment described, is obtained by described application framework layer
The equipment serial number of each usb audio equipment described;
Sending module, for equipment serial number based on each usb audio equipment described, by described application framework layer by institute
The access events stating each usb audio equipment is sent to upper layer application;
Handover module, the audio-frequency information included for access events based on each usb audio equipment described, by institute
State the audio frequency apparatus that intelligent terminal carries by upper layer application and switch to target usb audio equipment, and described target usb audio equipment
Device type identical with the device type of the described audio frequency apparatus carried, described device type include audio input device or
Audio output apparatus.
Alternatively, described acquisition module includes:
First acquiring unit, for obtaining each usb audio described from the audio-frequency information of each usb audio equipment described
The device identification of equipment;
Second acquisition unit, for device identification based on each usb audio equipment described, from the file of specified path
Obtain the equipment serial number of each usb audio equipment described.
Alternatively, described acquisition module also includes:
Memory element, for carrying out corresponding storage by the device identification of each usb audio equipment described and equipment serial number.
Alternatively, described sending module includes:
Adding device, for adding the equipment serial number of each usb audio equipment described respectively by described application framework layer
It is added in the access events of each usb audio equipment described;
Transmitting element, for after adding the equipment serial number of each usb audio equipment described, by each USB sound described
Frequently the access events of equipment broadcasts to upper layer application by viscosity.
Alternatively, described handover module includes:
Resolution unit, for include the access events of each usb audio equipment described by described upper layer application
Audio-frequency information resolves, and obtains the device type of each usb audio equipment described;
Determine unit, for device type based on each usb audio equipment described, from the plurality of usb audio equipment
In determine described target usb audio equipment;
Switch unit, for switching to described target usb audio equipment by the audio frequency apparatus that described intelligent terminal carries.
The technical scheme that the embodiment of the present invention provides has the benefit that in embodiments of the present invention, intelligent terminal
Received the access events of multiple usb audio equipment that system kernel sends by application framework layer after, based on this each USB sound
Frequently the access events of equipment, obtains the equipment serial number that each usb audio equipment is corresponding, and based on each usb audio equipment sets
Standby sequence number, is sent to upper layer application by the access events of this each usb audio equipment.Intelligent terminal is received by upper layer application should
The access events of each usb audio equipment, and the audio-frequency information that access events based on this each usb audio equipment includes,
Audio frequency apparatus intelligent terminal carried by this upper layer application switches to target usb audio equipment, thus avoids upper strata and answer
With None-identified all accesses usb audio equipment, and cause the situation that cannot be carried out audio frequency apparatus switching to occur, improve audio frequency
The reliability of equipment switching and efficiency.
Accompanying drawing explanation
For the technical scheme being illustrated more clearly that in the embodiment of the present invention, in embodiment being described below required for make
Accompanying drawing be briefly described, it should be apparent that, below describe in accompanying drawing be only some embodiments of the present invention, for
From the point of view of those of ordinary skill in the art, on the premise of not paying creative work, it is also possible to obtain other according to these accompanying drawings
Accompanying drawing.
Fig. 1 is the flow chart of a kind of audio frequency apparatus changing method that the embodiment of the present invention provides;
Fig. 2 is the flow chart of the another kind of audio frequency apparatus changing method that the embodiment of the present invention provides;
Fig. 3 A is the structural representation of a kind of audio frequency apparatus switching device that the embodiment of the present invention provides;
Fig. 3 B is the structural representation of a kind of acquisition module that the embodiment of the present invention provides;
Fig. 3 C is the structural representation of a kind of sending module that the embodiment of the present invention provides;
Fig. 3 D is the structural representation of a kind of handover module that the embodiment of the present invention provides.
Detailed description of the invention
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention
Formula is described in further detail.
Fig. 1 is the flow chart according to a kind of audio frequency apparatus changing method shown in an exemplary embodiment, sees Fig. 1, should
Method comprises the steps.
Step 101: when the access events of multiple usb audio equipment being detected, by system kernel by each usb audio
The access events of equipment reports application framework layer, and the access events of this each usb audio equipment includes this each usb audio
The audio-frequency information of equipment.
Step 102: audio-frequency information based on this each usb audio equipment, obtains this each USB by this application framework layer
The equipment serial number of audio frequency apparatus.
Step 103: equipment serial number based on this each usb audio equipment, by this application framework layer by this each USB sound
Frequently the access events of equipment is sent to upper layer application.
Step 104: the audio-frequency information that access events based on this each usb audio equipment includes, should by this upper strata
Target usb audio equipment, and the device type of this target usb audio equipment is switched to audio frequency apparatus intelligent terminal carried
The device type of the audio frequency apparatus carried with this is identical, and this device type includes audio input device or audio output apparatus.
In embodiments of the present invention, intelligent terminal receives, by application framework layer, multiple USB sounds that system kernel sends
Frequently after the access events of equipment, access events based on this each usb audio equipment, obtain each usb audio equipment corresponding
Equipment serial number, and equipment serial number based on each usb audio equipment, be sent to the access events of this each usb audio equipment
Upper layer application.Intelligent terminal receives the access events of this each usb audio equipment by upper layer application, and based on this each USB
The audio-frequency information that the access events of audio frequency apparatus includes, audio frequency apparatus intelligent terminal carried by this upper layer application is switched
For target usb audio equipment, thus avoid upper layer application None-identified all accesses usb audio equipment, and cause and cannot enter
The situation of row audio frequency apparatus switching occurs, and improves reliability and the efficiency of audio frequency apparatus switching.
Fig. 2 is the flow chart according to a kind of audio frequency apparatus changing method shown in an exemplary embodiment, sees Fig. 2, should
Method comprises the steps.
Step 201: when intelligent terminal detects the access events of multiple usb audio equipment, will be each by system kernel
The access events of individual usb audio equipment reports application framework layer, and the access events of this each usb audio equipment includes that this is each
The audio-frequency information of individual usb audio equipment.
Specifically, when this intelligent terminal detects the access events of multiple usb audio equipment, can be respectively created this many
The file of each usb audio equipment in individual usb audio equipment, and often create the file of a usb audio equipment just to application frame
Rack-layer reports the access events of this usb audio equipment.
It should be noted that access events is used for describing usb audio equipment has accessed intelligent terminal.
Also, it should be noted audio-frequency information refers to the information for describing usb audio equipment, permissible in this audio-frequency information
Including the device type of this usb audio equipment, device identification, manufacturer etc., this is not specifically limited by the embodiment of the present invention.
It addition, the operation of the access events of the terminal the plurality of usb audio equipment of detection is referred to correlation technique, the present invention
This is repeated by embodiment the most one by one.
In like manner, system kernel creates the file of usb audio equipment and is reported by the access events of each usb audio equipment
Being referred to correlation technique to the operation of application framework layer, this is repeated by the embodiment of the present invention the most one by one.
Furthermore, this usb audio equipment includes usb audio outut device and USB input equipment, and the output of this usb audio sets
Standby can be USB speaker, USB earphone etc., and this usb audio input equipment can be USB microphone etc., and the embodiment of the present invention is to this
It is not specifically limited.
Step 202: intelligent terminal's audio-frequency information based on this each usb audio equipment, is obtained by this application framework layer
The equipment serial number of this each usb audio equipment.
Specifically, intelligent terminal obtains this each usb audio equipment from the audio-frequency information of this each usb audio equipment
Device identification;Device identification based on this each usb audio equipment, obtains this each usb audio from the file of specified path
The equipment serial number of equipment.
It should be noted that the device identification of this usb audio equipment is for unique this usb audio equipment that identifies, and this USB
The device identification of audio frequency apparatus can be the sequence number that system kernel reports the order of application framework layer, it is also possible to be audio frequency apparatus
The serial number that dispatches from the factory, such as, this device identification is 001,002,003 etc., and this is not specifically limited by the embodiment of the present invention.
Also, it should be noted the equipment serial number of usb audio equipment is for representing that usb audio equipment accesses intelligent terminal's
Sequence number, this equipment serial number can be digital, alphabetical etc., and such as, this equipment serial number can be the numerals such as 1,2,3, or is A, B, C
Deng letter, this is not specifically limited by the embodiment of the present invention.
Wherein, intelligent terminal passes through the device identification based on this each usb audio equipment of application framework layer, from specified path
File in obtain this each usb audio equipment the operation of equipment serial number can be: by this application framework layer, to specified circuit
File under footpath travels through, thus obtains the target identification identical with the device identification difference of each usb audio equipment, based on
This target identification, obtains the equipment serial number corresponding with this target identification in the file of specified path, that is to say, obtain and each
The equipment serial number that the device identification of usb audio equipment is the most corresponding.
It should be noted that specified path refers to obtain the path of equipment serial number from the file of application framework layer, and
Owing to equipment serial number is normally at the fixed position in application framework layer, therefore, this specified path can be arranged in advance, the disclosure
This is not specifically limited by embodiment.
Also, it should be noted this specified path can be/proc/asound/cardN/usbbus, and/proc/
Asound/cardN/ Yu usbbus one_to_one corresponding.Wherein, the N in this cardN is the equipment serial number of usb audio equipment, usbbus
In be cached with the device identification of usb audio equipment of correspondence.
Exactly usbbus file is traveled through it addition, the file of specified path to be carried out traversal, that is to say, right/proc/
Asound/cardN/usbbus travels through.
Such as, the device identification of two usb audio equipment that this intelligent terminal is got by application framework layer is respectively
003 and 004, the file under this specified path is respectively/proc/asound/card1/usbbus ,/proc/asound/
Under card2/usbbus ,/proc/asound/card3/usbbus ,/proc/asound/card4/usbbus, and this card1
Usbbus file in be cached with in the usbbus file under mark 001, this card2 and be cached with under mark 002, this card3
Usbbus file is cached with in the usbbus file under mark 003, this card4 and is cached with mark 004, therefore, to this appointment
The file in path travels through, and the equipment serial number obtaining the usb audio equipment that device identification is 003 is 3, device identification is 004
The equipment serial number of usb audio equipment be 4.
Further, intelligent terminal, after the device identification getting each usb audio equipment and equipment serial number, also may be used
So that the device identification of this each usb audio equipment and equipment serial number to carry out corresponding storage, thus follow-up arriving in use is facilitated to be somebody's turn to do
When the device identification of each usb audio equipment and equipment serial number, it is not necessary to carrying out again travels through, thus alleviate intelligent terminal
Operation burden.
Step 203: intelligent terminal's equipment serial number based on this each usb audio equipment, should by this application framework layer
The access events of each usb audio equipment is sent to upper layer application.
Specifically, the equipment serial number of this each usb audio equipment is added respectively by intelligent terminal by this application framework layer
In the access events of this each usb audio equipment;After adding the equipment serial number of this each usb audio equipment, this is each
The access events of individual usb audio equipment broadcasts to upper layer application by viscosity.
Wherein, the equipment serial number of this each usb audio equipment is respectively added to by intelligent terminal by this application framework layer
Operation in the access events of this each usb audio equipment can be: calls specified function by access events, and by specifying
The equipment serial number of each usb audio equipment obtained is respectively added to the access events that each usb audio equipment is corresponding by function
In.
It should be noted that specified function for being respectively added to correspondence by the equipment serial number of each usb audio equipment
In access events, and this specified function can be arranged in advance, and such as, this specified function can be setData function etc., the present invention
This is not specifically limited by embodiment.
Also, it should be noted due to the access that the equipment serial number of this each usb audio equipment is respectively added to correspondence
After event, the execution action in this each access events changes, and the execution action of this each access events is mutual the most not phase
Same action, thus the access events of this each usb audio equipment can be sent by this intelligent terminal by this application framework layer
To upper layer application.
Step 204: the audio-frequency information that intelligent terminal's access events based on this each usb audio equipment includes, passes through
The audio frequency apparatus that intelligent terminal is carried by this upper layer application switches to target usb audio equipment, and this target usb audio equipment
The device type of the audio frequency apparatus that device type carries with this is identical, and this device type includes that audio input device or audio frequency are defeated
Go out equipment.
Specifically, the sound that the access events of this each usb audio equipment is included by intelligent terminal by this upper layer application
Frequently information resolves, and obtains the device type of this each usb audio equipment;Equipment class based on this each usb audio equipment
Type, determines this target usb audio equipment from the plurality of usb audio equipment;The audio frequency apparatus switching that this intelligent terminal is carried
For this target usb audio equipment.
It should be noted that the access events of this each usb audio equipment is included by intelligent terminal by upper layer application
The audio-frequency information operation that carries out resolving be referred to correlation technique, this is repeated by the embodiment of the present invention the most one by one.
Wherein, intelligent terminal's device type based on this each usb audio equipment, from the plurality of usb audio equipment really
The operation of this target usb audio equipment fixed can be: intelligent terminal is determined in current multiple usb audio equipment by upper layer application
Whether there is device type to meet intelligent terminal and switch the usb audio equipment of requirement, meeting intelligent terminal when there is device type
Switching require usb audio equipment time, by this meet switching require usb audio equipment be defined as target usb audio equipment.
It should be noted that the switching of intelligent terminal requires that referring to intelligent terminal can be carried out the audio frequency apparatus carried
The requirement of switching, and this switching requirement can arrange in advance, such as, the device type of the audio frequency apparatus carried as intelligent terminal is
During audio input device, then switching requirement can be only when the device type of the usb audio equipment accessed is that audio frequency input sets
Time standby, carry out the switching of audio frequency apparatus;When the device type of the audio frequency apparatus that intelligent terminal carries is audio output apparatus, then
Switching requirement can be only when the device type of the usb audio equipment accessed is audio output apparatus, carries out audio frequency apparatus
Switching;When the audio frequency apparatus that intelligent terminal carries includes audio output apparatus and audio output apparatus, then switching requirement can
Think when the device type of the usb audio equipment accessed is audio input device, carry out the switching of audio input device, when connecing
When the device type of the usb audio equipment entered is audio output apparatus, carry out the switching of audio output apparatus, the embodiment of the present invention
This is not specifically limited.
Such as, the audio frequency apparatus carried as this intelligent terminal is audio output apparatus, and this switching requires as when access
When the device type of usb audio equipment is audio output apparatus, when carrying out the switching of audio frequency apparatus, if this intelligent terminal accesses
Multiple usb audio equipment include USB speaker, then be audio output apparatus due to the device type of this USB speaker, therefore,
This usb audio equipment is defined as target usb audio outut device, and this intelligent terminal is carried audio output apparatus switches to
This USB speaker.
It addition, this usb audio equipment meeting switching requirement is defined as the operation of target usb audio equipment by intelligent terminal
Can be: when the usb audio equipment meeting switching requirement includes at least one usb audio equipment, by this at least one USB sound
Frequently each usb audio equipment in equipment is defined as target usb audio equipment;Or, from this at least one usb audio equipment
Select any one usb audio equipment, the usb audio equipment of selection is defined as target audio equipment.Certainly, apply in reality
In can also determine target usb audio equipment from meeting the usb audio equipment that switching requires by other means, the disclosure is real
Execute example this is not specifically limited.
Also, it should be noted the audio frequency apparatus carried is switched to the operation of this target usb audio equipment by intelligent terminal
Equally with reference to correlation technique, this is repeated by the embodiment of the present invention the most one by one.
It addition, when the plurality of usb audio equipment does not exist device type meet current intelligent terminal switching require
During usb audio equipment, do not carry out the switching of audio frequency apparatus.
In embodiments of the present invention, intelligent terminal receives, by application framework layer, multiple USB sounds that system kernel sends
Frequently, after the access events of equipment, from the audio-frequency information that the access events of each usb audio equipment includes, corresponding device mark is obtained
Know, and from the file of specified path, obtain the equipment serial number of correspondence according to the device identification of each usb audio equipment, this is set
In the access events that standby sequence number adds correspondence to by specifying this function.Owing to this access events adding each usb audio
The equipment serial number of equipment, so that the execution action of each access events is mutually different action, therefore, this intelligent terminal can
So that this each access events is reported upper layer application by application framework layer.Intelligent terminal receives this each by upper layer application
The access events of usb audio equipment, and the audio-frequency information including this access events resolves, due to can in this audio-frequency information
To include the device type of usb audio equipment, therefore, by the audio-frequency information of each usb audio equipment is resolved, permissible
Obtain the device type of each usb audio equipment, such that it is able to device type based on this each audio frequency apparatus and switching requirement,
Determine target usb audio equipment, and audio frequency apparatus intelligent terminal carried switches to target usb audio equipment, thus complete
The switching of audio frequency apparatus, it is to avoid upper layer application None-identified all accesses usb audio equipment, and cause and cannot be carried out audio frequency and set
The situation of standby switching occurs, and then improves reliability and the efficiency of audio frequency apparatus switching.
Fig. 3 A is the structural representation of a kind of audio frequency apparatus switching device that the embodiment of the present invention provides, and sees Fig. 3 A, should
Device includes: reporting module 301, acquisition module 302, sending module 303 and handover module 304.
Reporting module 301, for when the access events of multiple general-purpose serial bus USB audio frequency apparatus being detected, passes through
The access events of each usb audio equipment is reported application framework layer by system kernel, the access thing of this each usb audio equipment
Part includes the audio-frequency information of this each usb audio equipment;
Acquisition module 302, for audio-frequency information based on this each usb audio equipment, is obtained by this application framework layer
The equipment serial number of this each usb audio equipment;
Sending module 303, for equipment serial number based on this each usb audio equipment, should by this application framework layer
The access events of each usb audio equipment is sent to upper layer application;
Handover module 304, the audio-frequency information included for access events based on this each usb audio equipment, passes through
The audio frequency apparatus that intelligent terminal is carried by this upper layer application switches to target usb audio equipment, and this target usb audio equipment
The device type of the audio frequency apparatus that device type carries with this is identical, and this device type includes that audio input device or audio frequency are defeated
Go out equipment.
Alternatively, seeing Fig. 3 B, this acquisition module 302 includes:
First acquiring unit 3021, for obtaining this each usb audio from the audio-frequency information of this each usb audio equipment
The device identification of equipment;
Second acquisition unit 3022, for device identification based on this each usb audio equipment, from the file of specified path
The equipment serial number of this each usb audio equipment of middle acquisition.
Alternatively, this acquisition module 302 also includes:
Memory element, for carrying out corresponding storage by the device identification of this each usb audio equipment and equipment serial number.
Alternatively, seeing Fig. 3 C, this sending module 303 includes:
Adding device 3031, for adding the equipment serial number of this each usb audio equipment respectively by this application framework layer
It is added in the access events of this each usb audio equipment;
Transmitting element 3032, for after adding the equipment serial number of this each usb audio equipment, by this each USB sound
Frequently the access events of equipment broadcasts to upper layer application by viscosity.
Alternatively, seeing Fig. 3 D, this handover module 304 includes:
Resolution unit 3041, for include the access events of this each usb audio equipment by this upper layer application
Audio-frequency information resolves, and obtains the device type of this each usb audio equipment;
Determine unit 3042, for device type based on this each usb audio equipment, from the plurality of usb audio equipment
In determine this target usb audio equipment;
Switch unit 3043, for switching to this target usb audio equipment by the audio frequency apparatus that this intelligent terminal carries.
In sum, in embodiments of the present invention, intelligent terminal receives what system kernel sent by application framework layer
After the access events of multiple usb audio equipment, it is right to obtain from the audio-frequency information that the access events of each usb audio equipment includes
Answer device identification, and from the file of specified path, obtain the equipment sequence of correspondence according to the device identification of each usb audio equipment
Number, by this equipment serial number by specifying this function to add in the access events of correspondence.It is each owing to this access events adding
The equipment serial number of individual usb audio equipment, so that the execution action of each access events is mutually different action, therefore, should
This each access events can be reported upper layer application by application framework layer by intelligent terminal.Intelligent terminal passes through upper layer application
Receive the access events of this each usb audio equipment, and the audio-frequency information including this access events resolves, due to this sound
Information can include the device type of usb audio equipment frequently, therefore, by the audio-frequency information of each usb audio equipment is entered
Row resolves, and can obtain the device type of each usb audio equipment, such that it is able to device type based on this each audio frequency apparatus
With switching requirement, determine target usb audio equipment, and audio frequency apparatus intelligent terminal carried switches to target usb audio to set
Standby, thus complete the switching of audio frequency apparatus, it is to avoid upper layer application None-identified all accesses usb audio equipment, and cause nothing
Method carries out the situation of audio frequency apparatus switching and occurs, and then improves reliability and the efficiency of audio frequency apparatus switching.
It should be understood that the audio frequency apparatus switching device that above-described embodiment provides is when carrying out audio frequency apparatus switching, only
Be illustrated with the division of above-mentioned each functional module, in actual application, can as desired by above-mentioned functions distribution by
Different functional modules completes, and the internal structure of device will be divided into different functional modules, with complete described above entirely
Portion or partial function.It addition, the audio frequency apparatus switching device that above-described embodiment provides belongs to audio switching method embodiment
Same design, it implements process and refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can pass through hardware
Completing, it is also possible to instruct relevant hardware by program and complete, described program can be stored in a kind of computer-readable
In storage medium, storage medium mentioned above can be read only memory, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all spirit in the present invention and
Within principle, any modification, equivalent substitution and improvement etc. made, should be included within the scope of the present invention.
Claims (10)
1. an audio frequency apparatus changing method, it is characterised in that described method includes:
When the access events of multiple general-purpose serial bus USB audio frequency apparatus being detected, by system kernel by each usb audio
The access events of equipment reports application framework layer, and the access events of each usb audio equipment described includes each USB described
The audio-frequency information of audio frequency apparatus;
Audio-frequency information based on each usb audio equipment described, obtains each usb audio described by described application framework layer and sets
Standby equipment serial number;
Equipment serial number based on each usb audio equipment described, by described application framework layer by each usb audio equipment described
Access events be sent to upper layer application;
The audio-frequency information that access events based on each usb audio equipment described includes, by described upper layer application by intelligence
The audio frequency apparatus that terminal carries switches to target usb audio equipment, and the device type of described target usb audio equipment is with described
The device type of the audio frequency apparatus carried is identical, and described device type includes audio input device or audio output apparatus.
2. the method for claim 1, it is characterised in that described audio-frequency information based on each usb audio equipment described,
The equipment serial number of each usb audio equipment described is obtained by described application framework layer, including:
The device identification of each usb audio equipment described is obtained from the audio-frequency information of each usb audio equipment described;
Device identification based on each usb audio equipment described, obtains each usb audio described from the file of specified path and sets
Standby equipment serial number.
3. method as claimed in claim 2, it is characterised in that described device identification based on each usb audio equipment described,
After obtaining the equipment serial number of each usb audio equipment described from the file of specified path, also include:
Device identification and the equipment serial number of each usb audio equipment described are carried out corresponding storage.
4. the method as described in claim 1-3 is arbitrary, it is characterised in that described based on each usb audio equipment described set
Standby sequence number, is sent to upper layer application by described application framework layer by the access events of each usb audio equipment described, including:
By described application framework layer, the equipment serial number of each usb audio equipment described is respectively added to each USB sound described
Frequently in the access events of equipment;
After adding the equipment serial number of each usb audio equipment described, the access events of each usb audio equipment described is led to
Cross viscosity and broadcast to upper layer application.
5. the method as described in claim 1-3 is arbitrary, it is characterised in that described based on each usb audio equipment described connect
The audio-frequency information that incoming event includes, audio frequency apparatus intelligent terminal carried by described upper layer application switches to the plurality of
Target usb audio equipment in usb audio equipment, including:
The audio-frequency information included the access events of each usb audio equipment described by described upper layer application is resolved,
Obtain the device type of each usb audio equipment described;
Device type based on each usb audio equipment described, determines described target USB from the plurality of usb audio equipment
Audio frequency apparatus;
The audio frequency apparatus that described intelligent terminal carries is switched to described target usb audio equipment.
6. an audio frequency apparatus switching device, it is characterised in that described device includes:
Reporting module, for when the access events of multiple general-purpose serial bus USB audio frequency apparatus being detected, passes through system kernel
The access events of each usb audio equipment is reported application framework layer, the access events of each usb audio equipment described wraps
Include the audio-frequency information of each usb audio equipment described;
Acquisition module, for audio-frequency information based on each usb audio equipment described, obtains described by described application framework layer
The equipment serial number of each usb audio equipment;
Sending module, for equipment serial number based on each usb audio equipment described, by described application framework layer by described respectively
The access events of individual usb audio equipment is sent to upper layer application;
Handover module, the audio-frequency information included for access events based on each usb audio equipment described, on described
The layer audio frequency apparatus that intelligent terminal carried of application switches to target usb audio equipment, and the setting of described target usb audio equipment
Standby type is identical with the device type of the described audio frequency apparatus carried, and described device type includes audio input device or audio frequency
Outut device.
7. device as claimed in claim 6, it is characterised in that described acquisition module includes:
First acquiring unit, for obtaining each usb audio equipment described from the audio-frequency information of each usb audio equipment described
Device identification;
Second acquisition unit, for device identification based on each usb audio equipment described, obtains from the file of specified path
The equipment serial number of each usb audio equipment described.
8. device as claimed in claim 7, it is characterised in that described acquisition module also includes:
Memory element, for carrying out corresponding storage by the device identification of each usb audio equipment described and equipment serial number.
9. the device as described in claim 6-8 is arbitrary, it is characterised in that described sending module includes:
Adding device, for being respectively added to the equipment serial number of each usb audio equipment described by described application framework layer
In the access events of each usb audio equipment described;
Transmitting element, for, after adding the equipment serial number of each usb audio equipment described, setting each usb audio described
Standby access events broadcasts to upper layer application by viscosity.
10. the device as described in claim 6-8 is arbitrary, it is characterised in that described handover module includes:
Resolution unit, for the audio frequency included the access events of each usb audio equipment described by described upper layer application
Information resolves, and obtains the device type of each usb audio equipment described;
Determine unit, for device type based on each usb audio equipment described, from the plurality of usb audio equipment really
Fixed described target usb audio equipment;
Switch unit, for switching to described target usb audio equipment by the audio frequency apparatus that described intelligent terminal carries.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610620676.XA CN106303824B (en) | 2016-07-29 | 2016-07-29 | Audio frequency apparatus switching method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610620676.XA CN106303824B (en) | 2016-07-29 | 2016-07-29 | Audio frequency apparatus switching method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106303824A true CN106303824A (en) | 2017-01-04 |
CN106303824B CN106303824B (en) | 2019-06-25 |
Family
ID=57663846
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610620676.XA Active CN106303824B (en) | 2016-07-29 | 2016-07-29 | Audio frequency apparatus switching method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106303824B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107315562A (en) * | 2017-07-18 | 2017-11-03 | 中国北方车辆研究所 | The method that many USB man machine languages interactive device System Numbers are obtained on one PC |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040079694A (en) * | 2003-03-10 | 2004-09-16 | 비티네트웍스 | Muti Data Interface system of Using by Universal Data Bus |
CN103324459A (en) * | 2013-06-14 | 2013-09-25 | Tcl集团股份有限公司 | Method and system for implementing USB (universal serial bus) headset devices |
CN103513954A (en) * | 2012-08-08 | 2014-01-15 | Tcl集团股份有限公司 | Method and system for realizing support of USB wireless audio equipment |
CN103546704A (en) * | 2013-07-02 | 2014-01-29 | Tcl集团股份有限公司 | Method and television for recognizing USB (universal serial bus) devices plugged in television |
CN104159147A (en) * | 2014-08-05 | 2014-11-19 | 乐视致新电子科技(天津)有限公司 | Method and device for switching to external audio input-output equipment |
-
2016
- 2016-07-29 CN CN201610620676.XA patent/CN106303824B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040079694A (en) * | 2003-03-10 | 2004-09-16 | 비티네트웍스 | Muti Data Interface system of Using by Universal Data Bus |
CN103513954A (en) * | 2012-08-08 | 2014-01-15 | Tcl集团股份有限公司 | Method and system for realizing support of USB wireless audio equipment |
CN103324459A (en) * | 2013-06-14 | 2013-09-25 | Tcl集团股份有限公司 | Method and system for implementing USB (universal serial bus) headset devices |
CN103546704A (en) * | 2013-07-02 | 2014-01-29 | Tcl集团股份有限公司 | Method and television for recognizing USB (universal serial bus) devices plugged in television |
CN104159147A (en) * | 2014-08-05 | 2014-11-19 | 乐视致新电子科技(天津)有限公司 | Method and device for switching to external audio input-output equipment |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107315562A (en) * | 2017-07-18 | 2017-11-03 | 中国北方车辆研究所 | The method that many USB man machine languages interactive device System Numbers are obtained on one PC |
Also Published As
Publication number | Publication date |
---|---|
CN106303824B (en) | 2019-06-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112217831A (en) | Information interaction method, device and equipment about Internet of things equipment | |
US10009718B2 (en) | Sign-in method and device, sign-in server, and storage medium | |
CN104360736A (en) | Gesture-based terminal control method and system | |
JP2019536070A (en) | User positioning method, information push method, and related apparatus | |
CN102722440A (en) | Debugging device of executive codes of embedded system, debugging method and embedded system | |
CN104902221B (en) | Video frequency monitoring method and device | |
CN105069050A (en) | Search response method, apparatus and system | |
CN105095081A (en) | Application program function testing method and device | |
AU2016250382A1 (en) | System and method for utilizing machine-readable codes for testing a communication network | |
CN105187480A (en) | Configuration file acquisition method, configuration file acquisition device and configuration file acquisition system | |
CN105183631A (en) | Equipment test methods and devices | |
CN104010005A (en) | Method and system supporting access of sensors of different types | |
CN105260082A (en) | Display method for test data and development terminal | |
CN104901815A (en) | Grouping method for user terminals, conference server and conference system | |
CN105718405A (en) | Mobile terminal and method for USB interface multiplex of processors of mobile terminal | |
CN110221944A (en) | It is carried out using audio frequency apparatus to be measured itself from the method and system surveyed | |
CN106776039A (en) | A kind of data processing method and device | |
CN109508168A (en) | Multichannel volume adjusting method and relevant apparatus | |
CN115390713A (en) | Screen control method, screen control device, electronic apparatus, program, and medium | |
CN104539799A (en) | Communication control method and system based on multiple devices | |
CN106303824A (en) | Audio frequency apparatus changing method and device | |
CN104657445A (en) | Method for obtaining prompt information | |
CN102026144A (en) | Roaming performance test method, equipment and system thereof | |
CN105392083B (en) | A kind of MPP speakers switching method and access controller | |
CN104297729A (en) | Information processing method and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder |
Address after: 266555 Qingdao economic and Technological Development Zone, Shandong, Hong Kong Road, No. 218 Patentee after: Hisense Video Technology Co., Ltd Address before: 266555 Qingdao economic and Technological Development Zone, Shandong, Hong Kong Road, No. 218 Patentee before: HISENSE ELECTRIC Co.,Ltd. |
|
CP01 | Change in the name or title of a patent holder |