CN107566630A - Data communications method, USB main equipment and storage medium under charged state - Google Patents
Data communications method, USB main equipment and storage medium under charged state Download PDFInfo
- Publication number
- CN107566630A CN107566630A CN201710753315.7A CN201710753315A CN107566630A CN 107566630 A CN107566630 A CN 107566630A CN 201710753315 A CN201710753315 A CN 201710753315A CN 107566630 A CN107566630 A CN 107566630A
- Authority
- CN
- China
- Prior art keywords
- usb
- peripheral hardware
- slave units
- state
- device type
- 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.)
- Pending
Links
Landscapes
- Charge And Discharge Circuits For Batteries Or The Like (AREA)
Abstract
The invention discloses the data communications method under charged state, USB main equipment and storage medium.The device type of each peripheral hardware of connection is obtained in the present invention, when the device type of peripheral hardware includes USB slave units and charging equipment, powering mode is switched into externally fed state by confession electricity condition, electricity condition is confessed to be that USB slave units are powered by USB main equipment, it by charging equipment is that USB slave units are powered that externally fed state, which is, when powering mode is externally fed state, enter row data communication with USB slave units, and charged by charging equipment, to realize that the data under charged state communicate.By switching the suppliers of electricity of USB slave units in the present invention, so that can also enter row data communication with USB slave units in the charge state in USB main equipment, preferably solves the technical problem that can not be realized charging existing for existing electronic equipment simultaneously and enter row data communication with peripheral hardware.
Description
Technical field
The present invention relates to the data communications method under communication field, more particularly to charged state, USB main equipment and storage to be situated between
Matter.
Background technology
As USB (Universal Serial Bus, USB) interface widely uses, using USB interface
Mobile terminal row data communication can be entered by the own USB interface and peripheral hardware, can also pass through the USB interface external charger
Carrying out terminal charge etc., other are operated.
In the data communication aspects with peripheral hardware, USB device can be divided into USB main equipment (USB Host) and USB slave units
(USB Device), USB main equipment can recognize that USB slave units and control USB slave units to enter row data communication, and USB slave units exist
The operation such as response read-write under controlled state, so, it can be interconnected by both USB main equipment and slave unit, to realize data
Read-write.So the smart mobile phone with USB interface can be used as the role of USB main equipment, USB flash drive can be as USB from setting
Standby role.
In peripheral hardware supplier of electricity face, smart mobile phone can be attached by USB interface and charger, to realize for intelligent hand
The charging of machine, it is still, existing when user wishes that smart mobile phone can simultaneously be electrically charged and enter row data communication with USB flash drive
Some smart mobile phones can not realize the collaborative work that charging communicates with data.So existing electronic equipment presence can not be simultaneously
Realize charging and enter the technical problem of row data communication with peripheral hardware.
The content of the invention
It is a primary object of the present invention to provide data communications method, USB main equipment and storage medium under charged state,
Aim to solve the problem that the technical problem that can not be realized charging simultaneously in the prior art and enter row data communication with peripheral hardware.
To achieve the above object, the present invention provides the data communications method under charged state, and methods described includes following step
Suddenly:
USB main equipment obtains the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and charging equipment, by powering mode by confession electricity condition
Externally fed state is switched to, the confession electricity condition is is that the USB slave units are powered by the USB main equipment, institute
Externally fed state is stated to be that the USB slave units are powered by the charging equipment;
When the powering mode is the externally fed state, enter row data communication with the USB slave units, and pass through
The charging equipment is charged, to realize that the data under charged state communicate.
Preferably, before the USB main equipment obtains the device type of each peripheral hardware of connection, methods described also includes:
In response to the preset instructions of user's input, default USB marks are entered as default value;
Correspondingly, after the USB main equipment obtains the device type of each peripheral hardware of connection, methods described also includes:
Judge that the default USB identifies whether to be equal to the default value;
When the default USB marks are equal to the default value, performing the device type in the peripheral hardware includes
When USB slave units and charging equipment, the step of powering mode is switched into externally fed state by confession electricity condition.
Preferably, described to judge that the default USB identifies whether to be equal to after the default value, methods described is also wrapped
Include:
When the default USB marks are not equal to the default value, the connection status with the peripheral hardware is set to off
Closed state.
Preferably, after the USB main equipment obtains the device type of each peripheral hardware of connection, methods described also includes:
When the device type of the peripheral hardware includes the USB slave units and does not include the charging equipment, by mould of powering
Formula is arranged to the confession electricity condition, and returns to the step of USB main equipment obtains the device type of each peripheral hardware connected, directly
To when the device type of the peripheral hardware includes USB slave units and charging equipment, powering mode is cut by the confession electricity condition
It is changed to the externally fed state.
Preferably, after the USB main equipment obtains the device type of each peripheral hardware of connection, methods described also includes:
When the peripheral hardware includes the charging equipment, the charge parameter of the charging equipment is obtained;
Judge the charge parameter whether in preset charged number range;
When the charge parameter is not in preset charged number range, will be set with the connection status of the charging equipment
For closed mode.
Preferably, it is described when the powering mode is the externally fed state, carry out data with the USB slave units
Communication, and charged by the charging equipment, after realizing the communication of the data under charged state, methods described is also wrapped
Include:
Reacquire the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and does not include charging equipment, by powering mode by described
Externally fed state switches to the confession electricity condition, to realize that the data under non-charged state communicate.
Preferably, it is described when the powering mode is the externally fed state, carry out data with the USB slave units
Communication, and charged by the charging equipment, after realizing the communication of the data under charged state, methods described is also wrapped
Include:
Reacquire the device type of each peripheral hardware of connection;
Do not include USB slave units but during including charging equipment in the device type of the peripheral hardware, powering mode is remained
The externally fed state, to ensure the non-stop run of the charging equipment.
In addition, to achieve the above object, the present invention also provides a kind of USB main equipment, and the USB main equipment includes:Storage
Device, processor and be stored on the memory and under the charged state that can be run on the processor data communication journey
Sequence, the step of data communication program under the charged state is arranged for carrying out the data communications method under the charged state.
In addition, to achieve the above object, the present invention also provides a kind of storage medium, and charging is stored with the storage medium
Data communication program under state, described charging is realized when the data communication program under the charged state is executed by processor
The step of data communications method under state.
Supplier of electricity of the invention by switching USB slave units so that in the charge state also can be with USB in USB main equipment
Slave unit enters row data communication, and charging can not be realized simultaneously and enter with peripheral hardware by preferably solving existing for existing electronic equipment
The technical problem of row data communication.Also, realized by the way of being switched over for powering mode, the change to equipment compared with
It is small, also reduce the workload of developer and manufacturer.
Brief description of the drawings
Fig. 1 is the USB main equipment structural representation for the hardware running environment that scheme of the embodiment of the present invention is related to;
Fig. 2 is the schematic flow sheet of the data communications method first embodiment under charged state of the present invention;
Fig. 3 is the schematic flow sheet of the data communications method second embodiment under charged state of the present invention;
Fig. 4 is the schematic flow sheet of the data communications method 3rd embodiment under charged state of the present invention;
Fig. 5 is the schematic flow sheet of the data communications method fourth embodiment under charged state of the present invention.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
Reference picture 1, Fig. 1 are the USB main equipment structural representation for the hardware running environment that scheme of the embodiment of the present invention is related to.
As shown in figure 1, the USB main equipment can include:Processor 1001, such as CPU, communication bus 1002, Yong Hujie
Mouth 1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is used to realize that the connection between these components is led to
Letter.User interface 1003 can include display screen (Display), and optional user interface 1003 can also connect including the wired of standard
Mouth, wave point, the wireline interface for user interface 1003 can be USB interface in the present invention.Network interface 1004 is optional
Wireline interface, the wave point (such as WI-FI interfaces) that can include standard.Memory 1005 can be high-speed RAM memory,
Can also be stable memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally may be used also
To be independently of the storage device of aforementioned processor 1001.
The USB main equipment may be based on the smart mobile phone and tablet personal computer and other electronics of Android (Android) system
Equipment, also, can set USB interface in the USB main equipment, the data between realization and peripheral hardware communicate or charged behaviour
Make.
, can be with it will be understood by those skilled in the art that the structure shown in Fig. 1 does not form the restriction to USB main equipment
Including than illustrating more or less parts, either combining some parts or different parts arrangement.
As shown in figure 1, it can lead to as in a kind of memory 1005 of computer-readable storage medium including operating system, network
Believe the data communication program under module, Subscriber Interface Module SIM and charged state.
In the USB main equipment shown in Fig. 1, network interface 1004 is mainly used in connecting background server, with the backstage
Server enters row data communication;User interface 1003 is mainly used in connecting peripheral hardware, enters row data communication with peripheral hardware or fills power supply behaviour
Make, when it is described it is outer be set to USB flash drive when, when being connected with USB flash drive, row data communication can be entered with USB flash drive, work as institute
When being set to charger or charger baby outside stating, USB main equipment can be charged by charger or charger baby;The USB main equipment is led to
The data communication program crossed in the calling memory 1005 of processor 1001 under the charged state stored, and perform following operate:
Obtain the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and charging equipment, by powering mode by confession electricity condition
Externally fed state is switched to, the confession electricity condition is is that the USB slave units are powered by the USB main equipment, institute
Externally fed state is stated to be that the USB slave units are powered by the charging equipment;
When the powering mode is the externally fed state, enter row data communication with the USB slave units, and pass through
The charging equipment is charged, to realize that the data under charged state communicate.
Further, processor 1001 can call the data communication journey under the charged state stored in memory 1005
Sequence, also perform following operate:
In response to the preset instructions of user's input, default USB marks are entered as default value;
Correspondingly, following operate also is performed:
Judge that the default USB identifies whether to be equal to the default value;
When the default USB marks are equal to the default value, performing the device type in the peripheral hardware includes
When USB slave units and charging equipment, the step of powering mode is switched into externally fed state by confession electricity condition.
Further, processor 1001 can call the data communication journey under the charged state stored in memory 1005
Sequence, also perform following operate:
When the default USB marks are not equal to the default value, the connection status with the peripheral hardware is set to off
Closed state.
Further, processor 1001 can call the data communication journey under the charged state stored in memory 1005
Sequence, also perform following operate:
When the device type of the peripheral hardware includes the USB slave units and does not include the charging equipment, by mould of powering
Formula is arranged to the confession electricity condition, and returns to the step of USB main equipment obtains the device type of each peripheral hardware connected, directly
To when the device type of the peripheral hardware includes USB slave units and charging equipment, powering mode is cut by the confession electricity condition
It is changed to the externally fed state.
Further, processor 1001 can call the data communication journey under the charged state stored in memory 1005
Sequence, also perform following operate:
When the peripheral hardware includes the charging equipment, the charge parameter of the charging equipment is obtained;
Judge the charge parameter whether in preset charged number range;
When the charge parameter is not in preset charged number range, will be set with the connection status of the charging equipment
For closed mode.
Further, processor 1001 can call the data communication journey under the charged state stored in memory 1005
Sequence, also perform following operate:
Reacquire the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and does not include charging equipment, by powering mode by described
Externally fed state switches to the confession electricity condition, to realize that the data under non-charged state communicate.
Further, processor 1001 can call the data communication journey under the charged state stored in memory 1005
Sequence, also perform following operate:
Reacquire the device type of each peripheral hardware of connection;
Do not include USB slave units but during including charging equipment in the device type of the peripheral hardware, powering mode is remained
The externally fed state, to ensure the non-stop run of the charging equipment.
By switching the suppliers of electricity of USB slave units in the present embodiment so that in the charge state also can be with USB main equipment
USB slave units enter row data communication, preferably solve can not be realized simultaneously existing for existing electronic equipment charging and with it is outer
If enter the technical problem of row data communication.Also, the present embodiment is realized by the way of being switched over for powering mode, right
The change of equipment is smaller, also reduces the workload of developer and manufacturer.
Based on above-mentioned hardware configuration, the embodiment of the data communications method under charged state of the present invention is proposed.
Reference picture 2, Fig. 2 are the schematic flow sheet of the data communications method first embodiment under charged state of the present invention.
In the first embodiment, the data communications method under the charged state comprises the following steps:
Step S10:USB main equipment obtains the device type of each peripheral hardware of connection;
It is understood that the USB main equipment can be the smart mobile phone with USB interface, peripheral hardware can pass through USB interface
Physical connection is carried out with smart mobile phone.After USB main equipment is inserted into each peripheral hardware, the device type of each peripheral hardware will be known
Not, in order to the operation according to the device type progress corresponding types identified.
Step S20:When the device type of the peripheral hardware includes USB slave units and charging equipment, by powering mode by certainly
Power supply state switches to externally fed state;
It should be appreciated that described confess electricity condition to be that the USB slave units are powered by the USB main equipment,
It by the charging equipment is that the USB slave units are powered that the externally fed state, which is,.It is each outer for USB main equipment connection
If mode, physical connection can be directly carried out with peripheral hardware by the USB interface of USB main equipment, such as, USB flash drive may act as
USB slave units, are inserted directly into the USB interface of smart mobile phone, enter row data communication with smart mobile phone, it is to be understood that intelligence
Mobile phone is the role that act as USB main equipment.Certainly, also connection can be realized by OTG (On The Go) lines, such as, it can make
Turn two mouthfuls of OTG lines with an a bite, a bite of one end of the OTG lines is connected with USB main equipment, by two mouthfuls points of the other end
Not Lian Jie USB flash drive and charger, the present embodiment is not restricted to this.
In the specific implementation, when it is USB flash drive and charger that smart mobile phone, which identifies the device type of peripheral hardware, in order to
Realize that smart mobile phone also reads and writes data from USB flash drive while charger can charge to smart mobile phone, will power
Pattern switches to externally fed state by confession electricity condition, the confession electricity condition be by the USB main equipment be the USB from
Equipment is powered, and it by the charging equipment is that the USB slave units are powered that the externally fed state, which is,.So it is
The collaborative work of charger and USB flash drive is realized, it is necessary to solve the powerup issue of USB flash disk, because USB flash disk is passive device,
Read and write from USB flash disk before data, will first realize the power supply for USB flash disk.
It is understood that initial setting up is is that the USB slave units are powered by the USB main equipment, i.e., it is intelligent
The powering mode of mobile phone is arranged to confess electricity condition.Because preferable user's usage scenario is only connects USB flash drive, now,
Powered by smart mobile phone for USB flash drive, you can realization communicates with the data of USB flash drive.When user accesses USB flash memory simultaneously
When disk and charger, powering mode can be switched to externally fed state by confession electricity condition, because, for existing intelligent hand
For machine, in that case, smart mobile phone can not be realized to communicate with the data of USB flash drive, smart mobile phone can not judge by
Smart mobile phone or charger are powered for USB flash drive, and even, in that case, existing smart mobile phone is possible can neither
The data that can not be read in USB flash drive are electrically charged, the present embodiment is preferable by setting the automatically switching operation of powering mode
Ground solves the problems, such as the collaborative work of above two peripheral hardware.
Certainly, described the step of being powered for USB slave units, when actually realizing, can behave as predetermined voltage threshold
Boost operations.Also, the confession electricity condition is identical with the numerical value of the boosting parameter in the externally fed state, can be preferable
Ground extends the service life of USB flash drive, meanwhile, processing boosting compatibility side can also be reduced by unified predetermined voltage threshold
The workload in face, wherein, the boosting parameter is used to carry out the USB main equipment boosting under predetermined voltage threshold.Such as
Predetermined voltage threshold can be arranged to 5V, by USB main equipment be USB slave units be powered or by charging equipment be USB from
When equipment is powered, in fact, being that USB flash drive provides 5V boostings all for USB slave units, stably read and write with realizing
Data in USB slave units,
Step S30:When the powering mode is the externally fed state, carries out data with the USB slave units and lead to
Letter, and charged by the charging equipment, to realize that the data under charged state communicate.
It is understood that when the powering mode is the externally fed state, also indicates that and determine USB from setting
Standby supplier of electricity so that USB slave units can be with normal use.On the premise of it ensure that USB slave units can be with normal use, just
Smart mobile phone can be allowed to enter row data communication with the USB slave units, the data in USB slave units are read out or write, meanwhile,
Also smart mobile phone can be charged by charger, is also achieved that the i.e. chargeable effect that can also enter row data communication of smart mobile phone
Fruit.Also, the mode that the present embodiment is taken, the change for smart mobile phone is smaller, provided by the boosting for USB slave units
Side switches over, and preferably realizes the collaborative work of two kinds of functions.
By switching the suppliers of electricity of USB slave units in the present embodiment so that in the charge state also can be with USB main equipment
USB slave units enter row data communication, preferably solve can not be realized simultaneously existing for existing electronic equipment charging and with it is outer
If enter the technical problem of row data communication.Also, the present embodiment is realized by the way of being switched over for powering mode, right
The change of equipment is smaller, also reduces the workload of developer and manufacturer.
Reference picture 3, Fig. 3 be charged state of the present invention under data communications method second embodiment schematic flow sheet, base
In the embodiment shown in above-mentioned Fig. 2, the second embodiment of the data communications method under charged state of the present invention is proposed.
In a second embodiment, before the step S10, methods described also includes:
Step S10':In response to the preset instructions of user's input, default USB marks are entered as default value;
It is understood that function selection is carried out for the ease of user, can be by setting default USB marks, so that user
It can voluntarily choose whether that USB main equipment is arranged into charging communicates the equipment that can run simultaneously with data.For example if USB master sets
Standby is Android mobile phone, and a Host_devices option can be set, and user can manually adjust Host_devices options
It is turned on and off, to decide whether to use the function of " USB main equipment is arranged into charging to communicate and can run with data " simultaneously.
In the specific implementation, when user on smart mobile phone by Host_devices options selection be opening when, change
Yan Zhi, the operation behavior of user will generate a preset instructions on smart mobile phone, and the preset instructions are used in Android system
It is middle to be notified to carry out the switching of variable and assignment, default USB marks are entered as default value.Default USB, which is identified, to be used for
Show the functional status of Host_devices options, may be to be turned on and off, the tool that default value is turned on and off for statement
Body numerical value.For example when user is operable to open Host_devices options, default value can be 1, and default USB is identified
It is entered as 1.
After the step S10, methods described also includes:
Step S10 ":Judge that the default USB identifies whether to be equal to the default value;
It should be appreciated that user can pre-define in Android system before using smart mobile phone and work as Host_
Default USB is identified as 1 when devices options are opened.So after smart mobile phone is inserted into peripheral hardware, the default USB will determine that
Identify whether to be equal to 1.
Step S20':Include USB equal to the device type of the default value and the peripheral hardware in the default USB marks
When slave unit and charging equipment, powering mode is switched into externally fed state by confession electricity condition.
It is understood that when the default USB marks are equal to the default value, Host_devices choosings will be opened
The function of item, i.e., step S20' and step S30 is performed successively, the supplier of electricity of USB slave units is switched over realizing.Certainly,
In order to avoid maloperation, it can be sent to user and " Host_ be set when identifying while inserting charger with USB flash drive
The prompting message of devices options ", to avoid user from not carrying out setting for Host_devices options when inserting two kinds of peripheral hardwares
Put, long-term damage is caused to smart mobile phone and peripheral hardware.
When the default USB marks are not equal to the default value, the connection status with the peripheral hardware is set to off
Closed state.
In the specific implementation, in view of user's unrestricted choice can be allowed whether to use Host_devices options, there is provided pair
In the judgment step of default USB marks, so, when the default USB marks are not equal to the default value, represent, user
Not open Host_devices options, for protection equipment, the connection with each peripheral hardware can be disconnected, play protection smart mobile phone and
The effect of peripheral hardware.
By setting a Host_devices option in the present embodiment, user is allowed to decide in its sole discretion whether to open and " make USB master
Equipment can in the charge state simultaneously enter row data communication " function.
Reference picture 4, Fig. 4 be charged state of the present invention under data communications method 3rd embodiment schematic flow sheet, base
In the embodiment shown in above-mentioned Fig. 2, the 3rd embodiment of the data communications method under charged state of the present invention is proposed.
In the third embodiment, after the step S10, methods described also includes:
Step S20 ":When the device type of the peripheral hardware includes the USB slave units and does not include the charging equipment,
Powering mode is arranged to the confession electricity condition.
It is understood that when having USB slave units in the peripheral hardware that USB main equipment identifies connection without charging equipment
When, USB main equipment can then use the powering mode of acquiescence and USB slave units to enter row data communication.
In the specific implementation, the powering mode of the acquiescence refer to confess electricity condition, i.e., be directly by the USB main equipment
The USB slave units are powered.Such as when smart mobile phone need to carry out data interaction with USB flash drive, will be by smart mobile phone
Boosting is provided for USB flash drive, to ensure that USB flash drive can normally carry out write-in and the read operation of data.
After step S20 ", step S10 is performed.
It should be appreciated that it may need in the midway using USB flash drive to be inserted into charger in view of user, with reality
The collaborative work of existing USB flash drive and charger, also just needs smart mobile phone to be powered the automatic switchover of pattern, convenient
The use of user.So after step S20', it will continue cycling through and detect whether and insert charger.
Until when the device type of the peripheral hardware includes USB slave units and charging equipment, step S20 is performed.
In the specific implementation, when cycle detection to again insert charger when, that is, meet " the device type of the peripheral hardware
Including USB slave units and charging equipment " condition, to perform step S20, be also achieved that when cycle detection and detect to insert
The device type of peripheral hardware when meeting switching condition, smart mobile phone will be powered the switching of pattern automatically, and facilitating user makes
Use peripheral hardware.Also, avoid user needs voluntarily to go to switch powering mode in the midway using peripheral hardware.
In order to meet that user can continue into charging equipment in the midway using USB slave units in the present embodiment, and
The use of USB slave units is had no effect on, by carrying out cycle detection to device type, realizes the automatic switchover of powering mode,
Voluntarily switch without user, also ensure that the normal use of existing peripheral hardware.
Reference picture 5, Fig. 5 be charged state of the present invention under data communications method fourth embodiment schematic flow sheet, base
In the embodiment shown in above-mentioned Fig. 2, the fourth embodiment of the data communications method under charged state of the present invention is proposed.
In the fourth embodiment, after step S10, methods described also includes:
Step S20 " ':When the peripheral hardware includes the charging equipment, the charge parameter of the charging equipment is obtained;
It is understood that in order to carry out voltage x current protection to USB main equipment, can be by identifying filling for charging equipment
Electrical parameter, to realize that the charging to charging equipment blocks.
Step S30 ":Judge the charge parameter whether in preset charged number range;
In the specific implementation, in order to realize that the charging for charging equipment blocks, each of connection can be obtained in USB main equipment
During the device type of peripheral hardware, whether include charging equipment in the device type identified, i.e., whether be connected with and fill on smart mobile phone
Electrical equipment or charger baby, for whether including other peripheral hardwares, the present embodiment is not restricted to this.If charging is connected with smart mobile phone
Device, then the charge parameter of charger is obtained, such as, the charge parameter of charger is 5.1V/2.1A.Will determine that the charge parameter is
It is no in preset charged number range, the preset charged number range refers to consider that charging safety and USB main equipment make
With requirement of the life-span for the charge parameter of charging equipment.
Step S40 ":When the charge parameter is not in preset charged number range, by the company with the charging equipment
The state of connecing is set to off closed state.
If it is understood that preset charged number range include voltage need to be in the range of 4.5V to 6V, electric current need to be
In the range of 1.5A to 2.5A, and when the charge parameter of charger is 5.1V/2.1A, charge parameter is i.e. in preset charged numerical value
In the range of when, then be normally carried out charging operations;And when the charge parameter is not in preset charged number range, will be switched off with
The connection of charger, closed state will be set to off with the connection status of the charging equipment, prevent substandard charger
Charge loss is caused to smart mobile phone.
Further, when smart mobile phone is connected with charger with USB flash drive simultaneously, if being broken using midway charger
Open, in order to maintain user to be continuing with the stability of USB flash drive, described in the powering mode is the externally fed state
When, enter row data communication with the USB slave units, and charged by the charging equipment, to realize under charged state
After data communication, the device type of each peripheral hardware of connection is reacquired, includes USB slave units in the device type of the peripheral hardware
And when not including charging equipment, powering mode is switched into the confession electricity condition by the externally fed state, it is non-to realize
Data communication under charged state.
In the specific implementation, by powering mode during by identifying that the connection existing USB flash drive of peripheral hardware has charger again
Externally fed state is arranged to, and in order to avoid midway disconnection occurs with charger, and the use of USB flash drive is influenceed, can be right
The peripheral hardware of smart mobile phone connection carries out cycle detection, so that proper identify that device type includes USB slave units and do not include filling
During electric equipment, i.e., the disconnection of charger midway when, powering mode is switched into the confession electricity condition by the externally fed state,
To realize that the data under non-charged state communicate.Because after charger disconnects, charger can not be that USB flash drive supplies
Electricity, i.e., USB flash drive can not be boosted, normal reading write operation, institute cannot be also carried out to USB flash drive
Will switch to confession electricity condition, be boosted by smart mobile phone for USB flash drive, also just reached the non-charged state of recurrence and protected
Demonstrate,prove the effect of the stability of the data communication of midway.
Further, correspondingly, in order to avoid causing the shadow used for other equipment after the midway disconnection of USB slave units
Ring, it is described when the powering mode is the externally fed state, enter row data communication with the USB slave units, and pass through
The charging equipment is charged, and after realizing the communication of data under charged state, each peripheral hardware for reacquiring connection is set
Standby type, do not include USB slave units in the device type of the peripheral hardware but during including charging equipment, powering mode is remained into institute
Externally fed state is stated, to ensure the non-stop run of the charging equipment.
It is understood that after being arranged to externally fed state and being powered operation, if midway USB flash drive disconnects
Connection, i.e., the device type of described peripheral hardware does not include USB slave units but including charging equipment, in order to ensure smart mobile phone by charging
Device carries out stable power-supplying, and powering mode is remained into the externally fed state, is also achieved that by charger to smart mobile phone
Uninterrupted power supply.Because existing smart mobile phone can not support charger and USB flash drive simultaneously while work, also,
Can not processing equipment disconnect after powering mode offering question.
By pre-setting preset charged number range in the present embodiment, will regard as to USB main equipment exist safety or
The charging equipment of larger charge loss problem, is blocked automatically, to extend the service life of USB main equipment, also improves user
Use the security of electronic equipment.
In addition, the embodiment of the present invention also proposes a kind of storage medium, it is stored with the storage medium under charged state
Data communication program, following operation is realized when the data communication program under the charged state is executed by processor:
USB main equipment obtains the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and charging equipment, by powering mode by confession electricity condition
Externally fed state is switched to, the confession electricity condition is is that the USB slave units are powered by the USB main equipment, institute
Externally fed state is stated to be that the USB slave units are powered by the charging equipment;
When the powering mode is the externally fed state, enter row data communication with the USB slave units, and pass through
The charging equipment is charged, to realize that the data under charged state communicate.
Further, following operation is also realized when the data communication program under the charged state is executed by processor:
In response to the preset instructions of user's input, default USB marks are entered as default value;
Correspondingly, following operation is also realized:
Judge that the default USB identifies whether to be equal to the default value;
When the default USB marks are equal to the default value, performing the device type in the peripheral hardware includes
When USB slave units and charging equipment, the step of powering mode is switched into externally fed state by confession electricity condition.
Further, following operation is also realized when the data communication program under the charged state is executed by processor:
When the default USB marks are not equal to the default value, the connection status with the peripheral hardware is set to off
Closed state.
Further, following operation is also realized when the data communication program under the charged state is executed by processor:
When the device type of the peripheral hardware includes the USB slave units and does not include the charging equipment, by mould of powering
Formula is arranged to the confession electricity condition, and returns to the step of USB main equipment obtains the device type of each peripheral hardware connected, directly
To when the device type of the peripheral hardware includes USB slave units and charging equipment, powering mode is cut by the confession electricity condition
It is changed to the externally fed state.
Further, following operation is also realized when the data communication program under the charged state is executed by processor:
When the peripheral hardware includes the charging equipment, the charge parameter of the charging equipment is obtained;
Judge the charge parameter whether in preset charged number range;
When the charge parameter is not in preset charged number range, will be set with the connection status of the charging equipment
For closed mode.
Further, following operation is also realized when the data communication program under the charged state is executed by processor:
Reacquire the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and does not include charging equipment, by powering mode by described
Externally fed state switches to the confession electricity condition, to realize that the data under non-charged state communicate.
Further, following operation is also realized when the data communication program under the charged state is executed by processor:
Reacquire the device type of each peripheral hardware of connection;
Do not include USB slave units but during including charging equipment in the device type of the peripheral hardware, powering mode is remained
The externally fed state, to ensure the non-stop run of the charging equipment.
The present embodiment is by switching the suppliers of electricity of USB slave units so that in the charge state also can be with USB main equipment
USB slave units enter row data communication, preferably solve can not be realized simultaneously existing for existing electronic equipment charging and with it is outer
If enter the technical problem of row data communication.Also, realized by the way of being switched over for powering mode, equipment is changed
It is dynamic smaller, also reduce the workload of developer and manufacturer.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row
His property includes, so that process, method, article or system including a series of elements not only include those key elements, and
And also include the other element being not expressly set out, or also include for this process, method, article or system institute inherently
Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this
Other identical element also be present in the process of key element, method, article or system.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on such understanding, technical scheme is substantially done to prior art in other words
Going out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage medium
In (such as ROM/RAM, magnetic disc, CD), including some instructions to cause a station terminal equipment (can be mobile phone, computer, clothes
Be engaged in device, air conditioner, or network equipment etc.) perform method described in each embodiment of the present invention.
The preferred embodiments of the present invention are these are only, are not intended to limit the scope of the invention, it is every to utilize this hair
The equivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skills
Art field, is included within the scope of the present invention.
Claims (10)
1. the data communications method under a kind of charged state, it is characterised in that the described method comprises the following steps:
USB main equipment obtains the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and charging equipment, powering mode is switched by confession electricity condition
It is described outer to be that the USB slave units are powered by the USB main equipment for externally fed state, the confession electricity condition
It by the charging equipment is that the USB slave units are powered that portion's power supply state, which is,;
When the powering mode is the externally fed state, enter row data communication with the USB slave units, and by described
Charging equipment is charged, to realize that the data under charged state communicate.
2. the method as described in claim 1, it is characterised in that the USB main equipment obtains the equipment class of each peripheral hardware of connection
Before type, methods described also includes:
In response to the preset instructions of user's input, default USB marks are entered as default value;
Correspondingly, after the USB main equipment obtains the device type of each peripheral hardware of connection, methods described also includes:
Judge that the default USB identifies whether to be equal to the default value;
When the default USB mark is equal to the default value, perform the device type in the peripheral hardware including USB from
When equipment and charging equipment, the step of powering mode is switched into externally fed state by confession electricity condition.
3. method as claimed in claim 2, it is characterised in that described to judge that the default USB is identified whether equal to described pre-
If after numerical value, methods described also includes:
When the default USB marks are not equal to the default value, the connection status with the peripheral hardware is set off shape
State.
4. the method as described in claim 1, it is characterised in that the USB main equipment obtains the equipment class of each peripheral hardware of connection
After type, methods described also includes:
When the device type of the peripheral hardware includes the USB slave units and does not include the charging equipment, powering mode is set
The step of being set to the confession electricity condition, and returning to the device type for each peripheral hardware that the USB main equipment obtains connection, until
When the device type of the peripheral hardware includes USB slave units and charging equipment, powering mode is switched to by the confession electricity condition
The externally fed state.
5. the method as described in any one of Claims 1-4, it is characterised in that the USB main equipment obtains each of connection
After the device type of peripheral hardware, methods described also includes:
When the peripheral hardware includes the charging equipment, the charge parameter of the charging equipment is obtained;
Judge the charge parameter whether in preset charged number range;
When the charge parameter is not in preset charged number range, the connection status with the charging equipment is set to off
Closed state.
6. the method as described in any one of Claims 1-4, it is characterised in that described in the powering mode is described
During externally fed state, enter row data communication with the USB slave units, and charged by the charging equipment, to realize
After data communication under charged state, methods described also includes:
Reacquire the device type of each peripheral hardware of connection;
When the device type of the peripheral hardware includes USB slave units and does not include charging equipment, by powering mode by the outside
Power supply state switches to the confession electricity condition, to realize that the data under non-charged state communicate.
7. the method as described in any one of Claims 1-4, it is characterised in that described in the powering mode is described
During externally fed state, enter row data communication with the USB slave units, and charged by the charging equipment, to realize
After data communication under charged state, methods described also includes:
Reacquire the device type of each peripheral hardware of connection;
Do not include USB slave units but during including charging equipment in the device type of the peripheral hardware, powering mode is remained described in
Externally fed state, to ensure the non-stop run of the charging equipment.
8. the method as described in any one of Claims 1-4, it is characterised in that the confession electricity condition and the outside
The numerical value of boosting parameter in power supply state is identical, and the boosting parameter is used to carry out predeterminated voltage threshold to the USB main equipment
Boosting under value.
9. a kind of USB main equipment, it is characterised in that the USB main equipment includes:Memory, processor and it is stored in described deposit
Data communication program on reservoir and under the charged state that can run on the processor, the data under the charged state are led to
Believe that program is communicated by the data under charged state of the realization as any one of claim 1 to 8 during the computing device
The step of method.
A kind of 10. storage medium, it is characterised in that the data communication program being stored with the storage medium under charged state,
Filling as any one of claim 1 to 8 is realized when data communication program under the charged state is executed by processor
The step of data communications method under electricity condition.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710753315.7A CN107566630A (en) | 2017-08-25 | 2017-08-25 | Data communications method, USB main equipment and storage medium under charged state |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710753315.7A CN107566630A (en) | 2017-08-25 | 2017-08-25 | Data communications method, USB main equipment and storage medium under charged state |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107566630A true CN107566630A (en) | 2018-01-09 |
Family
ID=60977255
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710753315.7A Pending CN107566630A (en) | 2017-08-25 | 2017-08-25 | Data communications method, USB main equipment and storage medium under charged state |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107566630A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110262648A (en) * | 2019-05-15 | 2019-09-20 | 深圳市优博讯科技股份有限公司 | Master device functionality and the parallel method of charge function and hand-held data gathering terminal |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWM288990U (en) * | 2005-11-08 | 2006-03-21 | Cal Comp Electronics & Comm Co | Function-switchable connection device |
WO2008038057A1 (en) * | 2006-09-26 | 2008-04-03 | Nokia Corporation | Method and device for activating functions of a powered-off device via a serial data bus interface |
CN102156524A (en) * | 2011-02-11 | 2011-08-17 | 威盛电子股份有限公司 | Adaptive universal serial bus charging method and system |
CN103176938A (en) * | 2011-12-26 | 2013-06-26 | 三星电子株式会社 | Universal serial bus host and power management method thereof |
CN203324980U (en) * | 2013-05-22 | 2013-12-04 | 北京互基科技发展有限公司 | Intelligently-switched chargeable USB HUB device used in cooperation with notebook computer power adapter |
CN103793037A (en) * | 2012-10-31 | 2014-05-14 | 汤姆逊许可公司 | Device and method for electric power management of a plurality of peripheral interfaces |
CN104111908A (en) * | 2014-07-04 | 2014-10-22 | 深圳市江波龙电子有限公司 | USB device, working system, working mode conversion method and data communication method |
CN104239240A (en) * | 2013-06-11 | 2014-12-24 | 鸿富锦精密工业(深圳)有限公司 | Electronic device with universal serial bus (USB) interface with integration function |
CN204243832U (en) * | 2014-12-05 | 2015-04-01 | 重庆蓝岸通讯技术有限公司 | A kind of charging and output compatible multiplex roles charging circuit |
CN104638732A (en) * | 2015-03-03 | 2015-05-20 | 上海创远仪器技术股份有限公司 | System with external equipment accessing and battery charging management functions, and method thereof |
CN104778140A (en) * | 2014-01-15 | 2015-07-15 | 深圳市可橙科技有限公司 | USB (Universal Serial Bus) automatic identification and conduction system of star-shaped framework and method thereof |
WO2017083418A1 (en) * | 2015-11-09 | 2017-05-18 | Nexvidea Inc. | Methods and systems for recording, producing and transmitting video and audio content |
-
2017
- 2017-08-25 CN CN201710753315.7A patent/CN107566630A/en active Pending
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWM288990U (en) * | 2005-11-08 | 2006-03-21 | Cal Comp Electronics & Comm Co | Function-switchable connection device |
WO2008038057A1 (en) * | 2006-09-26 | 2008-04-03 | Nokia Corporation | Method and device for activating functions of a powered-off device via a serial data bus interface |
CN102156524A (en) * | 2011-02-11 | 2011-08-17 | 威盛电子股份有限公司 | Adaptive universal serial bus charging method and system |
CN103176938A (en) * | 2011-12-26 | 2013-06-26 | 三星电子株式会社 | Universal serial bus host and power management method thereof |
CN103793037A (en) * | 2012-10-31 | 2014-05-14 | 汤姆逊许可公司 | Device and method for electric power management of a plurality of peripheral interfaces |
CN203324980U (en) * | 2013-05-22 | 2013-12-04 | 北京互基科技发展有限公司 | Intelligently-switched chargeable USB HUB device used in cooperation with notebook computer power adapter |
CN104239240A (en) * | 2013-06-11 | 2014-12-24 | 鸿富锦精密工业(深圳)有限公司 | Electronic device with universal serial bus (USB) interface with integration function |
CN104778140A (en) * | 2014-01-15 | 2015-07-15 | 深圳市可橙科技有限公司 | USB (Universal Serial Bus) automatic identification and conduction system of star-shaped framework and method thereof |
CN104111908A (en) * | 2014-07-04 | 2014-10-22 | 深圳市江波龙电子有限公司 | USB device, working system, working mode conversion method and data communication method |
CN204243832U (en) * | 2014-12-05 | 2015-04-01 | 重庆蓝岸通讯技术有限公司 | A kind of charging and output compatible multiplex roles charging circuit |
CN104638732A (en) * | 2015-03-03 | 2015-05-20 | 上海创远仪器技术股份有限公司 | System with external equipment accessing and battery charging management functions, and method thereof |
WO2017083418A1 (en) * | 2015-11-09 | 2017-05-18 | Nexvidea Inc. | Methods and systems for recording, producing and transmitting video and audio content |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110262648A (en) * | 2019-05-15 | 2019-09-20 | 深圳市优博讯科技股份有限公司 | Master device functionality and the parallel method of charge function and hand-held data gathering terminal |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3312969B1 (en) | Charging method and electronic devices | |
CN105375549B (en) | For controlling the method, system and battery of battery status | |
CN103744821B (en) | Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal | |
CN103425506B (en) | Closedown method and starting-up method and communication terminal | |
CN105896655B (en) | Method for charging for electronic equipment and electronic equipment | |
US8692520B2 (en) | Method and system for optimizing current limiting behavior of charger | |
EP2629173A2 (en) | Method and system for powering usb device | |
CN101853970A (en) | Method and device for charging through universal serial bus (USB) interface | |
CN105932733B (en) | OTG power supply and its method of supplying power to, OTG equipment and mobile communication equipment | |
CN109921481A (en) | To the OTG equipment and method of supplying power to of communication object power supply when USB is communicated | |
CN106329627A (en) | Charging method and device | |
CN106602663A (en) | Combined intelligent device charging and mutual charging device and charging method | |
CN106532795A (en) | Terminal usb interface setting method and terminal | |
CN102593930A (en) | Charging system of mobile terminal | |
CN105576753A (en) | Information processing method and electronic equipment | |
CN106230070A (en) | A kind of charging method and device | |
KR101390402B1 (en) | Power sharing apparatus and system using power sharing program installed in mobile terminal | |
CN106329630A (en) | Charging method and device | |
CN204205673U (en) | A kind of automobile USB charging device | |
CN107566630A (en) | Data communications method, USB main equipment and storage medium under charged state | |
CN107437828B (en) | Charging method, device and equipment | |
CN108683236A (en) | A kind of mobile terminal OTG charging methods and device | |
CN101697100A (en) | Mouse device and wireless network access method | |
CN111327087B (en) | Electronic equipment and charging method thereof | |
US10481576B2 (en) | Method and device for implementing connection control |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
AD01 | Patent right deemed abandoned | ||
AD01 | Patent right deemed abandoned |
Effective date of abandoning: 20210312 |