Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
The embodiment of the invention is a kind of technology of data sync; This technology realizes through earphone; Confirm corresponding master slave relation such as earphone and portable terminal are continuous according to different connected modes, thereby realize the data sync function of earphone and portable terminal according to the master slave relation of confirming.
At this, illustrative examples of the present invention and explanation thereof are used to explain the present invention, but not as to qualification of the present invention.
Embodiment one
The embodiment of the invention is a kind ofly to carry out the method for data sync through earphone, and is as shown in Figure 1, and Fig. 1 is the schematic flow diagram of method of the data sync of present embodiment, and this flow process comprises the steps:
101. when earphone has at least two kinds of connected modes to link to each other with portable terminal,, select to participate in the highest connected mode of priority of data sync according to predefined connected mode priority;
102. obtain the master slave relation of earphone and said portable terminal according to the connected mode of selecting;
103. according to the connected mode of said master slave relation and selection, earphone and said portable terminal synchrodata.
Earphone in the embodiment of the invention and portable terminal are all supported multiple transmission means; Comprise wire transmission and wireless transmission; Wire transmission mainly is meant (the Universal Serial BUS with USB; In translate " USB ") transmission that connected mode is carried out, wireless transmission can be the transmission of carrying out through bluetooth or WIFI wireless connections modes such as (WirelessFidelity, Wireless Fidelitys).Wherein said predefined connected mode priority is meant that the earphone to participating in data sync is provided with the rank that preferred selection is connected with the connected mode that portable terminal links to each other; The connected mode of highest level preferentially is chosen as the connected mode of participating in data sync; So in the step 101 when having at least two kinds of connected modes to link to each other with portable terminal; According to predefined connected mode priority, select the highest connected mode of priority to participate in the data sync of said portable terminal.Be example with the earphone such as earlier with earphone and portable terminal through wireless connections; After again earphone and portable terminal are passed through wired connection; Because the wired connection mode is higher than the rank of wireless connections mode in predefined connected mode priority, so earphone finally selects the high wired connection mode of rank to participate in the data sync of said portable terminal.The wireless connections of its headphone and portable terminal realize through wireless communication module; This wireless communication module can be bluetooth module or WI-FI module, carries out being connected with the respective wireless of portable terminal according to the instruction of setting up wireless connections that receives such as earphone.And earphone to carry out with the wired connection of portable terminal can be to be connected realization through the usb data line; After connecting earphone and portable terminal through the usb data line; Earpiece side receives the level signal of rating number; According to this level signal and the corresponding usb protocol of corresponding USB interface, earphone promptly knows it is the wired connection mode at this moment.
With the different connected modes of portable terminal maybe be corresponding different master slave relations, wherein said " master " is meant main control device; " from " be meant slave, promptly who does master control equipment at corresponding connected mode headphone and portable terminal, and who does slave; And to carry out synchrodata, and main control device has function and the authority of initiating the data sync order, and corresponding data sync is carried out in the order of the synchrodata that slave generally can only send according to main control device.When earphone is connected with wireless mode with portable terminal; Because wireless transmission protocol is a kind of host-host protocol of equity; So whom one of earphone and portable terminal can assign the order of data sync as the leading data sync of main control device when, who is exactly a main control device.And being provided with of master-slave equipment mainly confirmed according to the corresponding host-host protocol of said wireless connections mode, the setting of promptly having stipulated master-slave equipment such as the synchronization policy in the Bluetooth protocol (sync profile).Can also can do slave so that earphone both can be done master control equipment according to condition of different.When earphone is connected with wired mode with portable terminal; Connect such as USB, earphone can obtain the USB device information of portable terminal according to usb protocol, confirms the master slave relation with portable terminal according to this USB device information; When being USB flash disk (being flash disk) such as USB device information when the portable terminal that gets access to; Earphone activates the data sync function of master control and said portable terminal, makes earphone as main control device, dominates the data sync with portable terminal; When the USB device information of the portable terminal that gets access to is not USB flash disk (being flash disk); Like USB interface etc.; Earphone can be done slave; After the synchrodata message that receives said portable terminal transmission when earphone, according to the synchronous function of said message earphone shielding major control data, so that portable terminal is according to the connected mode master control of selecting and the data sync of earphone.The synchrodata message that portable terminal sends generally realizes according to the instruction that the user assigns.So step 102 can be obtained the master slave relation of earphone and said portable terminal according to the connected mode of selecting.
Step 103 is according to the connected mode of said master slave relation and selection, and earphone and said portable terminal synchrodata have confirmed that promptly earphone is done master control equipment or the laggard line data of slave is synchronous.Such as when earphone during, send ordering of data sync from earpiece side through corresponding connected mode, so that the portable terminal response command carries out corresponding data sync to portable terminal as main control device.When earphone during, send the order of data sync through corresponding connected mode mobile terminal receive side, so that earphone carries out corresponding data sync according to order as slave.
The embodiment of the invention need to prove; Above-mentioned wired or wireless connection is that present embodiment is in order to it will be apparent to those skilled in the art that the exemplary illustration of having done; Those skilled in the art can make the technological means that realizes identical purpose according to above-mentioned explanation fully; So can not regard this exemplary explanation as limitation of the present invention, the technological means of the above-mentioned identical purpose of any realization is all in protection scope of the present invention.Please those skilled in the art note how to realize that data sync is a prior art, present embodiment is not done in detail at this yet and is given unnecessary details.
Present embodiment headphone and portable terminal all can be participated in the data sync with the other side as executive agent, and when not possessing the function of selection connected mode or master slave relation when portable terminal, present embodiment is realized above-mentioned steps through earpiece side fully; When earphone did not possess the function of selecting connected mode or master slave relation, present embodiment was realized above-mentioned steps through mobile terminal side fully; When earphone and portable terminal all possess the function of selecting connected mode or master slave relation; Present embodiment can be realized above-mentioned steps through earphone or any side of portable terminal; Such as confirming master slave relation according to data wire when the wired connection, when wireless connections, can be that main principle is confirmed master slave relation according to a side of initiating to connect.
The advantage that present embodiment is compared with prior art is; Support multiple connected mode; According to confirming the master slave relation with said portable terminal with portable terminal connected mode different; Thereby realize and the data sync of said portable terminal according to the master slave relation of confirming, so not only greatly facilitate the user and can carry out exchanges data, renewal, backup with portable terminal, also make data sync convenient, quick through earphone.
Embodiment two
Present embodiment is a kind ofly to carry out the method for data sync through earphone, and the executive agent of present embodiment with the earphone is example, and is as shown in Figure 2, and Fig. 2 is the schematic flow diagram of method of the data sync of present embodiment, and this flow process comprises the steps:
201. when earphone links to each other with portable terminal through two kinds of connected modes at least; According to predefined connected mode priority; Earphone selects to participate in the highest connected mode of priority of data sync, when the connected mode of said selection is the USB connected mode, changes step 202 over to; When the connected mode of said selection is the wireless connections mode, change step 203 over to.
The priority of connected mode is that the rank that connects of USB is the highest in the present embodiment, and bluetooth is connected to middle rank, and the rank that WI-FI connects is minimum.Because USB is connected to wired connection; Bluetooth and WI-FI belong to wireless connections, link to each other with portable terminal through multiple connected mode so work as earphone, when wherein having USB to connect; No matter one or both then other connections are any modes; All will change step 202 over to, because the rank that USB connects is the highest, earphone is selected the highest USB connected mode participation of priority and the data sync of said portable terminal.When earphone links to each other with portable terminal through two kinds of connected modes; When wherein not having USB to connect; No matter two kinds of then other connections are any modes; All will change step 203 over to, all be wireless connections because bluetooth is connected with WI-FI, selects the highest bluetooth connected mode participation of priority and the data sync of said portable terminal such as earphone.
Need to prove; Three kinds of connected modes and priority orders thereof that present embodiment is enumerated here are exemplary; Earphone itself can dispose more how different connected modes according to actual needs; And according to the configuration connected mode priority is set in advance; Rule is set can be provided with according to the transmission rate speed of connected mode and the type of connected mode of this priority set up suitable being connected thereby make earphone can attempt multiple mode simultaneously according to the demand of actual participation data sync with portable terminal, and every kind of connected mode all should be followed corresponding host-host protocol; Do not enumerate one by one at this present embodiment, those skilled in the art can implement corresponding method and reach the corresponding techniques effect fully according to the explanation of this step.
Certainly if when having only a kind of connected mode to link to each other with portable terminal, this step headphone can triggering selection, just can trigger the selection of connected mode when setting up a kind of connected mode again and be connected with portable terminal as if earphone on this basis.
202. earphone obtains the identity information of said portable terminal, and master slave relation definite according to the identity information that gets access to and said portable terminal.
Because earphone is to connect portable terminal through USB,, will know that promptly what kind of USB device the portable terminal that is attached thereto is here, thereby whether decision is that it provides power supply so earphone will obtain the identity information of portable terminal earlier.
Usb protocol in portable terminal does not comprise OTG (On-The-Go; In translate " well afoot ") during agreement, the identity information that earphone obtains said portable terminal is a flash disk, need be thereby know to this portable terminal power supply; Be that earphone should be as main control device; Portable terminal should so earphone activates the synchronous function of major control data at this moment, change step 204 over to as slave.
When the usb protocol in the portable terminal comprises the OTG agreement; The identity information that earphone obtains said portable terminal is not flash disk; Such as being USB interface or multimedia synchronous protocol (Media Transfer Protocol is called for short MTP) equipment etc., need be thereby know to this portable terminal power supply; Earphone can be used as main control device at this moment, also can be used as slave.Present embodiment is defaulted as main control device with this; When the identity information that promptly obtains said portable terminal when earphone is USB interface or multimedia synchronous protocol equipment; Earphone activates the data sync function of master control and said portable terminal equally; Change step 204 over to, thereby can dominate the data sync with portable terminal.When needs are leading synchronous from mobile terminal side; The synchrodata message that portable terminal sends to earphone; Earphone is according to the synchronous function of said message earphone shielding major control data; Soon oneself be made as slave, change step 204 over to, so that portable terminal is according to the connected mode master control of selecting and the data sync of earphone.Because portable terminal need be brought in the control that realizes master-slave equipment by grabbing corresponding client at this, so but be main control device according to the said earphone default setting of present embodiment.
203. earphone obtains the master slave relation with said portable terminal according to the wireless connections mode of selecting.
Earphone mainly is to obtain the master slave relation with said portable terminal according to the corresponding host-host protocol of said wireless connections mode here.All comprise the corresponding synchronous standard in the different radio host-host protocol, such as the sync profile in the Bluetooth protocol, can be set to client mode according to sync profile earphone, promptly shield the master control function of self, portable terminal then is defaulted as server mode; Earphone also can carry out mode switch according to the translative mode order that portable terminal is sent, and promptly earphone can be set to server mode after receiving the translative mode order, promptly activates the master control function of self, and portable terminal then is a client mode.Have the synchronous function of major control data this side who is set to server mode, thereby, not only can assign the order of synchrodata, and can assign the data of which kind of form synchronously as main control device as the leading data sync of main control device.
204. earphone is according to the connected mode and the said portable terminal synchrodata of said master slave relation and selection.
Confirmed and the master slave relation of portable terminal according to step 202 and 203 earphones here, can realize and said portable terminal synchrodata through the connected mode of having selected.Such as being connected to example with USB; When earphone during as main control device; Earphone sends the order that locking phase is answered formatted data through usb data alignment portable terminal; The data of this corresponding format can be audio file, address list listing file, short message file, multimedia message files text, picture file, e-mail address file etc.; Portable terminal receives after locking phase that earphone sends answers the order of formatted data according to the usb data line, the formatted data synchronous according to this order request, with earphone through corresponding file in the usb data line locking portable terminal.Be connected to example with bluetooth again; When earphone during as main control device; Earphone connects the order of answering formatted data to portable terminal transmission locking phase through bluetooth; Portable terminal receives after locking phase that earphone sends answers the order of formatted data according to bluetooth, the formatted data synchronous according to this order request, with earphone through corresponding file in the synchronous portable terminal of bluetooth.
This step need to prove that the order of assigning synchrodata can have multiple mode of operation, such as through long button, lack button, repeatedly button, Macintosh, button+certain transducer (like gravity sensing); Also have touch-screen, acoustic control, fingerprint (the corresponding different functions of different mobile terminals) or the like; So not to how realizing that the order of assigning synchrodata does any restriction, those skilled in the art can realize this function according to ordinary skill knowledge of having grasped and above-mentioned explanation to present embodiment fully here.
In this step if earphone and portable terminal when synchrodata, headset detection is to the high connected mode of priority than the connected mode of participation data sync, then earphone interrupts ongoing data sync.Such as when earphone and portable terminal when carrying out data sync with bluetooth; The user is connected earphone with used for mobile terminal usb data line; Promptly between earphone and portable terminal, set up new being connected; This moment, earphone can be analyzed the priority that newly-established USB connects, and when the priority that the priority ratio bluetooth that connects as the USB that finds the participation data sync connects is high, interrupted connecting the data sync of carrying out through bluetooth.Need obtain the master slave relation with said portable terminal this moment again, can realize according to step 202, repeats no more here.Earphone is proceeded data sync according to said master slave relation of obtaining again and detected connected mode from the position and the said portable terminal that interrupt data sync.Proceed data sync with the USB ways of connecting from the position and the said portable terminal that interrupt data sync such as earphone; Wherein proceeding data sync in the interrupt data synchronization position can adopt existing method to realize; Like the mark interruption position, subsequent synchronisation continues not have synchronously the data of completion according to interrupt flag.The benefit of design mainly is in order to realize the data sync of earphone and portable terminal more flexibly, to prevent to cause the problem that can't interrupt the synchronous change connected mode synchronously more slowly because of objective environment like this.
205. earphone storing step 204 earphones and portable terminal data in synchronization.
Being used to store earphone and portable terminal data in synchronization in this step can realize through multiple memory cell on hardware; Such as hard disk, ROM, the SRAM that is added with power supply or regular DRAM that writes again or the like, can also guarantee that like this data of storing can not cause loss of data because of the earphone power down.
Though need to prove present embodiment is the example explanation with earphone as executive agent; But the described method of present embodiment is applicable to portable terminal too; It is identical with earphone that portable terminal is implemented said method as executive agent; So those skilled in the art can realize the data sync of portable terminal and earphone fully according to the implementation method of the said earphone of present embodiment, based on this present embodiment no longer to being that the method for data synchronization of executive agent is done and given unnecessary details with the portable terminal.
Present embodiment is compared advantage with embodiment one and is; Earphone can not only be more accurately confirmed the master slave relation with portable terminal according to the connected mode of selecting; Promptly when activate the synchronous function of major control data, when shield the synchronous function of major control data, and can also store data in synchronization; Greatly facilitating the user exchanges, upgrades, backs up the data in the portable terminal; Particularly can be in synchronous process interrupt synchronously, thereby select the higher connected mode of priority to continue to accomplish data sync, make that the data sync mode between earphone and portable terminal is more flexible and practical according to the access of high priority connected mode more.
Embodiment three
In order better to realize embodiment one, embodiment two described methods, the embodiment of the invention also provides a kind of earphone, and this earphone not only can be used for as the voice stereo set, can also be as a kind of equipment of data sync.As shown in Figure 3; Fig. 3 is the functional block diagram of a kind of earphone of the embodiment of the invention; Said earphone mainly comprises selects linkage unit 301, acquiring unit 302, data synchronisation unit 303, memory cell 304 and speech play unit 305 can also comprise detecting unit 306 and interruption lock unit 307, wherein:
Select linkage unit 301, be used for when earphone has at least two kinds of connected modes to link to each other with portable terminal,, select to participate in the highest connected mode of priority of data sync according to predefined connected mode priority;
Acquiring unit 302 is used for obtaining the master slave relation with said portable terminal according to the connected mode that said selection linkage unit 301 is selected; Also be used for obtaining the master slave relation with said portable terminal again according to detecting unit 306 detected connected modes;
Data synchronisation unit 303 is used for the master slave relation and the said portable terminal synchrodata that get access to according to said acquiring unit 302; The master slave relation and the said detecting unit 306 detected connected modes that also are used for obtaining again according to said acquiring unit 302 are proceeded data sync from said interruption lock unit 307 interrupt data synchronization position and said portable terminal.
Memory cell 304 is used to store data, such as being used to store said data synchronisation unit 303 data in synchronization;
Speech play unit 305 is used for playing the voice document that memory cell 304 or portable terminal are stored;
Detecting unit 306 when master slave relation that is used for getting access to according to said acquiring unit 302 in said data synchronisation unit 303 and said portable terminal synchrodata, detects the high connected mode of priority than the connected mode of participating in data sync; Such as set up new a connection at earphone and portable terminal after, judge the type of this connection through the corresponding host-host protocol that connects, thereby obtain the priority-level of newly-established connection.
Interrupt lock unit 307, be used for when detecting unit 306 detects the high connected mode of priority than the connected mode of participation data sync interrupt data lock unit 303 ongoing data sync.Such as when detecting unit 306 in said data synchronisation unit 303 during with said portable terminal synchrodata; Detect the high connected mode of priority than the connected mode of participating in data sync; Send interrupt instruction to interrupting lock unit 307; Interrupt lock unit 307 and send interrupt signal to data synchronisation unit 303, interrupt data lock unit 303 ongoing data sync according to this instruction.
The described acquiring unit 302 of present embodiment can comprise:
First acquisition module 321 is used for when the connected mode of said selection linkage unit 301 selections is the USB connected mode, obtaining the identity information of said portable terminal; Such as the identity information that obtains portable terminal according to usb protocol.
Active module 322 is used for when identity information that said acquisition module 321 gets access to is flash disk or USB interface or multimedia synchronous protocol equipment, activating the data sync function of master control and said portable terminal;
Receiver module 323 is used to receive the synchrodata message that said portable terminal sends;
Shroud module 324; Be used for when identity information that said acquisition module 321 gets access to is USB interface or multimedia synchronous protocol equipment; The synchronous function of said message screening major control data that receives according to receiver module 323 is so that portable terminal is according to the connected mode master control of selecting and the data sync of earphone.
Second acquisition module 325 is used for when connected mode that said selection linkage unit 301 is selected is the wireless connections mode, obtains the master slave relation with said portable terminal according to the corresponding host-host protocol of said wireless connections mode.According to the syncprofile in the Bluetooth protocol, earphone is set to client mode such as second acquisition module 325, promptly shields the master control function of self, and portable terminal then is defaulted as server mode; Earphone also can carry out mode switch according to the translative mode order that portable terminal is sent, and promptly earphone can be set to server mode after receiving the translative mode order, promptly activates the master control function of self, and portable terminal then is a client mode.Have the synchronous function of major control data this side who is set to server mode, thereby, not only can assign the order of synchrodata, and can assign the data of which kind of form synchronously as main control device as the leading data sync of main control device.
The function that need to prove part unit or intermodule in the present embodiment also can realize through a main control chip; But the logical relation that main control chip realization corresponding function relates to is identical with said units or module; So can not regard this as with present embodiment difference, any hardware capability structure of setting up with present embodiment identity logic relation of relating to is all within protection scope of the present invention.
Present embodiment also provides a kind of portable terminal, and this portable terminal not only can be used for as common communicator, can also be as a kind of equipment of data sync.As shown in Figure 4, Fig. 4 is the functional block diagram of a kind of portable terminal of the embodiment of the invention, and said portable terminal mainly comprises selects linkage unit 401, acquiring unit 402, data synchronisation unit 403,
Select linkage unit 401, be used for when earphone has at least two kinds of connected modes to link to each other with portable terminal,, select to participate in the highest connected mode of priority of data sync according to predefined connected mode priority;
Acquiring unit 402 is used for obtaining the master slave relation with said earphone according to the connected mode that said selection linkage unit is selected;
Data synchronisation unit 403 is used for the master slave relation and the said earphone synchrodata that get access to according to said acquiring unit.
To the explanation of earphone as the equipment of data sync, those skilled in the art can realize in portable terminal according to the explanation of these functional modules fully and the earphone identical functions, this present embodiment is repeated no more at this based on this enforcement.
The advantage of present embodiment is; Present embodiment makes the earphone that provides through the embodiment of the invention not only can have common voice play function through the function structure that data sync is set in can the earphone of compatible portable terminal arbitrarily; And can realize the data sync function with other external moving terminals; As long as the described earphone of present embodiment is linked to each other through the connected mode that any one both sides support; Just can carry out data sync, even the user changes portable terminal or loses portable terminal, as long as the described earphone of present embodiment is still in the data that just can recover in the former portable terminal; So not only greatly facilitate the user and can carry out exchanges data, renewal, backup with portable terminal, also make inter-terminal data convenient synchronously, quick through earphone.Particularly can be in synchronous process interrupt synchronously, thereby select the higher connected mode of priority to continue to accomplish data sync, make that the data sync mode between earphone and portable terminal is more flexible and practical according to the access of high priority connected mode more.Present embodiment also provides a kind of and the portable terminal earphone identical function to this; Make the user can select earphone or portable terminal as the executive agent of data sync arbitrarily, increased the flexibility of between earphone and portable terminal, carrying out data sync greatly according to actual conditions.
The described portable terminal of the foregoing description not only comprises mobile phone, PDA (Personal DigitalAssistant; Personal digital assistant) conventional mobile communication terminal such as; Can also be mobile entertainment terminals such as multimedia player, portable game machine, even can also be the described earphone of present embodiment.
At last; One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Described program can be stored in the computer read/write memory medium, and this program comprises the steps: when carrying out
When earphone had at least two kinds of connected modes to link to each other with portable terminal, said earphone selected to participate in the highest connected mode of priority of data sync according to predefined connected mode priority;
Said earphone obtains the master slave relation with said portable terminal according to the connected mode of selecting;
Said earphone is according to the connected mode and the said portable terminal synchrodata of said master slave relation and selection.
Described storage medium can for, like ROM/RAM, magnetic disc, CD etc.
Certainly, above-described specific embodiment has carried out further explain to the object of the invention, technical scheme and beneficial effect; Institute is understood that; The above is merely specific embodiment of the present invention, and is not used in qualification protection scope of the present invention, and is all within logic of the present invention and principle; Any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.