Mobile phone time acquisition methods based on bluetooth
Technical field
The present invention relates to a kind of time obtaining methods.It is more particularly related to when a kind of mobile phone based on bluetooth
Between acquisition methods.
Background technique
Now with mobile phone pull out battery after, then be switched on, the time of mobile phone can lose.Cell phone system can obtain network time
(passing through wifi or mobile network), also has plenty of with GPS come acquisition time.If encountering the case where not blocking, without network
In the case where, mobile phone can only be by being manually entered time, poor user experience.Want now through bluetooth (NFC hotnok skill
Art) transmit another mobile phone time, remove manually input from.
Summary of the invention
It is an object of the invention to solve at least the above problems, and provide the advantages of at least will be described later.
It is not required to manually enter the method that can be achieved with mobile phone time acquisition, side it is a still further object of the present invention to provide a kind of
Just the operation of user, further increases user experience.
In order to realize object of the present invention and further advantage, a kind of mobile phone time acquisition side based on bluetooth is provided
Method, be mounted on each mobile phone one can in the mobile phone real-time clock module and bluetooth module carry out answering for both-way communication
With program, comprising the following steps:
Step 1: providing the time to source mobile phone and needing the mobile phone progress Bluetooth pairing of prover time, described in user's triggering
Need the mobile phone time acquisition instruction on the display page of the mobile phone of prover time;
Step 2: application program of the mobile phone time acquisition instruction through installing on the mobile phone for needing prover time is compiled
The bluetooth module of the time offer source mobile phone is sent to after code by the bluetooth module of the mobile phone of the needs prover time, simultaneously
The application program installed on the mobile phone for needing prover time opens timing program module, and the time provides the indigo plant of source mobile phone
After tooth module receives the mobile phone time acquisition instruction, send it to the time provide source mobile phone application program, this when
Between provide the application program of source mobile phone to mobile phone time acquisition instruction decoding after, extract key message therein, and by institute
It states in the time extraction module that key message is sent to be connect with the real-time clock module that the time provides source mobile phone, the time
Extraction module extracts the time and provides current time information in the real-time clock module of source mobile phone, and by the current time information
The application program of time offer source mobile phone is sent to according to preset format, the time provides the application journey of source mobile phone
The current time information is sent to the bluetooth module of the mobile phone for needing prover time, the need by its bluetooth module by sequence
The application program of the mobile phone of prover time is wanted to receive the current time information of its bluetooth module transmission, while described when needing to calibrate
Between mobile phone on the application program installed terminate timing program module, the timing program module, which calculates, to be terminated timing and starts to count
When time difference, and after the time difference is added with the current time received, obtain standard time data this moment, the mark
Data are sent to the real-time clock module of the mobile phone for needing prover time between punctual;
Step 3: the real-time clock module of the mobile phone for needing prover time passes through the standard time data received
Display module is shown on the display page of the mobile phone for needing prover time.
Mobile phone time acquisition instruction is received by the application program installed on each mobile phone, and the time is sent to by bluetooth
Offer source mobile phone obtains current time information, and pass the information on the time to be added to obtain the standard time with the current time of acquisition
Data are eventually displayed on the display page for needing the mobile phone of prover time, and mobile phone can be obtained by realizing to be not required to manually enter
Time, facilitate the operation of user, further raising user experience;Information is added in a calibration process simultaneously in two mobile phones
In passing time so that the standard time data finally obtained is more accurate.
Preferably, in the mobile phone time acquisition methods based on bluetooth, the mobile phone for needing prover time
Being provided with the time on the display page obtains key, user trigger time obtain establish after key the time obtain by
The connection between application program installed on key and the mobile phone for needing prover time.User sends mobile phone time by key
Acquisition instruction, it is more convenient.
Preferably, in the mobile phone time acquisition methods based on bluetooth, user triggers the time acquisition key
Mode are as follows:
The time that time described in user's finger long-pressing obtains key reaches the preset time, is more in line with the behaviour of people
Work is accustomed to.
Preferably, in the mobile phone time acquisition methods based on bluetooth, the preset time is 1~3
Second.
Preferably, the current time letter in the mobile phone time acquisition methods based on bluetooth, in the step 2
After breath is sent to the application program that the time provides source mobile phone according to preset format, the time provides answering for source mobile phone
It is sent to again by its bluetooth module after being encoded current time information according to pre-defined rule with program and described needs prover time
Mobile phone bluetooth module.It is transmitted again after being encoded to current time information, avoids information in transmission process
It loses, and efficiency of transmission is high.
Preferably, in the mobile phone time acquisition methods based on bluetooth, the mobile phone for needing prover time
After application program receives the current time information of its bluetooth module transmission, when obtaining current after being decoded according to pre-defined rule
Between.Current time information is coded and decoded according to pre-defined rule, transmission is improved under the premise of ensuring that information is accurate
Efficiency.
Preferably, preset in the step 2 in the mobile phone time acquisition methods based on bluetooth
Format be time zone-year-month-day-when-point-second or when-point-second-year-month-day-time zone.This format is more in line with looking into for people
See habit.
The present invention is include at least the following beneficial effects: being received mobile phone time by the application program installed on each mobile phone and is obtained
Instruction fetch, and time offer source mobile phone is sent to by bluetooth, then obtain currently by the application program that the time provides source mobile phone
Temporal information, current time information are sent in the application program for needing the mobile phone of prover time again through bluetooth, herein by information
Passing time in the process is added to obtain standard time data with the current time of acquisition, and is eventually displayed in and needs prover time
Mobile phone the display page on, realize be not required to manually enter can obtain mobile phone time, facilitate the operation of user, further
Raising user experience;And can be achieved with the transmission of time data only by bluetooth, network is not needed, transmission limit is reduced
System;Passing time of the information in two mobile phones is added in a calibration process simultaneously, so that finally obtaining standard time data more
It is accurate to add, and confidence level is higher.
Further advantage, target and feature of the invention will be partially reflected by the following instructions, and part will also be by this
The research and practice of invention and be understood by the person skilled in the art.
Detailed description of the invention
Fig. 1 is the flow diagram of the mobile phone time acquisition methods of the invention based on bluetooth.
Specific embodiment
Present invention will be described in further detail below with reference to the accompanying drawings, to enable those skilled in the art referring to specification text
Word can be implemented accordingly.
It should be appreciated that such as " having ", "comprising" and " comprising " term used herein do not allot one or more
The presence or addition of a other elements or combinations thereof.
There is real time clock circuit in the embedded system that mobile phone uses, is responsible for the record of time.By the lithium of mobile phone itself
Battery power supply, will record the time during shutdown, lose the time will not.But if by battery under being unloaded in mobile phone
It is reloaded into after coming, due to occurring not having the case where power supply power supply among real time clock circuit, when being switched on again, the time of mobile phone is just
It can be restored to time setting when mobile phone factory, the time loses, and user is needed to recalibrate input current time again.
The present invention provides a kind of mobile phone time acquisition methods based on bluetooth, one is mounted on each mobile phone can be with
Real-time clock module and bluetooth module in the mobile phone carry out the application program of both-way communication, which, which has, receives instruction
And information, and according to the function of instruction completion corresponding operating, method includes the following steps:
Step 1: opening time provides source mobile phone and needs the bluetooth setting of the mobile phone of prover time, the time source will be provided
Mobile phone and the mobile phone progress Bluetooth pairing for needing prover time, user trigger the display page of the mobile phone for needing prover time
On mobile phone time acquisition instruction, that is, send " please obtain local current time " to corresponding application program.
Step 2: mobile phone time acquisition instruction and application program transmit information in a predetermined manner, the scheduled mode
After can be mobile phone vibration or user's contact mobile phone, application program launching, the mobile phone time acquisition instruction needs school through described
Institute is sent to by the bluetooth module of the mobile phone of the needs prover time after the application code installed on mobile phone between punctual
The bluetooth module for stating time offer source mobile phone, to complete the transmission of instruction, while pacifying on the mobile phone for needing prover time
The application program of dress opens timing program module, calculates the time difference for arriving terminate timing from that point on, i.e., information is in two mobile phones
Between time for transmitting.After the bluetooth module that the time provides source mobile phone receives the mobile phone time acquisition instruction, by it
It is sent to the application program of time offer source mobile phone, the application program which provides source mobile phone obtains the mobile phone time
After instruction decoding, key message therein is extracted, key message is " acquisition time ", and the key message is sent to and is somebody's turn to do
Time is provided in the time extraction module of real-time clock module connection of source mobile phone, and the time extraction module extracts the time and mentions
Current time information in the real-time clock module of supply source mobile phone, and the current time information is sent out according to preset format
It send to the time and the application program of source mobile phone is provided, the application program that the time provides source mobile phone should by its bluetooth module
Current time information is sent to the bluetooth module of the mobile phone for needing prover time, is completed by the mutual communication between bluetooth
The transmitting of temporal information.The application program of the mobile phone for needing prover time receives the current time letter of its bluetooth module transmission
Breath, while the application program installed on the mobile phone for needing prover time terminates timing program module, the timing program mould
Block calculates the time difference for terminating timing and starting timing, obtains information in the mobile phone for needing prover time and time and provides source mobile phone
Between passing time also can therefore cause the inaccuracy of prover time although the time is shorter, and by the time difference with connect
After the current time received is added, standard time data this moment is obtained, the standard time data is sent to the needs
The real-time clock module of the mobile phone of prover time.
Step 3: the real-time clock module of the mobile phone for needing prover time passes through the standard time data received
Display module is shown on the display page of the mobile phone for needing prover time, to obtain accurate current time.
In the mobile phone time acquisition methods based on bluetooth, on the display page of the mobile phone for needing prover time
It is provided with time acquisition key, user establishes the time acquisition key and the need after triggering the time acquisition key
Want the connection between the application program installed on the mobile phone of prover time.It is trigger-type button that time, which obtains key, and user only needs
It clicks or presses.
In the mobile phone time acquisition methods based on bluetooth, user triggers the mode for the time obtaining key are as follows:
The time that time described in user's finger long-pressing obtains key reaches the preset time, with sending time acquisition instruction to time
Offer source mobile phone.
In the mobile phone time acquisition methods based on bluetooth, the preset time is 1~3 second, on the one hand
It reduces because of the case where touching key may send instruction unintentionally, on the other hand adapts to the use habit of user.
In the mobile phone time acquisition methods based on bluetooth, the current time information in the step 2 is according to preparatory
After the format of setting is sent to the application program that the time provides source mobile phone, the application program that the time provides source mobile phone will be worked as
Preceding temporal information is sent to the indigo plant of the mobile phone for needing prover time by its bluetooth module again after encoding according to pre-defined rule
Tooth module.Current time information can be single to reduce according to two bytes or multiple bytes to be encoded after one group of packing
When byte transmission due to quantity it is more caused by omit, while improving efficiency of transmission.
In the mobile phone time acquisition methods based on bluetooth, the application program of the mobile phone for needing prover time is connect
After the current time information for receiving the transmission of its bluetooth module, current time is obtained after being decoded according to pre-defined rule, i.e., according to connecing
The sequencing subpackage grouping of receipts is decoded, and obtains original current time information.
In the mobile phone time acquisition methods based on bluetooth, when the preset format in the step 2 is
Area-year-month-day-when-point-second or when-point-second-year-month-day-time zone, can for 24 hours make, or 12 hours make.
Although the embodiments of the present invention have been disclosed as above, but its is not only in the description and the implementation listed
With it can be fully applied to various fields suitable for the present invention, for those skilled in the art, can be easily
Realize other modification, therefore without departing from the general concept defined in the claims and the equivalent scope, the present invention is simultaneously unlimited
In specific details and legend shown and described herein.