Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, 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 belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
The embodiment of the invention is a kind of technology of data sync, this technology realizes by earphone, determine 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 determining.
At this, illustrative examples of the present invention and explanation thereof are used to explain the present invention, but not as a limitation of the invention.
Embodiment one
The embodiment of the invention is a kind ofly to carry out the method for data sync by earphone, and as shown in Figure 1, 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 described portable terminal according to the connected mode of selecting;
103. according to the connected mode of described master slave relation and selection, earphone and described 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 carried out of connected mode, wireless transmission can be the transmission of being undertaken by 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 is preferred to participating in the connected mode of 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 described portable terminal.Be example with the earphone such as earlier with earphone and portable terminal by wireless connections, after again earphone and portable terminal are passed through wired connection, because the wired connection mode is than the rank height of wireless connections mode, so earphone finally selects the high wired connection mode of rank to participate in the data sync of described portable terminal in predefined connected mode priority.Wherein the wireless connections of earphone and portable terminal realize by 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 by the usb data line, after connecting earphone and portable terminal by the usb data line, earpiece side receives the level signal of rating number, according to the usb protocol of this level signal and corresponding USB interface correspondence, earphone promptly knows it is the wired connection mode at this moment.
With the different connected modes of portable terminal may be corresponding different master slave relations, wherein said " master " is meant main control device; " from " be meant slave, promptly in corresponding connected mode earphone and portable terminal who do master control equipment, 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 determined according to the host-host protocol of described wireless connections mode correspondence, 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 different situations.When earphone is connected in wired mode with portable terminal, connect such as USB, earphone can obtain the USB device information of portable terminal according to usb protocol, determine 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 described 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), as USB interface etc., earphone can be done slave, after the synchrodata message that receives described portable terminal transmission when earphone, according to the synchronous function of described 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 described portable terminal according to the connected mode of selecting.
Step 103 is according to the connected mode of described master slave relation and selection, and earphone and described portable terminal synchrodata have determined 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 by 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 by 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 understood the exemplary illustration of having done for those skilled in the art; those skilled in the art can make the technological means that realizes identical purpose fully according to the above description; 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.
Earphone and portable terminal all can participate in data sync with the other side as executive agent in the present embodiment, and when not possessing the function of selection connected mode or master slave relation when portable terminal, present embodiment is realized above-mentioned steps by 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 by 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 by earphone or any side of portable terminal, such as determining master slave relation according to data wire when the wired connection, when wireless connections, can be that main principle is determined 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 determining master slave relation with described portable terminal with portable terminal connected mode different, thereby according to the data sync of the master slave relation realization of determining with described portable terminal, so not only greatly facilitate the user and can carry out exchanges data, renewal, backup with portable terminal, also make data sync convenient, quick by earphone.
Embodiment two
Present embodiment is a kind ofly to carry out the method for data sync by earphone, and the executive agent of present embodiment is example with the earphone, and as shown in Figure 2, 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 by 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 described selection is the USB connected mode, changes step 202 over to; When the connected mode of described 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, so when earphone links to each other with portable terminal by multiple connected mode, 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 described portable terminal.When earphone links to each other with portable terminal by 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, because it all is wireless connections that bluetooth is connected with WI-FI, select the highest bluetooth connected mode participation of priority and the data sync of described portable terminal such as earphone.
Need to prove, three kinds of connected modes and priority orders thereof that present embodiment is enumerated herein are exemplary, earphone itself can dispose how different connected modes according to actual needs, and according to the configuration connected mode set in advance priority, rule is set is provided with according to the transmission rate speed of connected mode and the type of connected mode of this priority, thereby make earphone can attempt multiple mode simultaneously and set up suitable being connected with portable terminal according to the demand of actual participation data sync, 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, earphone can triggering selection in this step, 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 described portable terminal, and master slave relation definite according to the identity information that gets access to and described portable terminal.
Because earphone is to connect portable terminal by USB,, will know that promptly what kind of USB device the portable terminal that is attached thereto is herein, thereby whether decision provides power supply for it 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 described 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 described portable terminal is not flash disk, such as being USB interface or multimedia synchronous protocol (Media Transfer Protocol, be called for short MTP) equipment etc., thereby knowing does not need 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 promptly the identity information that obtains described portable terminal when earphone is USB interface or multimedia synchronous protocol equipment, earphone activates the data sync function of master control and described 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 described 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 described earphone default setting of present embodiment.
203. earphone obtains master slave relation with described portable terminal according to the wireless connections mode of selecting.
Earphone mainly is that host-host protocol according to described wireless connections mode correspondence obtains the master slave relation with described portable terminal herein.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 described portable terminal synchrodata of described master slave relation and selection.
Determined and the master slave relation of portable terminal according to step 202 and 203 earphones herein, can realize and described portable terminal synchrodata by 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 by 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 passed through corresponding file in the usb data line locking portable terminal with earphone.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 by 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 passed through corresponding file in the synchronous portable terminal of bluetooth with earphone.
This step need to prove that the order of assigning synchrodata can have multiple mode of operation, such as by long button, lack button, repeatedly button, Macintosh, button+certain transducer (as gravity sensing); Also have touch-screen, acoustic control, fingerprint (functions that different portable terminals is corresponding different) 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 herein.
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, when the priority that the priority ratio bluetooth that connects as the USB that finds the participation data sync connects is high, interrupt connecting the data sync of carrying out by bluetooth.Need obtain the master slave relation with described portable terminal this moment again, can realize according to step 202, repeats no more herein.Earphone is proceeded data sync according to described master slave relation of obtaining again and detected connected mode from the position and the described portable terminal that interrupt data sync.Proceed data sync with the USB ways of connecting from the position and the described portable terminal that interrupt data sync such as earphone, wherein proceeding data sync in the position of interrupting data sync can adopt existing method to realize, as the mark interruption position, subsequent synchronisation continues the synchronous data of not finishing according to interrupt flag.She Ji benefit 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 by 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 described 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 determined 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 the data in the portable terminal, upgrade, backup, particularly can in synchronous process, interrupt synchronously according to the access of higher priority connected mode, thereby select the higher connected mode of priority to continue to finish data sync, make that the data sync mode between earphone and portable terminal is more flexible and practical.
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, described 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 master slave relation with described portable terminal according to the connected mode that described selection linkage unit 301 is selected; Also be used for obtaining master slave relation with described portable terminal again according to detecting unit 306 detected connected modes;
Data synchronisation unit 303 is used for the master slave relation and the described portable terminal synchrodata that get access to according to described acquiring unit 302; The master slave relation and the described detecting unit 306 detected connected modes that also are used for obtaining again according to described acquiring unit 302 are proceeded data sync from position and described portable terminal that described interruption lock unit 307 interrupts data sync.
Memory cell 304 is used to store data, such as being used to store described 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 being used for the master slave relation that gets access to according to described acquiring unit 302 in described data synchronisation unit 303 and described portable terminal synchrodata, detects the high connected mode of priority than the connected mode that participates in data sync; Such as set up new a connection at earphone and portable terminal after, judge the type of this connection by 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 that participates in data sync interruption data synchronisation unit 303 ongoing data sync.Such as when detecting unit 306 in described data synchronisation unit 303 during with described portable terminal synchrodata, detect the high connected mode of priority than the connected mode that participates 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 synchronisation 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 obtaining the identity information of described portable terminal when the connected mode of described selection linkage unit 301 selections is the USB connected mode; Such as the identity information that obtains portable terminal according to usb protocol.
Active module 322 is used for activating the data sync function of master control and described portable terminal when identity information that described acquisition module 321 gets access to is flash disk or USB interface or multimedia synchronous protocol equipment;
Receiver module 323 is used to receive the synchrodata message that described portable terminal sends;
Shroud module 324, be used for when identity information that described acquisition module 321 gets access to is USB interface or multimedia synchronous protocol equipment, the synchronous function of described 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 described selection linkage unit 301 is selected is the wireless connections mode, obtains master slave relation with described portable terminal according to the host-host protocol of described wireless connections mode correspondence.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 in the present embodiment or intermodule also can realize by 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 this can not be regarded as the difference with present embodiment, 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 described 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 master slave relation with described earphone according to the connected mode that described selection linkage unit is selected;
Data synchronisation unit 403 is used for the master slave relation and the described earphone synchrodata that get access to according to described 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 not repeated them here based on this enforcement.
The advantage of present embodiment is, present embodiment makes the earphone that provides by the embodiment of the invention not only can have common voice play function by the function structure that data sync is set in can the earphone of compatible portable terminal arbitrarily, and can realize data sync function with other outside portable terminals, as long as the described earphone of present embodiment is linked to each other by 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 with portable terminal by earphone, upgrade, backup also makes inter-terminal data convenient synchronously, fast.Particularly can in synchronous process, the access according to the higher priority connected mode interrupt synchronously, thereby select the higher connected mode of priority to continue to finish data sync, make that the data sync mode between earphone and portable terminal is more flexible and practical.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 finish by 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, described earphone selected to participate in the highest connected mode of priority of data sync according to predefined connected mode priority;
Described earphone obtains master slave relation with described portable terminal according to the connected mode of selecting;
Described earphone is according to the connected mode and the described portable terminal synchrodata of described master slave relation and selection.
Described storage medium can for, as ROM/RAM, magnetic disc, CD etc.
Certainly; above-described specific embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above is specific embodiments of the invention only, and is not intended to limit the scope of the 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.