CN109165182A - The means of communication and device - Google Patents

The means of communication and device Download PDF

Info

Publication number
CN109165182A
CN109165182A CN201810893151.2A CN201810893151A CN109165182A CN 109165182 A CN109165182 A CN 109165182A CN 201810893151 A CN201810893151 A CN 201810893151A CN 109165182 A CN109165182 A CN 109165182A
Authority
CN
China
Prior art keywords
communication interface
external command
target
lock
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810893151.2A
Other languages
Chinese (zh)
Other versions
CN109165182B (en
Inventor
李登峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Science And Technology (beijing) Co Ltd Rong'an
Original Assignee
China Science And Technology (beijing) Co Ltd Rong'an
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Science And Technology (beijing) Co Ltd Rong'an filed Critical China Science And Technology (beijing) Co Ltd Rong'an
Priority to CN201810893151.2A priority Critical patent/CN109165182B/en
Publication of CN109165182A publication Critical patent/CN109165182A/en
Application granted granted Critical
Publication of CN109165182B publication Critical patent/CN109165182B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling

Abstract

The present invention provides a kind of means of communication and devices, this method comprises: determining the first object communication interface for receiving the first external command in multiple communication interfaces according to the default arrangement that puts in order;If there is the second target communication interface being in the lock state, the connection of keep in communication device and first object communication interface in multiple communication interfaces;In response to the first external command, it will indicate that the preset instructions that there is locked communication interface are sent to first object communication interface;If detecting, the state of the second target communication interface switches to unlocked state, then since the first communication interface being arranged in after the last communication interface responded, whether external command is received according to the default multiple communication interfaces of cyclic polling that put in order, until being polled to the third target communication interface for receiving external command;Business processing is carried out to the external command of third target communication interface.Communication device of the invention can connect simultaneously various communication interfaces and be communicated when being communicated with host computer.

Description

The means of communication and device
Technical field
The present invention relates to mobile internet technical fields, more particularly to a kind of means of communication and device.
Background technique
Currently, with the rapid development of mobile Internet, the type of transaction of mobile terminal is also more and more, in order to ensure moving The safety of dynamic transaction, has currently derived many key products, such as USBkey, bluetooth Key, audio Key etc..
Wherein, for bluetooth Key and audio Key is compared to USBkey, in addition to supporting to connect by USB and host computer communication It connects, also supports the mode and host computer communication connection of bluetooth and audio.So-called host computer is the electricity for using the key product Sub- equipment, for example, mobile terminal (including but not limited to mobile phone, tablet computer) and terminal (including but not limited to PC (PC, Personal computer)) etc..
Although above-mentioned key product be provided with various communication interfaces, such as bluetooth Key communication interface include USB interface and Blue tooth interface.And in actual use, user can only select a use from above-mentioned communication interface.Specifically, inventor It finds in the implementation of the present invention, when user is using the USB interface of bluetooth Key insertion PC, to the business progress on PC When Communication processing, the blue tooth interface of bluetooth Key is disabled, and user is not available bluetooth Key and passes through blue tooth interface and PC Or other mobile terminals carry out bluetooth connection, to carry out bluetooth communication.
Therefore, for the key product in traditional technology when being communicated, there is can not connect various communication interfaces simultaneously The problem of carrying out information communication.
Summary of the invention
The present invention provides a kind of means of communication and device, with solve the communication device in traditional technology with host computer into When row communication, the problem of various communication interfaces are communicated can not be connected simultaneously.
To solve the above-mentioned problems, according to an aspect of the present invention, the invention discloses a kind of means of communication, it is applied to Communication device, which comprises
Determine the first object that the first external command is received in multiple communication interfaces according to the default arrangement that puts in order Communication interface;
If there is the second target communication interface being in the lock state in the multiple communication interface, the communication is kept The connection of device and the first object communication interface, wherein the first object communication interface and second target communication Interface is different;
In response to first external command, it will indicate that the preset instructions that there is locked communication interface are sent to described the One target communication interface;
If detecting, the state of the second target communication interface switches to unlocked state, from being arranged in the last quilt First communication interface after the communication interface of response starts, according to the default the multiple communication of cyclic polling that puts in order Whether interface receives external command, until be polled to the third target communication interface for receiving external command, wherein described the Three target communication interfaces are any one in the multiple communication interface;
Business processing is carried out to the external command of the third target communication interface.
Optionally, the first external command is received in multiple communication interfaces of the determination according to the default arrangement that puts in order First object communication interface, comprising:
After the external command in response to a communication interface, the multiple communication interfaces of poll are determined according to default row Arrange the first object communication interface that the first external command is received in tactic the multiple communication interface.
Optionally, described after the external command in response to a communication interface, the multiple communication interfaces of poll determine The first object communication interface of the first external command is received in the multiple communication interface according to the default arrangement that puts in order, Include:
After the external command in response to a communication interface, determine according to the multiple logical of the default arrangement that puts in order The communication interface that the last time is responded in communication interface is first logical after being arranged in the last communication interface responded Communication interface starts, and whether receives external command according to the default the multiple communication interface of cyclic polling that puts in order, directly To being polled to the first object communication interface for receiving the first external command.
Optionally, if the state for detecting the second target communication interface switches to unlocked state, from arrangement First communication interface after the communication interface that the last time is responded starts, according to the default cyclic polling that puts in order Whether the multiple communication interface receives external command, until being polled to the third target communication interface for receiving external command Before, the method also includes:
If being not detected in the first predetermined time period between the communication device and the second target communication interface The state of the second target communication interface is then switched to unlocked state by interactive application layer data.
Optionally, if the state for detecting the second target communication interface switches to unlocked state, from arrangement First communication interface after the communication interface that the last time is responded starts, according to the default cyclic polling that puts in order Whether the multiple communication interface receives external command, until being polled to the third target communication interface for receiving external command Before, the method also includes:
If being not detected in the first predetermined time period between the communication device and the second target communication interface The interactive lock status inquiry instruction from host computer, then switch to unlock shape for the state of the second target communication interface State.
Optionally, if the state for detecting the second target communication interface switches to unlocked state, from arrangement First communication interface after the communication interface that the last time is responded starts, according to the default cyclic polling that puts in order Whether the multiple communication interface receives external command, until being polled to the third target communication interface for receiving external command Before, the method also includes:
Receive the unlock instruction to the second target communication interface from host computer, wherein the unlock instruction packet Include the second predetermined time period;
If being not received by the data interaction from the second target communication interface in the second predetermined time period to ask It asks, then responds the unlock instruction for the state of the second target communication interface and switch to unlocked state;
If the state for detecting the second target communication interface switches to unlocked state, from being arranged in nearest one First communication interface after the secondary communication interface responded starts, the multiple according to the default cyclic polling that puts in order Whether communication interface receives external command, until being polled to the third target communication interface for receiving external command, comprising:
If detecting, the state of the second target communication interface switches to unlocked state, from being arranged in the last quilt Communication interface after the second target communication interface of response starts, and puts in order described in cyclic polling according to described preset Whether multiple communication interfaces receive external command, until being polled to the third target communication interface for receiving external command.
Optionally, if the state for detecting the second target communication interface switches to unlocked state, from arrangement First communication interface after the communication interface that the last time is responded starts, according to the default cyclic polling that puts in order Whether the multiple communication interface receives external command, until being polled to the third target communication interface for receiving external command Before, the method also includes:
If detecting the corresponding operation flow abnormal ending of the second target communication interface, normal termination or host computer It is disconnected with the physical connection of the second target communication interface, then the state of the second target communication interface is switched into unlock State.
Optionally, before the external command to the third target communication interface carries out business processing, the method Further include:
Determine the corresponding operation flow of the third target communication interface;
If the operation flow includes the browsing process to shared resource, and/or, the industry that host computer is interacted with user Business process, then control the third target communication interface and be in the lock state.
Optionally, the first external command is received in multiple communication interfaces of the determination according to the default arrangement that puts in order First object communication interface before, the method also includes:
Outer lock and internal lock are pre-created to each communication interface in multiple communication interfaces, wherein the outer lock There is lock status attribute with counter attribute, internal lock;
If the state for detecting the second target communication interface switches to unlocked state, from being arranged in nearest one First communication interface after the secondary communication interface responded starts, the multiple according to the default cyclic polling that puts in order Whether communication interface receives external command, until being polled to before the third target communication interface for receiving external command, institute State method further include:
The state of the second target communication interface is switched into unlocked state by lock state;
The state by the second target communication interface switches to unlocked state by lock state, comprising:
When the counter attribute value of the outer lock of the second target communication interface is not zero, by the counter attribute Value is reset;
When the lock status attribute value of the internal lock of the second target communication interface is not sky, second target is led to The lock status attribute value of the internal lock of communication interface is removed;
The control third target communication interface is in the lock state, comprising:
The counter attribute value of the outer lock of the third target communication interface is increased into default value;And/or
Lock state is set by the lock status attribute value of the internal lock of the third target communication interface.
Optionally, each communication interface be provided in advance individual link encryption key, and/or, storage region.
Optionally, the application program that different communication interfaces are supported is identical or different.
Optionally, if there is the second target communication interface being in the lock state in the multiple communication interface, Keep the connection of the communication device Yu the first object communication interface, comprising:
If detecting the second target communication interface for existing in the multiple communication interface and being in the lock state, it is determined that institute State the second security level of the corresponding operation flow of the second target communication interface;
Determine the first security level of the corresponding operation flow of the first object communication interface;
If first security level be greater than or equal to second security level, keep the communication device with it is described The connection of first object communication interface.
Optionally, after the first security level of the corresponding operation flow of the determination first object communication interface, The method also includes:
If first security level is less than second security level, to the first of the first object communication interface External command carries out business processing.
Optionally, the first external command is received in multiple communication interfaces of the determination according to the default arrangement that puts in order First object communication interface after, the method also includes:
If there is no the second target communication interfaces being in the lock state in the multiple communication interface, to described first External command carries out business processing.
According to another aspect of the present invention, the invention also discloses a kind of communication devices, comprising:
First determining module receives outside first for determining in multiple communication interfaces according to the default arrangement that puts in order The first object communication interface of portion's instruction;
Module is kept, if for there is the second target communication interface being in the lock state in the multiple communication interface, Then keep the connection of the communication device Yu the first object communication interface, wherein the first object communication interface and institute It is different to state the second target communication interface;
First respond module, for will indicate there is the pre- of locked communication interface in response to first external command If instruction is sent to the first object communication interface;
Poller module, if for detecting that the state of the second target communication interface switches to unlocked state, from row It is listed in the first communication interface after the last communication interface responded to start, according to the default circulation wheel that puts in order It askes whether the multiple communication interface receives external command, is connect until being polled to and receiving the third target communication of external command Mouthful, wherein the third target communication interface is any one in the multiple communication interface;
First Service Processing Module carries out business processing for the external command to the third target communication interface.
Optionally, first determining module is also used to after the external command in response to a communication interface, wheel Multiple communication interfaces are ask, determines in the multiple communication interface according to the default arrangement that puts in order and receives the first external command First object communication interface.
Optionally, first determining module includes:
First determines submodule, for determining according to default after the external command in response to a communication interface Put in order the communication interface that the last time in multiple communication interfaces of arrangement responded, from being arranged in the last responded First communication interface after communication interface starts, and is according to the default the multiple communication interface of cyclic polling that puts in order It is no to receive external command, until being polled to the first object communication interface for receiving the first external command.
Optionally, described device further include:
First switching module, if for the communication device and described second to be not detected in the first predetermined time period The application layer data of interaction, then switch to unlock shape for the state of the second target communication interface between target communication interface State.
Optionally, described device further include:
Second switching module, if for the communication device and described second to be not detected in the first predetermined time period The lock status inquiry instruction from host computer of interaction between target communication interface, then by the shape of the second target communication interface State switches to unlocked state.
Optionally, described device further include:
Receiving module, for receiving the unlock instruction to the second target communication interface from host computer, wherein institute Stating unlock instruction includes the second predetermined time period;
Second respond module, if for being not received by the second predetermined time period from second target communication The data interaction of interface is requested, then responds the unlock instruction for the state of the second target communication interface and switch to unlock shape State;
The poller module includes:
Poll submodule, if for detecting that the state of the second target communication interface switches to unlocked state, from It is arranged in the communication interface after the last the second target communication interface responded to start, according to the default arrangement Whether the multiple communication interface of sequence cyclic polling receives external command, until being polled to the third for receiving external command Target communication interface.
Optionally, described device further include:
Third switching module, if for detect the corresponding operation flow abnormal ending of the second target communication interface, The physical connection of normal termination or host computer and the second target communication interface disconnects, then connects second target communication The state of mouth switches to unlocked state.
Optionally, described device further include:
Second determining module, for determining the corresponding operation flow of the third target communication interface;
Control module, if it include the browsing process to shared resource for the operation flow, and/or, host computer and use The operation flow that family interacts then controls the third target communication interface and is in the lock state.
Optionally, described device further include:
Creation module is locked, for outer lock and internal lock to be pre-created to each communication interface in multiple communication interfaces, Wherein, the outer lock has lock status attribute with counter attribute, internal lock;
4th switching module, for the state of the second target communication interface to be switched to unlock shape by lock state State;
4th switching module includes:
Submodule is reset, for when the counter attribute value of the outer lock of the second target communication interface is not zero, The counter attribute value is reset;
Submodule is removed, for when the lock status attribute value of the internal lock of the second target communication interface is not sky, The lock status attribute value of the internal lock of the second target communication interface is removed;
The control module includes:
First setting submodule, it is pre- for increasing the counter attribute value of the outer lock of the third target communication interface If numerical value;And/or
Second setting submodule, for setting the lock status attribute value of the internal lock of the third target communication interface to Lock state.
Optionally, each communication interface be provided in advance individual link encryption key, and/or, storage region.
Optionally, the application program that different communication interfaces are supported is identical or different.
Optionally, the holding module includes:
Second determines submodule, if for detecting the second mesh for existing in the multiple communication interface and being in the lock state Mark communication interface, it is determined that the second security level of the corresponding operation flow of the second target communication interface;
Third determines submodule, the first safety etc. for determining the corresponding operation flow of the first object communication interface Grade;
Submodule is kept, if being greater than or equal to second security level for first security level, keeps institute State the connection of communication device Yu the first object communication interface.
Optionally, described device further include:
Second Service Processing Module, if being less than second security level for first security level, to described First external command of first object communication interface carries out business processing.
Optionally, described device further include:
Third Service Processing Module, if for there is no the second targets being in the lock state in the multiple communication interface Communication interface then carries out business processing to first external command.
Compared with prior art, the present invention includes the following advantages:
By means of the technical solution of the above embodiment of the present invention, by there is locking in the present invention in multiple communication interfaces In the case where communication interface, then the first object communication interface for receiving the first external command at present is kept and communication device Connection, and in response to first external command, it will indicate that the preset instructions that there is locked communication interface are sent to first mesh Communication interface is marked, to can refer to the outside for the communication interface being polled to there is no the communication interface of locking It enables and carries out fastext processing, communication device realizes and company while various communication interfaces when being communicated with host computer Operation flow corresponding to the communication interface for connecing, and ensuring communicated, not by the service request institute of other communication interfaces It interrupts.
Detailed description of the invention
Fig. 1 is a kind of structural block diagram of communication device embodiment of the invention;
Fig. 2 is a kind of step flow chart of means of communication embodiment of the invention;
Fig. 3 is the frame diagram that embodiment is interacted between a kind of communication device and host computer of the invention;
Fig. 4 is a kind of state switching schematic diagram of passage lock embodiment of the invention;
Fig. 5 is the structural block diagram of another communication device embodiment of the invention.
Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.
Referring to Fig.1, a kind of structural block diagram of communication device embodiment of the invention is shown, can specifically include:
Communication interface module 11, the communication interface module 11 include various communication interfaces.As shown in Figure 1, communication interface Type includes but is not limited to USB OTG (USB On-The-Go) communication interface, voice communication interface, Micro USB (Micro USB is a portable version of 2.0 standard of USB) communication interface, bluetooth communication interface, NFC (Near Field Communication, near field communication (NFC)) communication interface etc..Wherein, the communication interface can be it is any can with it is logical The physical interface for interrogating device communication, is not limited to above-mentioned enumerate.
Main control chip 12, the safety as the master controller of communication device, the operation, data that are mainly used for security algorithm are deposited Storage, and communication interface is controlled.
Shared resource module 13, including the resource shared for various communication interfaces, i.e. shared resource, which can be with Including display module for example as shown in Figure 1, key module, memory module etc..Wherein, all types of communication interfaces all may be used To access the shared resource in the shared resource module 13 by master chip 12.
Wherein, the type of the shared resource may include hardware resource, data resource.
Referring to Fig. 2, a kind of step flow chart of means of communication embodiment of the invention is shown, is applied to communication device, Wherein, which can be communication device as shown in Figure 1.
This method can specifically include following steps:
Step 101, it determines in multiple communication interfaces according to the default arrangement that puts in order and receives the first external command First object communication interface;
Wherein, in one example, after communication device starting up, the method for the embodiment of the present invention can be to communication All communication interfaces of device are initialized, so that the communication interface after initialization can be used.
Wherein, in different embodiments, multiple communication interface can be all communication interfaces of communication device, can also be with It is part communication interface, specifically can be flexibly set according to actual needs.In the present embodiment, it is with multiple communication interfaces It is illustrated for all communication interfaces.
In one embodiment, when executing step 101, can whenever the external command in response to a communication interface it Afterwards, with regard to the multiple communication interfaces of poll, so that it is determined that according to being received in the multiple communication interface for presetting the arrangement that puts in order The first object communication interface of first external command.
That is, (wherein, to the response of the external command after the external command in response to a communication interface Processing mode can be any one in the mode 1 and mode 2 being mentioned below, and as detailed below, which is not described herein again), communication Whether the main control chip 12 of device can receive external command by all communication interfaces of poll repeatedly, so-called external command, as Host computer passes through the instruction that communication interface is sent to communication device, which is transmitted to main control chip by communication interface 12, to realize the communication between host computer and communication device.
And in this example, the mode that all communication interfaces can be polled by main control chip 12, to determine that communication connects Which communication interface has received the external command from host computer in mouth mold block 11.Although can there are multiple communication interfaces to receive To the external command of host computer, still, main control chip 12, only will be first being polled to and receive outside and refer in poll The communication interface of order is determined as first object communication interface, that is to say, that main control chip 12 only handles a communication interface every time External command.
Wherein, at poll channel, as soon as it can be after the external command in response to communication interface, to all logical Communication interface (i.e. multiple communication interfaces), can also be according to the default of channel according to the default progress successively poll that puts in order in channel It puts in order and carries out interval poll (such as multiple channels include channel A, channel B, channel C and the channel D of arranged in sequence, then may be used With one channel polling of every minor tick, i.e., it is polled according to the sequence of channel A, channel C, channel B, channel D), it can also be by Have mode according to other to be polled.
In addition, external command transmitted by host computer can't be only a kind of for an operation flow, then by In the method for the embodiment of the present invention, as soon as after the external command in response to communication interface, all communication interfaces of poll, So that it is determined that receiving the first object communication interface of the first external command in the multiple communication interface, and then to first mesh The first external command for marking communication interface carries out subsequent response of step.Due to different communication interfaces processing operation flow not Together, then the operation flow of multiple communication interfaces can be taken into account by means of above-mentioned steps, so that different operation flows obtains Time-division processing will not make some business of single communication interface occupy the resource of main control chip always.
Optionally, in one embodiment, as soon as executing after the external command in response to communication interface, wheel Multiple communication interfaces are ask, so that it is determined that receiving outside first in the multiple communication interface according to the default arrangement that puts in order When the step of the first object communication interface of instruction, it can be accomplished by the following way:
After the external command in response to a communication interface, determine according to the multiple logical of the default arrangement that puts in order The communication interface that the last time is responded in communication interface is first logical after being arranged in the last communication interface responded Communication interface starts, and whether receives external command according to the default the multiple communication interface of cyclic polling that puts in order, directly To being polled to the first object communication interface for receiving the first external command.
For example, multiple communication interfaces include according to default put in order the channel A being arranged successively, channel B, channel C With channel D.
There is not the communication interface of any response external instruction therefore can be according to above-mentioned default row in first time poll Channel A is arrived in the inquiry first of column sequence, wherein channel A receives the locking to channel A from host computer and instructs a kind of (outside Instruction), then main control chip responds locking instruction, locks, and instruct in response to the locking, will add to channel A Lock status returns to host computer.
So in second of poll, then the channel of the last response external instruction is then channel A, therefore, this next round According to the default first channel to put in order after being arranged in channel A when inquiry, i.e., channel B starts poll, such as is polled to When the B of channel, channel B also by chance receives the external command of host computer, accordingly, it is determined that this needs processing response is channel B External command (that is, the external command of channel B be first object communication interface first external command);
On the contrary, find that it is not received by the external command of host computer if being polled to channel B, then continue poll channel C, If be polled to channel C, channel C just receives the external command of host computer, it is determined that this needed to handle response is logical The external command (that is, first external command that the external command of channel C is first object communication interface) of road C;
On the contrary, if poll finds that they are not all received successively after poll channel B, channel C, channel D since the B of channel To external command, then continue poll channel A~channel D.
In another example, if the last communication interface responded is channel C, in poll, then from channel D Start poll, successively inquires that channel D, channel A, channel B, channel C see whether they receive external command, if being polled to channel It is found after C also without external command, then continues successively to inquire channel D, channel A, channel B, channel C next time, is passed through Circulation inquiry in turn, can determine and be responded and then secondary the first mesh for receiving external command in the external command of channel C Mark communication interface.
That is, the method for the embodiment of the present invention is after the external command in the complete channel of every secondary response, Jiu Huicong The next channel for being arranged in the last channel responded starts, and circulation inquires all channels, avoids always from sequence First channel starts poll, and first caused channel is occupied always, and the instruction in other channels is caused to be constantly in Wait state, can not processed problem.Further, it is also possible to which the host computer in some channel is avoided frequently to send instruction, lead to this Channel frequently receives external command, so that the channel occupied problem always.
For example, multiple communication interfaces here may include bluetooth communication interface and NFC communication interface.
User is being connect by bluetooth with host computer 1 using the communication device, and is connect by NFC with host computer 2. Wherein, the host computer 1 and host computer 2 can be identical or different, such as host computer 1 is the application program on PC, and host computer 2 is hand Application program on machine, also, the two application programs can also be identical or different.
As shown in figure 3, the frame diagram interacted between the communication device of another embodiment of the present invention and host computer is shown, Wherein, main control chip is not shown, and is specifically referred to Fig. 1.
Wherein, host computer can be application program (APP), and in the present embodiment, the APP that different communication interfaces is supported is Different, as shown in figure 3, USB OTG communication interface supports APP1, voice communication interface to support APP2 ... NFC communication interface Support APPn.
So the embodiment of the present invention by when developing communication device, can make communication device different communication interfaces ( That is channel) different application programs is supported respectively, so as to support more application scenarios, such as Bluetooth channels to support mobile phone simultaneously Subway ticketing application is supported in Bank application, the channel NFC, then the safety management function of Mobile banking's application can be used in user, Come utilize Bluetooth channels inquiry communication device facility information (such as safety certificate etc.), meanwhile, user can be with subway ticketing Using come utilize the channel NFC buy subway ticket.
And in another embodiment, the application program that different communication interfaces is supported can also be identical, such as USB logical Communication interface and NFC communication interface all support APPn, then can be communicated by two kinds when carrying out host computer communication using APPn Interface realizes the communication with host computer.So when any one communication interface in two kinds of communication interfaces breaks down, It can also realize that the business of APPn is used using another communication interface, promote the reliability of communication device.
Wherein, for the communication interface for receiving external command, the host computer connected is attempt to and communicates Device is communicated.
Optionally, in one embodiment, if the corresponding Business Stream of external command institute of current channel B, channel C The access conflict of shared resource is not present in journey, and is not related to the process that host computer is interacted with user, then the master of the embodiment of the present invention Control chip 12 can the external command to two channels carry out time-division processing.
For example, channel B supports Mobile banking's application, subway ticketing application is supported in the channel NFC.Here, user wants to use The safety management function of Mobile banking's application, to utilize facility information (such as the safety certificate of Bluetooth channels inquiry communication device Deng);In addition, user also wants that the channel NFC is utilized to buy subway ticket using subway ticketing application.
Here, it is related to two operation flows, operation flow 1: inquiry apparatus information;Operation flow 2: purchase subway ticket.Its In, either operation flow 1 or operation flow 2 can all be related to multiple external commands sent to communication device when being executed. Such as operation flow 1 corresponding external command B1, B2.Operation flow 2 corresponds to external command C1, C2.And above-mentioned operation flow 1 and industry The access conflict of shared resource is not present between business process 2 and is not related to host computer and is interacted with user.Therefore, above-mentioned any one The execution of a process all will not relate to the problem of locking to the channel for handling corresponding process.
So in the external command for the treatment of channel, main control chip 12 understands all channels of poll repeatedly, sees which communication connects Mouth has received external command, for example, main control chip 12 through overpolling first it is detected that channel B has received external command B1, then Business processing is carried out to external command B1;After the instruction that channel B is completed in processing, it is each logical that main control chip 12 is further continued for poll Road sees which channel reception has arrived external command, such as detects that channel C has received external command C1 at this time, then master control core Piece 12 carries out business processing to external command C1;After the instruction that channel C is completed in processing, it is logical that main control chip 12 is further continued for poll Road sees which channel reception has arrived external command, detects that channel B has received external command B2 at this time, then to external command B2 carries out business processing;After the instruction that channel B is completed in processing, main control chip 12 is further continued for poll channel, sees which channel connects External command is had received, detects that channel C has received external command C2 at this time, then main control chip 12 carries out external command C2 Business processing.
Input of the respective external command to respective channel so Jing Guo above-mentioned two operation flow, so that the present invention is implemented The communication device of example realizes the time-division processing of the external command to two or more channels.
In this way, the communication device and method of the embodiment of the present invention not only support the usage scenario of multiple application programs, also Ensure the time-sharing communication of multiple application programs and communication device.
Step 102, it if there is the second target communication interface being in the lock state in the multiple communication interface, keeps The connection of the communication device and the first object communication interface, wherein the first object communication interface and described second Target communication interface is different;
Wherein, main control chip 12 can detect all of the communication device after executing step 101, before step 102 With the presence or absence of the communication interface being in the lock state in communication interface, it is denoted as the second target communication interface here.
Wherein, it in the method for the embodiment of the present invention, in order to make communication device when being communicated, while connecting more Kind communication interface is communicated with each APP, needs exist for ensuring to interfere with each other between each channel (i.e. communication interface), Cause respective operation flow to be not interrupted, and prevents the access conflict of shared resource.For this purpose, the method for the embodiment of the present invention Can to the operation flow for accessing shared resource, and/or, the channel of the operation flow interacted with user adds logical Road lock, is in the lock state the channel (the second target communication interface i.e. here), in this way, by the above-mentioned of main control chip 12 Detection, so that it may which discovery has the second target communication interface being in the lock state.
The passage lock of the embodiment of the present invention, for guarantee upper layer process (such as: the certificate of bluetooth key is downloaded, transfers accounts, is repaired Changing each operations such as password, checking PIN (Personal Identification Number, personal recognition code) before can bullet The process of input frame out, i.e., in processing business process, host computer and user have interaction, and user is needed to input the process of information) Integrality do not interrupted by other channels, and prevent the access conflict of shared resource.
Wherein, since there is currently the second target communication interfaces -- such as channel A is in the lock state, and channel A It is different from the first object communication interface (such as channel B) of the first external command is received in step 101, then in order to guarantee to lead to The integrality of the corresponding operation flow of road A is not interrupted, and prevents the access conflict of shared resource, the side of the embodiment of the present invention Method can keep the connection (connection here includes physical connection, link connection etc.) of the communication device Yu channel B, so that The first external command can also be sent always to channel B with the host computer of channel B communication, until after channel is idle, this is outside first Portion's instruction can be by business processing.
Wherein, it in the connection of keep in communication device and channel B, can be reasonably selected not according to the interface type of channel B Same chip to connect with channel B.
Such as channel B be USB communication interface when, the main control chip 12 for the device that can keep in communication is connect with channel B;When logical Road B is bluetooth communication interface, then the Bluetooth chip for the device that can keep in communication is connect with channel B.
Wherein, other chips even in addition to main control chip and channel B keep connecting, but the control to channel B Work still has main control chip to complete.
It should be noted that being rung when the embodiment of the present invention carries out response processing to the external command that communication interface receives The mode that should be handled may include following two mode:
Mode 1: the response of business processing mode is carried out to external command;
Mode 2: external command is responded in a manner of sending preset instructions.
Wherein, it for the application scenarios of mode 2, only there are locking channel, and needs to communication In the case that device and other channels for receiving external command keep connection, just meeting employing mode 2 is to other channels External command is responded.
And for the application scenarios of mode 1, then only in the case where locking channel is not present, if being polled to some Channel reception is to external command, then to the response of the external command ways of carrying out 1 in the channel, i.e., to the external command in the channel into Row business processing.
In this way, the method for the embodiment of the present invention can make to receive external command in the case where there is locked channel The App that is connected of channel B equally with the communication device in connection status, rather than off-state, in this way, working as channel A After in the unlocked state, if being polled to channel B again receives first external command, main control chip 12 can be quick Business processing is carried out to the first external command of channel B.
Due to establishing the connection in channel and communication device, physical connection is not only needed, it is also necessary to which channel link is negotiated, authenticated Deng and etc., then can be saved significantly by keeping connecting with communication device to the channel for receiving external command is polled to The channel attached time is saved, so that the communication device can be to holding connection there is no the channel of locking The external command that channel receives again carries out quick response.
Step 103, in response to first external command, it will indicate that the preset instructions that there is locked communication interface are sent To the first object communication interface;
Continuation is illustrated by taking the example of above-described embodiment as an example, this is polled to channel B and receives the first external command, And due to being in the lock state there are channel A, the method for the embodiment of the present invention can also generate a preset instructions, this is pre- If instruction indicates the communication interface for having locked.In specific implementation, which can be status code, error code.It should The information in the presence of locked communication interface is described in status code, error code.Then, the main control chip of the embodiment of the present invention can Response processing is carried out with the first external command to channel B, the mode of processing is responded, the preset instructions is as sent to this and are led to Road B, finally, the preset instructions to be transmitted to by channel B the host computer of connection again.Host computer can be according to the preset instructions Solving communication device side, presently, there are the channels of locking, therefore, when carrying out business processing with channel B connecting communication, main control chip Business processing can not be carried out to the first external command of the business.
If that host computer needs the business for the treatment of channel B, then host computer constantly can send this outside first to channel B Portion's instruction, until first external command carries out business processing by main control chip.
In this way, when being in the lock state there are some channel, if some other channel request carries out business processing, The method of the embodiment of the present invention can not only keep the connection of some other channel and communication device, can also be to some other logical Road returns to the status code for indicating to exist the channel of locking, in this way, the status code can be back to host computer by some other channel, So that host computer knows that the reason of can not currently carrying out Communication processing is the occupancy there are other channels to main control chip 12, and Nonsystematic is abnormal, so as to so that host computer continues to send first external command, the free time of waiting main control chip 12.
Optionally, in another embodiment, if by after step 101, according to the method for the embodiment of the present invention also May include:
If there is no the second target communication interfaces being in the lock state in the multiple communication interface, to described first External command carries out business processing.
That is, after being polled to channel (i.e. the first object communication interface) that some receives external command, if There is no locked channel in current all channels, then main control chip can the external command directly to the channel carry out industry Business processing, further, it is also possible to the result of business processing be returned to the channel (i.e. first object communication interface), so that should Processing result is returned to host computer by channel (i.e. first object communication interface).
It wherein, is here business processing to the response processing mode of the first external command, and non-sent error code.
Step 104, if detecting, the state of the second target communication interface switches to unlocked state, from being arranged in most First communication interface after the communication interface closely once responded starts, and puts in order described in cyclic polling according to described preset Whether multiple communication interfaces receive external command, until it is polled to the third target communication interface for receiving external command, In, the third target communication interface is any one in the multiple communication interface;
That is, if detecting, the state of the second target communication interface switches to unlocked state, recycles execution Multiple communication interface polling procedure will be polled to receive here until being polled to the communication interface for receiving external command The communication interface of external command is denoted as third target communication interface.And the third target communication interface can be above-mentioned multiple communications Any one communication interface in interface, such as can be above-mentioned first object communication interface, it is also possible to above-mentioned second target Communication interface can also be the communication interface in addition to first object communication interface and the second target communication interface.
Wherein, polling procedure is as follows each time: first logical after being arranged in the last communication interface responded Communication interface starts, and is arranged in and is located at after the last communication interface responded according to the default successively poll that puts in order All communication interfaces until the last one communication interface, then again from be arranged in it is described it is default put in order in first it is logical Communication interface starts, according to the default each communication interface of successively poll that puts in order, until being polled to the last responded Communication interface, it is ensured that successively polling procedure can be polled to all communication interfaces, so that it is determined that the multiple communication interface The third target communication interface of external command is received in (i.e. all communication interfaces).
If that by an above-mentioned polling procedure, still without the communication interface for receiving external command is polled to, then Circulation executes above-mentioned polling procedure, until being polled to the communication interface for receiving external command.
Such as according to multiple communication interfaces of the default arrangement that puts in order be followed successively by channel A, channel B, channel C, channel D, Channel E.Such as the state of channel C is switched to unlocked state by lock state, then the method for the embodiment of the present invention can be from arrangement First channel after the communication interface (being here channel C) that the last time is responded, i.e. channel D start, and successively poll is logical Road D, channel E, channel A, channel B, channel C see which channel reception has arrived external command, that is, receive the third of external command Target communication interface.
It is assumed that default put in order in channel is channel 1, channel 2, the channel channel 3..... n, if polling procedure is every It is secondary all since channel 1 successively poll up to channel n.In this way, channel number is smaller and the very frequent channel of interaction then can be always The processor for occupying main control chip, will lead to the obstruction of device talk.
Therefore, the polling procedure of the method for the embodiment of the present invention are as follows: when each poll again, responded from the last time Next channel in channel starts, poll to last channel (i.e. after channel n), then from starting channel polling to the last time rung The channel answered, so that each channel is traversed, if in polling procedure, a certain channel reception being polled is to external command, then Exit this poll.For example, the channel that is responded of last time is channel 3, then next poll is inquired since channel 4, and poll is to logical Inquiry completes the traversal poll in primary all channels up to channel 3 since channel 1 again after road n.
Step 105, business processing is carried out to the external command of the third target communication interface.
Continuation is illustrated with above-mentioned example, and multiple channels include the channel A being arranged successively, channel B, channel C, channel D and lead to Road E, in a step 101, each channel of system poll, such as it is polled to channel B (being here first object communication interface) reception To external command, but passes through step 102 and finds that there are channel A (being here the second target communication interface) to be in the lock state, Therefore, it executes step 103 and returns to error code to channel B with the external command of response channel B;Then, channel A is unlocked, and is in Unlocked state.
Wherein, channel A switches to unlocked state there are two types of situation from lock state.
Situation one, host computer send unlock instruction (a kind of external command) to channel A, connect if that being polled to channel A Unlock instruction is received, then the unlock instruction of channel A is responded, i.e., channel A is unlocked, so that channel A is in unlock State;After so channel A unlock, the channel that the last time is responded is exactly channel A, and therefore, step 104 (is ascended the throne from channel B First channel after the channel A responded in the last time) start the polling procedure that the embodiment of the present invention limits, continue to take turns Each channel is ask, if being polled to channel B (being here third target communication interface) receives external command, to channel B's External command carries out business processing, and non-sent error code;
Situation two, main control chip are automatically unlocked channel A, so that channel A is in the unlocked state, such case exists When to channel A unlock, channel A will not receive the external command for unlock, and therefore, the channel that the last time is responded is not Channel A, but other channels, therefore step 104 is that (this channel can be multiple from the last channel responded is arranged in Any one channel in channel, specifically which channel, which depend on which the last channel, to be responded) after it is first logical Road starts to continue all channels of poll, such as is polled to channel E (being here third target communication interface) and receives external command, Business processing, and non-sent error code then are carried out to the external command of channel E.
Refer in addition, the external command of above-mentioned channel B or channel E as third target communication interface is also possible to lock It enables, then the business procession of this step 105 is then to carry out locking processing to channel B or channel E, and locking state is returned to Channel B or channel E.
By means of the technical solution of the above embodiment of the present invention, by there is locking in the present invention in multiple communication interfaces In the case where communication interface, then the company with communication device is kept to the first object communication interface for receiving the first external command It connects, and in response to first external command, will indicate that the preset instructions that there is locked communication interface are sent to the first object Communication interface, thus there is no the communication interface of locking, it can be to the external command for the communication interface being polled to Carry out fastext processing, communication device when being communicated with host computer, realize with connection while various communication interfaces, And operation flow corresponding to the communication interface for ensuring communicated, it is not beaten by the service request of other communication interfaces It is disconnected.
Optionally, before step 101, can also include: according to the method for the embodiment of the present invention
Outer lock and internal lock are pre-created to each communication interface in multiple communication interfaces;
Wherein, the method for the embodiment of the present invention can connect each communication in the multiple communication interface of communication device An outer lock object and internal lock object is all pre-created in mouth, wherein and the outer lock object can have counter attribute, Internal lock object can have lock status attribute.Wherein, counter records the lock used number (numerical value be greater than 1 when, table Show that multilayer locks).
Wherein, internal lock is the logic lock of communication device oneself maintenance.
The locking scene of internal lock: generally it is being related to crucial applied business process, such as is accessing shared resource, be related to user When the process interacted with host computer, main control chip 12 can automatically add the channel for being related to the key applied business process internal It locks (that is, the lock status attribute value of the internal lock object in the channel is made to be set as lock state), to protect crucial application flow (example Integrality such as: trading, generate key pair, Modify password, and need the processes such as key confirmation).
The locking of channel interior lock: lock state can be set by the lock status attribute value of the internal lock object in the channel (such as 0x01).
The release scene of channel interior lock:
1, main control chip discharges internal lock: discharging when corresponding operation flow abnormal ending, normal termination in channel;
Such as in transferred account service process, if process by the channel it is nontransaction in instruction interrupt, the process is different Often terminate.Or, after normal termination, main control chip can discharge the channel automatically after the transferred account service process is normally finished Internal lock.
2, host computer requires release internal lock: in host computer exception, can send in release to the channel for adding internal lock Portion lock instruction (such as: in transaction flow, can first verify user PIN, if the communication abnormality in checking PIN sub-process, bluetooth Key does not receive instruction, needs after upper computer detection is exited to exception then equipment can be stuck in the lock state of internal lock The notification and communication device that sends instructions is exported in outermost transaction flow and discharges the internal lock);Alternatively, needing to handle in host computer Compared to the business of current channel processing, when the higher business of priority, it can indicate that the channel discharges the current channel Internal lock is (for example, the channel processing that host computer locks at present is the lower business of priority, when the business for having higher priority When request, if the channel is added to internal lock, host computer can carry out release internal lock to the channel with notification and communication device, To the enforceable business for terminating low priority);Alternatively, when the physical connection in host computer and channel disconnects, then by the channel Internal lock release.
The unlock (here also for release) of channel interior lock, that is, keep the internal lock in channel in the unlocked state: can should The lock status attribute value of the internal lock object in channel is removed, or is set as unlocked state (such as 0x00).
And outer lock is the host computer management service by communicating with communication device.
When outer lock object is managed and is safeguarded, is sent by host computer by connected channel and lock, unlock Instruction to main control chip, then by main control chip the channel locked, unlocked.
The locking scene of outer lock: when host computer wants some resource by monopolizing in communication device, can pass through One outer lock is added to the channel for accessing the resource, the resource is monopolized to realize.In addition, when adding outer lock, and add Add the scene of internal lock similar, can also be when being related to above-mentioned crucial applied business process, host computer can be to being related to the key The channel of applied business process sends the instruction of addition outer lock, to add outer lock to the channel by main control chip.
The locking of channel outer lock: since outer lock object only has counter attribute, not having lock status attribute, therefore, right The meaning of channel addition outer lock, that is, be to increase the numerical value of the counter attribute of outer lock object in the channel by default value. Such as: transaction, generate key pair, Modify password, and need key confirmation etc. operation flow execute before, can first send out one Channel lock instruction, the then numerical value for handling the counter of the outer lock object in the channel of the operation flow add one.
Wherein, if the above-mentioned operation flow of processing includes multiple nested sub-processes, which can be referred to as big Operation flow, then when adding outer lock outer lock can be added to each sub-process entrance of the big operation flow, that is, One is added to the numerical value of the counter of the outer lock object in the corresponding channel of the big operation flow, that is to say, that the big Business Stream When each sub-process of journey adds an outer lock, it can actually be presented as the outer lock object to the channel of the big operation flow The numerical value of counter add one.Therefore, the numerical value of the counter of outer lock object may exist greater than 1 in big operation flow Situation.
The unlock scene of outer lock: the nested process that can included according to the operation flow that channel is handled by outer lock Outer lock is added respectively, it therefore, can also be in each of the operation flow when being unlocked to the channel for handling some operation flow At the end of sub-process executes, one layer of outer lock is solved to the channel, that is, the outer lock object in the channel to above-mentioned big operation flow The numerical value of counter subtract one.
The unlock of channel outer lock: since outer lock object only has counter attribute, not having lock status attribute, therefore, right Channel unlocks the meaning of outer lock, and the numerical value of the counter attribute of the outer lock object in the channel is as made to reduce default value. It can be executed at the end of nested small process interface generally in big operation flow, such as: the checking PIN sub-process in transaction terminates When, the numerical value for handling the counter of the outer lock in the channel of the transaction can subtract one.Wherein, it should be noted that as long as some is logical The numerical value of the counter of the outer lock in road is greater than zero, then the channel is still in the lock state, only outside this When the numerical value of the counter of lock is zero, which is just in the unlocked state of outer lock.
The release scene of outer lock:, can be right in the big operation flow normal termination of the channel processing added with outer lock The outer lock in the channel is discharged;Alternatively, host computer can send release to the channel for adding outer lock in host computer exception Outer lock instruction (such as: in transaction flow, can first verify user PIN, it is blue if the communication abnormality in checking PIN sub-process Tooth Key does not receive instruction, then equipment can be stuck in the lock state of outer lock, after upper computer detection is exited to exception, needs It to export and be sent instructions to the channel in outermost transaction flow, it is made to discharge the outer lock);Alternatively, being needed in host computer It handles the business that handle compared to current channel, when the higher business of priority, can indicate that the channel discharges this and currently leads to The outer lock in road is (for example, the channel processing that host computer locks at present is the lower business of priority, when there is higher priority When service request, if the channel is added to outer lock, host computer can notify the channel to carry out the release of outer lock, thus The enforceable business for terminating low priority);Alternatively, when the physical connection in host computer and channel disconnects, then by the outer of the channel Portion's lock release.
The release of channel outer lock: since outer lock object only has counter attribute, not having lock status attribute, therefore, right Channel discharges the meaning of outer lock, as resets the numerical value of the counter attribute of the outer lock object in the channel.Usually exist It is executed at the end of the outermost layer interface of big operation flow, to discharge the outer lock in channel completely.Such as: transaction or downloadable authentication etc. At the end of big process, the numerical value that can will handle the counter of the outer lock in the channel of the big process is reset.
In addition, the release of the outer lock, internal lock in above-mentioned channel can also be triggered by user, to realize to passage lock Forcible aborting.
The function is primarily adapted for use in the higher application scenarios of priority ratio or communication channel, is usually actively sent out by user It rises, is locked using some physical method forced termination current channels.For example, when Bluetooth channels are locked, long-pressing safety control Switching on and shutting down key, or directly close the Bluetooth switch with the mobile phone of safety control bluetooth connection, can force to release Passage lock is put, for the communication in other channels.Such as: it is blue at this time when bluetooth Key, which just carries out transaction using Bluetooth of mobile phone, to transfer accounts Tooth channel is in the lock state, USB can not access equipment resource, but user wants to abandon switching to PC, Yong Huke using bluetooth at this time Autonomous long-pressing facility switching switch disconnects bluetooth release channel.
And host computer can pass through the needs when notifying main control chip to carry out the locking, unlock or release lock of outer lock The channel be locked, unlock, discharging lock sends respective request (request can be with parameter) to main control chip, and main control chip can be with According to the parameter determine current operation be lock, unlock, or release lock, thus to the counter of the outer lock in the channel into Row operation.
In the present embodiment, there are two lock object (outer lock object and internal lock object), different channels in each channel Between lock object be independent control, be independent of each other.
Optionally, before step 104, according to the method for the embodiment of the present invention further include:
The state of the second target communication interface is switched into unlocked state by lock state;
Elaboration so based on said external lock and internal lock, in one embodiment, by second target communication It, can be when the counting of the outer lock of the second target communication interface when the state of interface switches to unlocked state by lock state When device attribute value is not zero (that is, scene that the second target communication interface is added with outer lock), by the counter attribute Value is reset;When the lock status attribute value of the internal lock of the second target communication interface is not sky (that is, second target is logical Communication interface is added with the scene of internal lock), the lock status attribute value of the internal lock of the second target communication interface is removed.
Optionally, when controlling some target communication interface and being in the lock state, can will the target communication interface it is outer The counter attribute value of portion's lock increases default value;And/or the lock status attribute value of the internal lock of the target communication interface is set It is set to lock state.
Wherein, as being specifically to be operated to the counter attribute value of outer lock, or to the lock status category of internal lock Property value operated, then depend on in practical application, the scene that the first object communication interface is locked be belong to it is above-mentioned outer The locking scene of portion's lock, still falls within the locking scene of above-mentioned internal lock, or belongs to the locking scene of said external lock simultaneously With the locking scene of above-mentioned internal lock.
In this way, the method for the embodiment of the present invention can be currently processed according to each channel practical business, come flexible Outer lock and/or internal lock are added to the channel, it is ensured that lock the corresponding business in channel complete process and shared resource it is mutual Reprimand access.
Optionally, before step 104, can also include: according to the method for the embodiment of the present invention
If do not detected in the first predetermined time period the communication device and the second target communication interface it Between interaction application layer data, then the state of the second target communication interface is switched into unlocked state.
Wherein, which is the time-out time of the no data interaction between the lockup period of channel, and the time is long It is specified that degree T1 can carry out configuration when communication device produces.The time span is that can not change in the service stage of communication device 's.In addition, time span T1 can individually be configured for each channel.
After the locking of some channel (being here the second target communication interface), then start to be counted according to time span T1 When, if this can be led to not having any application layer data to interact between the channel and main control chip 12 in time span T1 The state in road is switched to unlocked state, and (wherein, no matter to channel locking being outer lock or internal lock, all lock will be released It puts).On the contrary, if having the finger of any application layer between the main control chip 12 and the channel of bluetooth Key (that is, a kind of communication device) Interaction (i.e. application layer data interaction) is enabled, then can re-start countdown according to time span T1.
Wherein, it should be noted that above-mentioned communication interface need to be that application layer data interacts with the interaction of main control chip 12, such as Fruit is that various communication interfaces are interacted with the Protocol layer data of main control chip 12, then does not influence the countdown of time span T1, example If the data interaction of Bluetooth protocol bottom does not influence the countdown of T1, alternatively, inquiring setting for bluetooth key by USB communication interface Standby state, although USB interface, in interaction, is not belonging to application layer data interaction, belongs to USB association with main control chip 12 always View, will not also cause the countdown again of T.
The embodiment of the present invention is unlocked the channel of locking by time span T1, it is made to be switched to unlock shape State primarily to avoiding channel from occupying main control chip 12 or channel abnormal for a long time leads to deadlock, and then causes other logical The problem of road can not be communicated with main control chip 12 and be resulted in waste of resources.
Optionally, before step 104, can also include: according to the method for the embodiment of the present invention
If being not detected in the first predetermined time period between the communication device and the second target communication interface The interactive lock status inquiry instruction from host computer, then switch to unlock shape for the state of the second target communication interface State.
Specifically, each channel can only inquire the channel lock status of itself, when the stream for being related to user and being interacted with host computer Cheng Shi, for example, when check password, upper computer software pops up user password input frame, at this time in fact can without communication device with Application layer data interaction between communication interface, still, the first predetermined time period if more than, the channel of the communication interface Lock can be released.So in order to maintain the passage lock, host computer can also send lock status in the first predetermined time period Inquiry instruction maintains the lock state of the communication interface.Therefore, logical when also not detected in the first predetermined time period The lock status inquiry instruction sent by host computer interacted between news device and the second target communication interface, then by second mesh The state of mark communication interface switches to unlocked state.
Referring to Fig. 4, the state switching schematic diagram of the passage lock of one embodiment of the invention is shown.
Step is 1.: outer lock is arranged in host computer, or when executing key business process, inside communication device in automatic setting Portion's lock.
Step is 2.: host computer release outer lock and internal lock, i.e. outer lock counter O reset, internal lock do not lock.Simultaneously Carry out the release waiting time (i.e. above-mentioned time span T2) countdown.
Step is 3.: release waiting time countdown terminates.
Step is 4.: 1. with step.
Step is 5.: when latch-up-free operates, switching to non-locking state at once.
Step is 6.: after channel physical connection disconnects, releasing immediately lock.
Wherein, release conditions and non-locking state do not have essential distinction, can be classified as a state.
Optionally, before step 104, can also include: according to the method for the embodiment of the present invention
Receive the unlock instruction to the second target communication interface from host computer, wherein the unlock instruction packet Include the second predetermined time period;
Wherein, which comes from through the host computer that the second target communication interface and main control chip 12 communicate, i.e., Host computer initiative discharges the scene of outer lock and/or internal lock.The detail of the scene please refers to above-described embodiment, this In repeat no more.
Wherein, unlock instruction from host computer that main control chip 12 receives not only may include that above-described embodiment is retouched The expression current operation stated is the parameter of unlock, can also include the second predetermined time period T2.
Time span T2 is notified by the unlock instruction to main control chip 12 as the parameter that must be filled out.
If being not received by the data interaction from the second target communication interface in the second predetermined time period to ask It asks, then the state of the second target communication interface is switched into unlocked state in response to the unlock instruction;
Specifically, the meter that falls for carrying out time span T2 can be started after main control chip 12 receives the unlock instruction When, during countdown, which still keeps lock state, and during falling to count timing, main control chip 12 does not have Have receive from the first object communication interface any data interaction request when, then count down time one terminate, then stand The state of the first object communication interface is switched into unlocked state, specifically as described in above-described embodiment, can first by The lock status attribute value of the internal lock of first object communication interface is removed and the counter zero setting of its outer lock.
Correspondingly, if detecting, the state of the second target communication interface switches to unlock shape when executing step 104 State, then since the communication interface being arranged in after the last the second target communication interface responded, according to described Whether the default the multiple communication interface of cyclic polling that puts in order receives external command, refers to until being polled to and receiving outside The third target communication interface of order.
That is, since the unlock of the second target communication interface is triggered by host computer, i.e. the solution that sends of host computer Lock instruction is to the second target communication interface, then making the second target communication interface switch to solution in response to the unlock instruction After lock status, so that the last communication interface responded is exactly the second target communication interface, therefore, in the case where continuing poll One when receiving the third target communication interface of external command, then from being arranged in the last second target responded Whether the communication interface after communication interface starts, connect according to the default the multiple communication interface of cyclic polling that puts in order External command is received, until being polled to the communication interface for receiving external command, i.e. third target communication interface.
The method of the embodiment of the present invention is visited by the second predetermined time period of setting in high-frequency access path and low frequency Ask under the simultaneous scene in channel, if high-frequency channel in release delay waiting time (i.e. in T2 time span), then Secondary initiation data interaction, then communication device and host computer can be with fast reactions, without the user's body of reduction high-frequency access path It tests, to optimize communication efficiency and enhance user friendly Experience Degree.Such as: user is inserted into the USB of PC using the USB of bluetooth Key The case where interface charges, while being connect by bluetooth with bluetooth Key using mobile phone, and continuous several times carry out money transfer transactions, After method through this embodiment will not make a money transfer transactions, the passage lock of the bluetooth communication interface is discharged, and can Repeatedly to carry out money transfer transactions.
Optionally, before step 104, can also include: according to the method for the embodiment of the present invention
If detect the corresponding operation flow abnormal ending of the second target communication interface, normal termination or host computer with When the physical connection of the second target communication interface disconnects, then the state of the second target communication interface is switched into unlock State.
Wherein, so-called operation flow abnormal ending refers to operation flow because of the operation flow caused by a variety of causes Service logic do not execute completely, but the interruption ends.
So-called operation flow normal termination is then to refer to service logic all execution of operation flow, and patrol in business It collects after executing completely, finishes operation flow.
Also, it will be understood to those skilled in the art that operation flow abnormal ending and operation flow normal termination belong to The known concept of this field, therefore, which is not described herein again.
In one embodiment, it in the case where being defined there are the outer lock of above-described embodiment and internal lock, is referred to The example that main control chip 12 in above-described embodiment in " the release scene of channel interior lock " discharges internal lock, that is, when the second mesh When mark communication interface is in the lock state, when passage lock is internal lock, the main control chip 12 of the embodiment of the present invention is being detected The corresponding operation flow abnormal ending of second target communication interface, normal termination or host computer and the second target communication interface Physical connection when disconnecting, the state of the second target communication interface can be switched into unlocked state, here for by first object The lock status attribute value of the internal lock of communication interface is removed.
In this way, when the corresponding business of the second target communication interface that be in the lock state because abnormal, normal termination or on When the physical connection of position machine and the second target communication interface disconnects, the method for the embodiment of the present invention can timely to this The internal lock of two target communication interfaces is discharged so that the second target communication interface is in the unlocked state, so as into The business processing of the external command in the next channel of row.
It optionally, in one embodiment, according to the method for the embodiment of the present invention can be with before executing step 105 Include:
Determine the corresponding operation flow of the third target communication interface;
Specifically, Business Stream corresponding to external command received by the third target communication interface can be determined Journey.
If the operation flow includes the browsing process to shared resource, and/or, the industry that host computer is interacted with user Business process, then control the third target communication interface and be in the lock state.
Wherein, it is referred to being specifically described for above-described embodiment about the definition of shared resource, which is not described herein again.
Wherein, in one example, in the case where being defined there are the outer lock of above-described embodiment and internal lock, then if The corresponding operation flow of third target communication interface is related to " the locking scene of internal lock " of above-described embodiment description, that is, should Operation flow includes the browsing process to shared resource, and/or, the operation flow interacted between user and host computer, tool Body please refers to the specific descriptions of " the locking scene of internal lock " embodiment, then in order to ensure the exclusive reference of shared resource, and The integrality of key business process can control the third target communication interface and be in the lock state, i.e., logical to the third target Communication interface adds internal lock, specially is set as locking by the lock status attribute value of the internal lock object of the third target communication interface Determine state.
In this way, after the passage lock when some channel is released, it is simple here for the third target communication interface that will be handled It states as third channel, specific business according to handled by the third channel of the embodiment of the present invention, to determine the need for pair The third channel locks, and is at lock state.So only the business of the third channel need to access shared resource and/ Or when carrying out the interaction between user and host computer, can just add internal lock to it, be at lock state, so that it is guaranteed that altogether Enjoy the exclusive reference of resource and the integrality of key business process.
It optionally, can be by by the third mesh when controlling the third target communication interface and being in the lock state The counter attribute value for marking the outer lock of communication interface increases default value;And/or by by the third target communication interface The lock status attribute value of internal lock be set as lock state.
Optionally, each communication interface of communication device can be provided in advance individual link encryption key, and/or, Storage region.
For example, it is referred to Fig. 1 and Fig. 3, in Fig. 1, it is logical that every kind of communication interface all passes through respective safety encryption Road carries out communication interaction with main control chip 12, wherein is all provided in advance in the safe encrypted tunnel of each communication interface Link encryption key that is independent and being independent of each other.
In this way, can both have been guaranteed each only by making each channel of communication device using independent link encryption key The safety of vertical channel communications, and can prevent mutually to access between channel.
And from figure 3, it can be seen that the communication device of the embodiment of the present invention can configure storage to each communication interface in advance Region, such as the storage region of USB OTG communication interface is App1 Data, the storage region of voice communication interface is The storage region of App2Data, Micro USB communication interface is App3 Data, and the storage region of bluetooth communication interface is App4 The storage region of Data, NFC communication interface is Appn Data.Wherein, which may include memory field and/or caching Area.
In this way, the embodiment of the present invention is by each respective safety management of channel independent operating, and each channel has Oneself independent storage region, and these storage regions realize isolation physically, to reach security state machine, operating rights Limit control, file access path and some inner buffer data are mutually isolated, do not interfere with each other, the purpose that cannot mutually access.
Optionally, in one embodiment, the order of channel reception or corresponding operation flow can not divided not etc. Security level can be accomplished by the following way when executing step 102:
If detecting the second target communication interface for existing in the multiple communication interface and being in the lock state, it is determined that institute State the second security level of the corresponding operation flow of the second target communication interface;
Such as after channel A (being here the second target communication interface) locking, external command that channel A is received or this is outer The security level of operation flow belonging to portion's instruction is grade 1.
Determine the first security level of the corresponding operation flow of the first object communication interface;
Wherein, the first object communication interface (such as channel B) that determining step 101 receives external command is needed exist for connect The security level of operation flow belonging to the external command received or the external command is grade 2.
If first security level be greater than or equal to second security level, keep the communication device with it is described The connection of first object communication interface.
Wherein, grade 2 is higher than grade 1, therefore, the connection of the main control chip 12 and channel B of the device that can keep in communication.
Wherein, for security level, priority predetermined or the degree of safety with operation flow be can be Positively related level information (that is, the degree of safety of operation flow is higher, then handles the security level of the communication interface of the operation flow It is higher)
In this way, in the case where there is locked channel, if received corresponding to other channels of external command The security level of operation flow is higher than the security level of the operation flow of the locking channel, then keeps the business of the high safety grade Connection between the channel of process and the communication device.
Optionally, after the first security level of the corresponding operation flow of the determination first object communication interface, According to the method for the embodiment of the present invention further include:
If first security level is less than second security level, to the first of the first object communication interface External command carries out business processing.
Wherein, such as belonging to first object communication interface (such as channel B) external command or the external command that receive The security level of operation flow be grade 0, then grade 0 is less than grade 1, therefore, carries out at business to the external command of channel B Reason.
That is, the channel for security level lower than the security level of locking channel, i.e. channel B, main control chip 12 can be While executing the operation flow of channel A, the operation flow of channel B can also be performed, that is, carry out to the external command of channel B Business processing.
In embodiments of the present invention, since order/operation flow execution of lower security grade will not influence high safety etc. The order of grade/business executes, so, security level is lower than order/operation flow security level in the channel of Current lock Order/operation flow can be carried out handling.Such as what order/operation flow of channel B accessed is not shared resource.
Order/operation flow is divided into different security levels by the embodiment of the present invention, so as to handle theirs Channel carries out different control.
Optionally, in another embodiment, 102~step 105 of above-mentioned steps can also be replaced with, if detecting institute It states and there is the second target communication interface for being in the lock state in multiple communication interfaces, then disconnect the communication device and described the The connection of one target communication interface.In this way, the degree of safety of communication device can be promoted.
By means of the technical solution of the above embodiment of the present invention, the embodiment of the present invention is more by can solve communication device Communication interface cannot simultaneously connecting communication device the problem of, when being in the lock state there are some channel, other can be asked The channel for asking connection keeps the connection of the channel and communication device, so as to be rapidly switched to and communicate after channel unlocks The business processing of the external command in other channels of device connection, and make the non-exclusive mode of the communication of communication device.
It should be noted that passage lock can only have a kind of passage lock, i.e., outer lock and internal lock are not distinguished, it can also be both It again include internal lock including outer lock.So for a kind of only scene of passage lock, then in above-described embodiment if channel When being in the lock state, then illustrate to have added passage lock to the channel in advance, if channel is in the unlocked state, it is right in advance to illustrate The channel relieves passage lock.
In addition, the present invention can connect various communication interfaces simultaneously, so as to support to connect with various communication interfaces simultaneously The mostly application connect, realizes the use of more application scenarios, and neatly expanded application, to be applicable in mobile payment field instantly abundant Scape greatly enhances the applicability and widespread popularity of product;In addition, the means of communication and device of the invention can be compatible with current city All kinds of mainstream transaction platforms in field and terminal;For needing the communication interface of equipment power itself in the case where electricity sky, connection The communication interface of other external power supply power supplies, still may be implemented the communication of the interface;In addition, the present invention passes through to a variety of communications Independent encrypted tunnel is arranged in interface, and the communication channel of each communication interface and main control chip 12 is independent encryption, so that respectively The communication channel of a communication interface has obtained independent maintenance, realizes firewall isolation.
In addition, by adding outer lock, internal lock to channel, so as to prevent the conflict of shared resource from accessing;And draw Enter timeout mechanism, solves Deadlock;Ease for use and user friendly are very strong;In addition, the present invention also provides multichannel management, The multiple channel communication scheme of different security levels can be used according to different business scenario demands.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the method It closes, but those skilled in the art should understand that, embodiment of that present invention are not limited by the describe sequence of actions, because according to According to the embodiment of the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also should Know, the embodiments described in the specification are all preferred embodiments, and the related movement not necessarily present invention is implemented Necessary to example.
It is corresponding with method provided by the embodiments of the present invention, referring to Fig. 5, show a kind of communication device of the present invention The structural block diagram of embodiment, can specifically include following module:
First determining module 51 receives first for determining in multiple communication interfaces according to the default arrangement that puts in order The first object communication interface of external command;
Module 52 is kept, if connecing for there is the second target communication being in the lock state in the multiple communication interface Mouthful, then keep the connection of the communication device Yu the first object communication interface, wherein the first object communication interface and The second target communication interface is different;
First respond module 53, for will indicate there is locked communication interface in response to first external command Preset instructions are sent to the first object communication interface;
Poller module 54, if for detecting that the state of the second target communication interface switches to unlocked state, from It is arranged in the first communication interface after the last communication interface responded to start, according to the default circulation that puts in order Whether the multiple communication interface of poll receives external command, until being polled to the third target communication for receiving external command Interface, wherein the third target communication interface is any one in the multiple communication interface;
First Service Processing Module 55 carries out business processing for the external command to the third target communication interface.
Optionally, first determining module 51 is also used to after the external command in response to a communication interface, The multiple communication interfaces of poll, determination receives in the multiple communication interface according to the default arrangement that puts in order to be referred to outside first The first object communication interface of order.
Optionally, first determining module 51 includes:
First determines submodule, for determining according to default after the external command in response to a communication interface Put in order the communication interface that the last time in multiple communication interfaces of arrangement responded, from being arranged in the last responded First communication interface after communication interface starts, and is according to the default the multiple communication interface of cyclic polling that puts in order It is no to receive external command, until being polled to the first object communication interface for receiving the first external command.
Optionally, described device further include:
First switching module, if for the communication device and described second to be not detected in the first predetermined time period The application layer data of interaction, then switch to unlock shape for the state of the second target communication interface between target communication interface State.
Optionally, described device further include:
Second switching module, if for the communication device and described second to be not detected in the first predetermined time period The lock status inquiry instruction from host computer of interaction between target communication interface, then by the shape of the second target communication interface State switches to unlocked state.
Optionally, described device further include:
Receiving module, for receiving the unlock instruction to the second target communication interface from host computer, wherein institute Stating unlock instruction includes the second predetermined time period;
Second respond module, if for being not received by the second predetermined time period from second target communication The data interaction of interface is requested, then responds the unlock instruction for the state of the second target communication interface and switch to unlock shape State;
The poller module 54 includes:
Poll submodule, if for detecting that the state of the second target communication interface switches to unlocked state, from It is arranged in the communication interface after the last the second target communication interface responded to start, according to the default arrangement Whether the multiple communication interface of sequence cyclic polling receives external command, until being polled to the third for receiving external command Target communication interface.
Optionally, described device further include:
Third switching module, if for detect the corresponding operation flow abnormal ending of the second target communication interface, The physical connection of normal termination or host computer and the second target communication interface disconnects, then connects second target communication The state of mouth switches to unlocked state.
Optionally, described device further include:
Second determining module, for determining the corresponding operation flow of the third target communication interface;
Control module, if it include the browsing process to shared resource for the operation flow, and/or, host computer and use The operation flow that family interacts then controls the third target communication interface and is in the lock state.
Optionally, described device further include:
Creation module is locked, for outer lock and internal lock to be pre-created to each communication interface in multiple communication interfaces, Wherein, the outer lock has lock status attribute with counter attribute, internal lock;
4th switching module, for the state of the second target communication interface to be switched to unlock shape by lock state State;
4th switching module includes:
Submodule is reset, for when the counter attribute value of the outer lock of the second target communication interface is not zero, The counter attribute value is reset;
Submodule is removed, for when the lock status attribute value of the internal lock of the second target communication interface is not sky, The lock status attribute value of the internal lock of the second target communication interface is removed;
Optionally, the control module includes:
First setting submodule, it is pre- for increasing the counter attribute value of the outer lock of the third target communication interface If numerical value;And/or
Second setting submodule, for setting the lock status attribute value of the internal lock of the third target communication interface to Lock state.
Optionally, each communication interface be provided in advance individual link encryption key, and/or, storage region.
Optionally, the application program that different communication interfaces are supported is identical or different.
Optionally, the holding module 52 includes:
Second determines submodule, if for detecting the second mesh for existing in the multiple communication interface and being in the lock state Mark communication interface, it is determined that the second security level of the corresponding operation flow of the second target communication interface;
Third determines submodule, the first safety etc. for determining the corresponding operation flow of the first object communication interface Grade;
Submodule is kept, if being greater than or equal to second security level for first security level, keeps institute State the connection of communication device Yu the first object communication interface.
Optionally, described device further include:
Second Service Processing Module, if being less than second security level for first security level, to described First external command of first object communication interface carries out business processing.
Optionally, described device further include:
Third Service Processing Module, if for there is no the second targets being in the lock state in the multiple communication interface Communication interface then carries out business processing to first external command.
In the case that the present invention in multiple communication interfaces by having the communication interface of locking, then to receiving the at present The first object communication interface of one external command keeps the connection with communication device, and in response to first external command, by table Show that the preset instructions in the presence of locked communication interface are sent to the first object communication interface, thus there is no the communications of locking In the case where interface, can to the external command for the communication interface being polled to carry out fastext processing, communication device with it is upper Position machine is when being communicated, and is realized and connection while various communication interfaces, and the communication interface institute for ensuring communicated Corresponding operation flow is not interrupted by the service request of other communication interfaces.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simple Place illustrates referring to the part of embodiment of the method.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are with The difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can provide as method, apparatus or calculate Machine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer can With in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code The form of the computer program product of implementation.
The embodiment of the present invention be referring to according to the method for the embodiment of the present invention, terminal device (system) and computer program The flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructions In each flow and/or block and flowchart and/or the block diagram in process and/or box combination.It can provide these Computer program instructions are set to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminals Standby processor is to generate a machine, so that being held by the processor of computer or other programmable data processing terminal devices Capable instruction generates for realizing in one or more flows of the flowchart and/or one or more blocks of the block diagram The device of specified function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing terminal devices In computer-readable memory operate in a specific manner, so that instruction stored in the computer readable memory generates packet The manufacture of command device is included, which realizes in one side of one or more flows of the flowchart and/or block diagram The function of being specified in frame or multiple boxes.
These computer program instructions can also be loaded into computer or other programmable data processing terminal devices, so that Series of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thus The instruction executed on computer or other programmable terminal equipments is provided for realizing in one or more flows of the flowchart And/or in one or more blocks of the block diagram specify function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, once a person skilled in the art knows bases This creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted as Including preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrap Those elements are included, but also including other elements that are not explicitly listed, or further includes for this process, method, article Or the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limited Element, it is not excluded that there is also other identical elements in process, method, article or the terminal device for including the element.
Above to a kind of means of communication provided by the present invention and a kind of communication device, it is described in detail, herein Apply that a specific example illustrates the principle and implementation of the invention, the explanation of above example is only intended to help Understand method and its core concept of the invention;At the same time, for those skilled in the art, according to the thought of the present invention, There will be changes in the specific implementation manner and application range, in conclusion the content of the present specification should not be construed as to this The limitation of invention.

Claims (28)

1. a kind of means of communication, which is characterized in that be applied to communication device, which comprises
Determine that the first object that the first external command is received in multiple communication interfaces according to the default arrangement that puts in order communicates Interface;
If there is the second target communication interface being in the lock state in the multiple communication interface, the communication device is kept With the connection of the first object communication interface, wherein the first object communication interface and the second target communication interface It is different;
In response to first external command, it will indicate that the preset instructions that there is locked communication interface are sent to first mesh Mark communication interface;
If detecting, the state of the second target communication interface switches to unlocked state, is responded from the last time is arranged in Communication interface after first communication interface start, according to the default the multiple communication interface of cyclic polling that puts in order Whether external command is received, until being polled to the third target communication interface for receiving external command, wherein the third mesh Marking communication interface is any one in the multiple communication interface;
Business processing is carried out to the external command of the third target communication interface.
2. the method according to claim 1, wherein the determination is according to the multiple logical of the default arrangement that puts in order The first object communication interface of the first external command is received in communication interface, comprising:
After the external command in response to a communication interface, the multiple communication interfaces of poll are determined suitable according to default arrangement The first object communication interface of the first external command is received in the multiple communication interface of sequence arrangement.
3. according to the method described in claim 2, it is characterized in that, described whenever in response to the external command of a communication interface Later, the multiple communication interfaces of poll determine in the multiple communication interface according to the default arrangement that puts in order and receive first The first object communication interface of external command, comprising:
After the external command in response to a communication interface, determines and connect according to multiple communications of the default arrangement that puts in order The communication interface that the last time is responded in mouthful, the first communication after being arranged in the last communication interface responded connect Mouth starts, and whether external command is received according to the default the multiple communication interface of cyclic polling that puts in order, until wheel Ask the first object communication interface for receiving the first external command.
4. if the method according to claim 1, wherein the shape for detecting the second target communication interface State switches to unlocked state, then since the first communication interface being arranged in after the last communication interface responded, presses Whether external command is received according to the default the multiple communication interface of cyclic polling that puts in order, is received until being polled to Before the third target communication interface of external command, the method also includes:
If being interacted being not detected in the first predetermined time period between the communication device and the second target communication interface Application layer data, then the state of the second target communication interface is switched into unlocked state.
5. if the method according to claim 1, wherein the shape for detecting the second target communication interface State switches to unlocked state, then since the first communication interface being arranged in after the last communication interface responded, presses Whether external command is received according to the default the multiple communication interface of cyclic polling that puts in order, is received until being polled to Before the third target communication interface of external command, the method also includes:
If being interacted being not detected in the first predetermined time period between the communication device and the second target communication interface The lock status inquiry instruction from host computer, then the state of the second target communication interface is switched into unlocked state.
6. the method according to claim 1, wherein
If the state for detecting the second target communication interface switches to unlocked state, from being arranged in the last quilt First communication interface after the communication interface of response starts, according to the default the multiple communication of cyclic polling that puts in order Whether interface receives external command, until being polled to before the third target communication interface for receiving external command, the side Method further include:
Receive the unlock instruction to the second target communication interface from host computer, wherein the unlock instruction includes the Two predetermined time periods;
If being not received by the data interaction request from the second target communication interface in the second predetermined time period, It responds the unlock instruction and the state of the second target communication interface is switched into unlocked state;
If the state for detecting the second target communication interface switches to unlocked state, from being arranged in the last quilt First communication interface after the communication interface of response starts, according to the default the multiple communication of cyclic polling that puts in order Whether interface receives external command, until being polled to the third target communication interface for receiving external command, comprising:
If detecting, the state of the second target communication interface switches to unlocked state, is responded from the last time is arranged in The second target communication interface after communication interface start, it is the multiple according to the default cyclic polling that puts in order Whether communication interface receives external command, until being polled to the third target communication interface for receiving external command.
7. if the method according to claim 1, wherein the shape for detecting the second target communication interface State switches to unlocked state, then since the first communication interface being arranged in after the last communication interface responded, presses Whether external command is received according to the default the multiple communication interface of cyclic polling that puts in order, is received until being polled to Before the third target communication interface of external command, the method also includes:
If detecting the corresponding operation flow abnormal ending of the second target communication interface, normal termination or host computer and institute The physical connection for stating the second target communication interface disconnects, then the state of the second target communication interface is switched to unlock shape State.
8. the method according to claim 1, wherein the external command to the third target communication interface Before carrying out business processing, the method also includes:
Determine the corresponding operation flow of the third target communication interface;
If the operation flow includes the browsing process to shared resource, and/or, the Business Stream that host computer is interacted with user Journey then controls the third target communication interface and is in the lock state.
9. according to the method described in claim 8, it is characterized in that,
The determination receives the first object of the first external command in multiple communication interfaces according to the default arrangement that puts in order Before communication interface, the method also includes:
Outer lock and internal lock are pre-created to each communication interface in multiple communication interfaces, wherein the outer lock has Counter attribute, internal lock have lock status attribute;
If the state for detecting the second target communication interface switches to unlocked state, from being arranged in the last quilt First communication interface after the communication interface of response starts, according to the default the multiple communication of cyclic polling that puts in order Whether interface receives external command, until being polled to before the third target communication interface for receiving external command, the side Method further include:
The state of the second target communication interface is switched into unlocked state by lock state;
The state by the second target communication interface switches to unlocked state by lock state, comprising:
It is when the counter attribute value of the outer lock of the second target communication interface is not zero, the counter attribute value is clear Zero;
When the lock status attribute value of the internal lock of the second target communication interface is not sky, second target communication is connect The lock status attribute value of the internal lock of mouth is removed;
The control third target communication interface is in the lock state, comprising:
The counter attribute value of the outer lock of the third target communication interface is increased into default value;And/or
Lock state is set by the lock status attribute value of the internal lock of the third target communication interface.
10. adding the method according to claim 1, wherein each communication interface is provided with individual link in advance Key, and/or, storage region.
11. the method according to claim 1, wherein the application program supported of different communication interface is identical or not Together.
12. if the method according to claim 1, wherein exist in the multiple communication interface in lock The the second target communication interface for determining state, then keep the connection of the communication device Yu the first object communication interface, comprising:
There is the second target communication interface for being in the lock state in the multiple communication interface if detecting, it is determined that described the Second security level of the corresponding operation flow of two target communication interfaces;
Determine the first security level of the corresponding operation flow of the first object communication interface;
If first security level is greater than or equal to second security level, the communication device and described first are kept The connection of target communication interface.
13. according to the method for claim 12, which is characterized in that the determination first object communication interface is corresponding After first security level of operation flow, the method also includes:
If first security level is less than second security level, outside the first of the first object communication interface Order carries out business processing.
14. the method according to claim 1, wherein the determination is according to default the multiple of arrangement that put in order After the first object communication interface for receiving the first external command in communication interface, the method also includes:
If there is no the second target communication interfaces being in the lock state in the multiple communication interface, outside described first Instruction carries out business processing.
15. a kind of communication device characterized by comprising
First determining module refers to outside first for determining to receive in multiple communication interfaces according to the default arrangement that puts in order The first object communication interface of order;
Module is kept, if protecting for there is the second target communication interface being in the lock state in the multiple communication interface Hold the connection of the communication device Yu the first object communication interface, wherein the first object communication interface and described the Two target communication interfaces are different;
First respond module, for will indicate the default finger that there is locked communication interface in response to first external command Order is sent to the first object communication interface;
Poller module, if for detecting that the state of the second target communication interface switches to unlocked state, from being arranged in First communication interface after the communication interface that the last time is responded starts, according to the default cyclic polling institute that puts in order State whether multiple communication interfaces receive external command, until it is polled to the third target communication interface for receiving external command, Wherein, the third target communication interface is any one in the multiple communication interface;
First Service Processing Module carries out business processing for the external command to the third target communication interface.
16. device according to claim 15, which is characterized in that
First determining module is also used to after the external command in response to a communication interface, the multiple communications of poll Interface determines the first object that the first external command is received in the multiple communication interface according to the default arrangement that puts in order Communication interface.
17. device according to claim 16, which is characterized in that first determining module includes:
First determines submodule, for determining according to default arrangement after the external command in response to a communication interface The communication interface that the last time is responded in tactic multiple communication interfaces, from being arranged in the last communication responded Whether the first communication interface after interface starts, connect according to the default the multiple communication interface of cyclic polling that puts in order External command is received, until being polled to the first object communication interface for receiving the first external command.
18. device according to claim 15, which is characterized in that described device further include:
First switching module, if for the communication device and second target to be not detected in the first predetermined time period The application layer data of interaction, then switch to unlocked state for the state of the second target communication interface between communication interface.
19. device according to claim 15, which is characterized in that described device further include:
Second switching module, if for the communication device and second target to be not detected in the first predetermined time period The lock status inquiry instruction from host computer of interaction, then cut the state of the second target communication interface between communication interface Shift to unlocked state.
20. device according to claim 15, which is characterized in that described device further include:
Receiving module, for receiving the unlock instruction to the second target communication interface from host computer, wherein the solution Lock instruction includes the second predetermined time period;
Second respond module, if for being not received by the second predetermined time period from the second target communication interface Data interaction request, then respond the unlock instruction for the state of the second target communication interface and switch to unlocked state;
The poller module includes:
Poll submodule, if for detecting that the state of the second target communication interface switches to unlocked state, from arrangement Communication interface after the second target communication interface that the last time is responded starts, and puts in order according to described preset Whether the multiple communication interface of cyclic polling receives external command, until being polled to the third target for receiving external command Communication interface.
21. device according to claim 15, which is characterized in that described device further include:
Third switching module, if for detecting the corresponding operation flow abnormal ending of the second target communication interface, normal Terminate or the physical connection of host computer and the second target communication interface disconnects, then by the second target communication interface State switches to unlocked state.
22. device according to claim 15, which is characterized in that described device further include:
Second determining module, for determining the corresponding operation flow of the third target communication interface;
Control module, if include the browsing process to shared resource for the operation flow, and/or, host computer and user into The operation flow of row interaction, then control the third target communication interface and be in the lock state.
23. device according to claim 22, which is characterized in that described device further include:
Creation module is locked, for outer lock and internal lock to be pre-created to each communication interface in multiple communication interfaces, wherein The outer lock has lock status attribute with counter attribute, internal lock;
4th switching module, for the state of the second target communication interface to be switched to unlocked state by lock state;
4th switching module includes:
Submodule is reset, for when the counter attribute value of the outer lock of the second target communication interface is not zero, by institute State the clearing of counter attribute value;
Submodule is removed, for when the lock status attribute value of the internal lock of the second target communication interface is not sky, by institute The lock status attribute value for stating the internal lock of the second target communication interface is removed;
The control module includes:
First setting submodule, for the counter attribute value of the outer lock of the third target communication interface to be increased present count Value;And/or
Second setting submodule, for the lock status attribute value of the internal lock of the third target communication interface to be set as locking State.
24. device according to claim 15, which is characterized in that each communication interface is provided with individual link in advance and adds Key, and/or, storage region.
25. device according to claim 15, which is characterized in that the application program that different communication interfaces are supported is identical or not Together.
26. device according to claim 15, which is characterized in that the holding module includes:
Second determines submodule, if for detecting that the second target for existing in the multiple communication interface and being in the lock state is led to Communication interface, it is determined that the second security level of the corresponding operation flow of the second target communication interface;
Third determines submodule, for determining the first security level of the corresponding operation flow of the first object communication interface;
Submodule is kept, if being greater than or equal to second security level for first security level, keeps described logical Interrogate the connection of device and the first object communication interface.
27. device according to claim 26, which is characterized in that described device further include:
Second Service Processing Module, if being less than second security level for first security level, to described first First external command of target communication interface carries out business processing.
28. device according to claim 15, which is characterized in that described device further include:
Third Service Processing Module, if for there is no the second target communications being in the lock state in the multiple communication interface Interface then carries out business processing to first external command.
CN201810893151.2A 2018-08-07 2018-08-07 Communication method and device Active CN109165182B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810893151.2A CN109165182B (en) 2018-08-07 2018-08-07 Communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810893151.2A CN109165182B (en) 2018-08-07 2018-08-07 Communication method and device

Publications (2)

Publication Number Publication Date
CN109165182A true CN109165182A (en) 2019-01-08
CN109165182B CN109165182B (en) 2020-06-30

Family

ID=64895350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810893151.2A Active CN109165182B (en) 2018-08-07 2018-08-07 Communication method and device

Country Status (1)

Country Link
CN (1) CN109165182B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110472200A (en) * 2019-07-29 2019-11-19 深圳市中兴新云服务有限公司 A kind of data processing method based on list, device and electronic equipment
CN112783954A (en) * 2019-11-06 2021-05-11 北京金山云网络技术有限公司 Data access method and device and server
CN115827080A (en) * 2023-02-15 2023-03-21 南方电网产业投资集团有限责任公司 Embedded equipment adaptation method and device based on serial port communication and computer equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1959664A (en) * 2006-10-31 2007-05-09 埃派克森微电子(上海)有限公司 Automatic method for identifying signal interfaces of electronic equipment
CN101159448A (en) * 2007-11-06 2008-04-09 华为技术有限公司 Communication line testing method and system
US20090006657A1 (en) * 2007-06-26 2009-01-01 Asad Azam Enabling consecutive command message transmission to different devices
CN103207964A (en) * 2013-03-15 2013-07-17 飞天诚信科技股份有限公司 Multifunctional intelligent key device and operating method thereof
CN104198788A (en) * 2014-09-09 2014-12-10 南京捷希科技有限公司 VNA (Vector Network Analyzer) multiplexing instrument and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1959664A (en) * 2006-10-31 2007-05-09 埃派克森微电子(上海)有限公司 Automatic method for identifying signal interfaces of electronic equipment
US20090006657A1 (en) * 2007-06-26 2009-01-01 Asad Azam Enabling consecutive command message transmission to different devices
CN101159448A (en) * 2007-11-06 2008-04-09 华为技术有限公司 Communication line testing method and system
CN103207964A (en) * 2013-03-15 2013-07-17 飞天诚信科技股份有限公司 Multifunctional intelligent key device and operating method thereof
CN104198788A (en) * 2014-09-09 2014-12-10 南京捷希科技有限公司 VNA (Vector Network Analyzer) multiplexing instrument and method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110472200A (en) * 2019-07-29 2019-11-19 深圳市中兴新云服务有限公司 A kind of data processing method based on list, device and electronic equipment
CN110472200B (en) * 2019-07-29 2023-10-27 深圳市中兴新云服务有限公司 Form-based data processing method and device and electronic equipment
CN112783954A (en) * 2019-11-06 2021-05-11 北京金山云网络技术有限公司 Data access method and device and server
CN112783954B (en) * 2019-11-06 2024-04-05 北京金山云网络技术有限公司 Data access method, device and server
CN115827080A (en) * 2023-02-15 2023-03-21 南方电网产业投资集团有限责任公司 Embedded equipment adaptation method and device based on serial port communication and computer equipment

Also Published As

Publication number Publication date
CN109165182B (en) 2020-06-30

Similar Documents

Publication Publication Date Title
CN109165182A (en) The means of communication and device
US8606943B2 (en) Method for processing application commands from physical channels using a portable electronic device and corresponding device and system
CN109952751B (en) Safe processor chip and terminal equipment
EP2377291B1 (en) Portable mobile communication device and method of controlling near field communication
CN106548077A (en) Communication system and electronic equipment
TWI572218B (en) Electronic device, controller and control method for nfc
EP3007066A1 (en) Method for using shared device in apparatus capable of operating two operating systems
JP6001099B2 (en) System and method for performing a peer-to-peer connection
EP3155554B1 (en) Electronic device, system and method for nfc
US10601720B2 (en) Integrated circuit radio devices
CN101661654A (en) Method for securing a transaction performed with a programmable portable device
KR20210005653A (en) Terminal application activation method, device and system
US7975057B2 (en) Time management at communication protocol layer for a smart card-type device
CN111586651B (en) Method for managing priority in context, electronic device and communication system
JP5690927B2 (en) Method and system for processing a plurality of wireless communication streams by an integrated circuit card
EP3236393B1 (en) Control of an external interface on a card
CN105264494A (en) Authentication processing device and method
CN106972950A (en) Quality information service end and the quality information management system comprising it
JP3849036B2 (en) Card reader and card reader communication control method
KR101504498B1 (en) Operating method of vending machine
JP6631370B2 (en) Microcomputer and electronic control unit
CN115134423A (en) Cipher card communication system and method
CN107391413A (en) Synchronous zero-waiting bus and its access method
WO2002001345A2 (en) Method and apparatus for arbitration of concurrent processes in multiprocessor systems

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
GR01 Patent grant
GR01 Patent grant