CN104317761A - Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment - Google Patents

Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment Download PDF

Info

Publication number
CN104317761A
CN104317761A CN201410584525.4A CN201410584525A CN104317761A CN 104317761 A CN104317761 A CN 104317761A CN 201410584525 A CN201410584525 A CN 201410584525A CN 104317761 A CN104317761 A CN 104317761A
Authority
CN
China
Prior art keywords
unit
power
apple
usb
control unit
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
CN201410584525.4A
Other languages
Chinese (zh)
Other versions
CN104317761B (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201410584525.4A priority Critical patent/CN104317761B/en
Publication of CN104317761A publication Critical patent/CN104317761A/en
Application granted granted Critical
Publication of CN104317761B publication Critical patent/CN104317761B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/266Arrangements to supply power to external peripherals either directly from the computer or under computer control, e.g. supply of power through the communication port, computer controlled power-strips
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Power Sources (AREA)

Abstract

本发明公开了一种带有电源管理的多接口移动安全设备及其工作方法,属于信息安全领域。所述移动安全设备包括:USB接口模块、苹果接口模块、电池模块、电源管理模块和功能模块。所述方法包括:所述移动安全设备可以通过苹果接口、USB接口与上位机连接,通过苹果接口、USB接口接收上位机发送的数据,将上位机发送的数据发送给卡片,接收卡片返回的数据,将卡片返回的数据通过苹果接口、USB接口返回给上位机。本发明的有益效果在于:实现移动安全设备既能应用于PC又能应用于具有苹果接口的智能终端,跨平台的应用,为使用者提供了便利,并且可以减少硬件成本,节约硬件资源。

The invention discloses a multi-interface mobile security device with power supply management and a working method thereof, belonging to the field of information security. The mobile security device includes: a USB interface module, an Apple interface module, a battery module, a power management module and a function module. The method includes: the mobile security device can be connected to the host computer through the Apple interface and the USB interface, receive the data sent by the host computer through the Apple interface and the USB interface, send the data sent by the host computer to the card, and receive the data returned by the card , and return the data returned by the card to the host computer through the Apple interface and the USB interface. The beneficial effect of the present invention is that the mobile security device can be applied to both the PC and the intelligent terminal with the Apple interface, and the cross-platform application provides convenience for users, and can reduce hardware costs and save hardware resources.

Description

一种带有电源管理的多接口移动安全设备及其工作方法A multi-interface mobile security device with power management and its working method

技术领域technical field

本发明属于信息安全领域,特别涉及一种带有电源管理的多接口移动安全设备及其工作方法。The invention belongs to the field of information security, in particular to a multi-interface mobile security device with power management and a working method thereof.

背景技术Background technique

随着移动和互联网技术,以及智能终端的发展,催生了通过连接计算机或智能手机等通用设备,为消费者和商户提供有卡在线支付和微型刷卡器收单方案的移动安全设备,目前,上述移动安全设备通常被分为两类,一种是基于互联网渠道,通过USB接口与PC机相连,另一种是通过音频接口、苹果接口或蓝牙与智能手机等移动设备进行通讯,但并没有全受理和跨平台的移动安全设备。With the development of mobile and Internet technology, as well as smart terminals, mobile security devices that provide consumers and merchants with card online payment and micro-card reader acquisition solutions by connecting general devices such as computers or smart phones have emerged. At present, the above-mentioned Mobile security devices are generally divided into two categories, one is based on the Internet channel and is connected to a PC through a USB interface, and the other is to communicate with mobile devices such as smart phones through an audio interface, Apple interface or Bluetooth, but there is no comprehensive Admissible and cross-platform mobile security devices.

发明内容Contents of the invention

本发明的目的是为了克服现有技术的缺陷,提出一种带有电源管理的多接口移动安全设备及其工作方法。The purpose of the present invention is to overcome the defects of the prior art, and propose a multi-interface mobile security device with power management and its working method.

本发明方法是通过下述技术方案实现的:The inventive method is realized by the following technical solutions:

一种带有电源管理的多接口移动安全设备,具体包括:A multi-interface mobile security device with power management, including:

USB接口模块、苹果接口模块、电池模块、电源管理模块和功能模块;USB interface module, Apple interface module, battery module, power management module and function module;

所述USB接口模块,与所述电池模块、所述电源管理模块和所述功能模块相连,用于与上位机连接,从上位机获取电能,用获取到的电能对所述电池模块充电以及通过所述电源管理模块向所述功能模块供电,与所述功能模块和上位机进行通讯;The USB interface module is connected with the battery module, the power management module and the functional module, and is used to connect with the upper computer, obtain electric energy from the upper computer, use the obtained electric energy to charge the battery module, and pass The power management module supplies power to the functional module, and communicates with the functional module and the host computer;

所述苹果接口模块,与所述电源管理模块和所述功能模块相连,用于与上位机连接,从上位机获取电能,用获取到的电能通过所述电源管理模块向所述功能模块供电,与所述功能模块和上位机进行通讯;The apple interface module is connected with the power management module and the functional module, and is used to connect with the upper computer, obtain electric energy from the upper computer, and use the obtained electric energy to supply power to the functional module through the power management module, Communicate with the functional module and the host computer;

所述电池模块,与所述USB接口模块和所述电源管理模块相连,用于当所述设备仅通过所述苹果接口模块与上位机连接时,通过所述电源管理模块向所述功能模块供电;The battery module is connected to the USB interface module and the power management module, and is used to supply power to the functional module through the power management module when the device is only connected to the host computer through the Apple interface module ;

所述电源管理模块,与所述USB接口模块、所述苹果接口模块、所述电池模块和所述功能模块相连,用于当所述USB接口模块与上位机连接时,控制由所述USB接口模块用从上位机获取到的电能为所述功能模块供电,以及当所述设备仅通过所述苹果接口模块与上位机连接时,控制由所述电池模块用储存的电能、所述苹果接口模块用从上位机获取到的电能共同为所述功能模块供电;The power management module is connected with the USB interface module, the Apple interface module, the battery module and the function module, and is used to control the power supply by the USB interface when the USB interface module is connected to the upper computer. The module uses the electric energy obtained from the upper computer to supply power to the functional module, and when the device is only connected to the upper computer through the apple interface module, it controls the electric energy stored by the battery module, the apple interface module Using the electric energy obtained from the upper computer to jointly supply power to the functional modules;

所述功能模块,与所述USB接口模块、所述苹果接口模块和所述电源管理模块相连,用于与所述USB接口模块、所述苹果接口模块和卡片进行通讯。The function module is connected with the USB interface module, the Apple interface module and the power management module, and is used for communicating with the USB interface module, the Apple interface module and the card.

一种带有电源管理的多接口移动安全设备的工作方法,其基本实施过程如下:A working method of a multi-interface mobile security device with power management, the basic implementation process is as follows:

所述设备上电初始化后,设备的功能模块执行以下步骤:After the device is powered on and initialized, the functional modules of the device perform the following steps:

步骤A1、打开USB接入中断和苹果接入中断;Step A1, open USB access interrupt and Apple access interrupt;

当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则打开USB数据接收中断,若为低电压则关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则打开苹果数据接收中断,若为低电压则关闭所述苹果数据接收中断;When the USB interface is inserted or pulled out, the USB access interruption is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB data reception interruption is opened, and if it is a low voltage, the USB data reception interruption is closed; When the apple interface is inserted or pulled out, the apple access interruption is triggered, and the power supply voltage of the apple interface is checked. If it is high voltage, the apple data reception interruption is opened, and if it is low voltage, the apple data reception interruption is closed;

当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set;

步骤A2、检查所述USB接收标志是否被置位,是则复位所述USB接收标志,置位USB标志,执行步骤A4,否则执行步骤A3;Step A2, check whether the USB receiving flag is set, if so, reset the USB receiving flag, set the USB flag, and execute step A4, otherwise execute step A3;

步骤A3、检查所述苹果接收标志是否被置位,是则复位所述苹果接收标志,置位苹果标志,执行步骤A4,否则返回步骤A2;Step A3, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step A4, otherwise return to step A2;

步骤A4、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤A5,否则将提示无卡的信息作为返回数据,执行步骤A5;Step A4. Determine whether there is a card connected to the device. If yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step A5. Otherwise, the message indicating that there is no card is used as Return the data and execute step A5;

步骤A5、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤A2;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤A2。Step A5, check the USB sign and the Apple sign, if the USB sign is set, return the return data to the host computer through the USB interface, reset the USB sign, and return to step A2; if the Apple sign is set bit, then return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step A2.

或者,所述设备上电初始化后,所述功能模块执行以下步骤:Alternatively, after the device is powered on and initialized, the functional module performs the following steps:

步骤B1、打开USB接入中断和苹果接入中断;Step B1, open USB access interrupt and Apple access interrupt;

当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则打开USB数据接收中断,若为低电压则关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则打开苹果数据接收中断,若为低电压则关闭所述苹果数据接收中断;When the USB interface is inserted or pulled out, the USB access interruption is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB data reception interruption is opened, and if it is a low voltage, the USB data reception interruption is closed; When the apple interface is inserted or pulled out, the apple access interruption is triggered, and the power supply voltage of the apple interface is checked. If it is high voltage, the apple data reception interruption is opened, and if it is low voltage, the apple data reception interruption is closed;

当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set;

步骤B2、检查所述苹果接收标志是否被置位,是则复位所述苹果接收标志,置位苹果标志,执行步骤B4,否则执行步骤B3;Step B2, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step B4, otherwise execute step B3;

步骤B3、检查所述USB接收标志是否被置位,是则复位所述USB接收标志,置位USB标志,执行步骤B4,否则返回步骤B2;Step B3, check whether the USB reception flag is set, if yes, reset the USB reception flag, set the USB flag, and execute step B4, otherwise return to step B2;

步骤B4、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤B5,否则将提示无卡的信息作为返回数据,执行步骤B5;Step B4, determine whether there is a card connected to the device, if yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step B5, otherwise, the message indicating that there is no card is used as Return the data and execute step B5;

步骤B5、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤B2;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤B2。Step B5, check the USB sign and the Apple sign, if the USB sign is set, return data to the host computer through the USB interface, reset the USB sign, and return to step B2; if the Apple sign is set bit, then return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step B2.

或者,所述设备上电初始化后,所述功能模块执行以下步骤:Alternatively, after the device is powered on and initialized, the functional module performs the following steps:

步骤C1、打开USB接入中断和苹果接入中断;Step C1, open USB access interrupt and Apple access interrupt;

当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则置位USB接入标志,打开USB数据接收中断,若为低电压则复位所述USB接入标志,关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则置位苹果接入标志,打开苹果数据接收中断,若为低电压则复位所述苹果接入标志,关闭所述苹果数据接收中断;When the USB interface is plugged in or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB access flag is set, and the USB data receiving interrupt is turned on. If it is a low voltage, the interrupt is reset. Said USB access sign, closes said USB data receiving interruption; When the apple interface is plugged in or pulled out, said apple access interruption is triggered, checks the power supply voltage of the apple interface, if it is high voltage, then sets the apple access sign , open the apple data receiving interrupt, if it is low voltage, reset the apple access sign, and close the apple data receiving interrupt;

当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set;

步骤C2、检查所述USB接入标志是否被置位,是则执行步骤C3,否则执行步骤C4;Step C2, check whether the USB access flag is set, if yes, execute step C3, otherwise execute step C4;

步骤C3、检查所述USB接收标志是否被置位,是则复位所述USB接收标志,置位USB标志,执行步骤C6,否则返回步骤C2;Step C3, check whether the USB receiving flag is set, if yes, reset the USB receiving flag, set the USB flag, execute step C6, otherwise return to step C2;

步骤C4、检查所述苹果接入标志是否被置位,是则执行步骤C5,否则返回步骤C2;Step C4, check whether the Apple access flag is set, if yes, execute step C5, otherwise return to step C2;

步骤C5、检查所述苹果接收标志是否被置位,是则复位所述苹果接收标志,置位苹果标志,执行步骤C6,否则返回步骤C4;Step C5, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step C6, otherwise return to step C4;

步骤C6、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤C7,否则将提示无卡的信息作为返回数据,执行步骤C7;Step C6, determine whether there is a card connected to the device, if yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step C7, otherwise, the message indicating that there is no card is used as return data, execute step C7;

步骤C7、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤C2;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤C4。Step C7, check the USB sign and the Apple sign, if the USB sign is set, return the return data to the host computer through the USB interface, reset the USB sign, and return to step C2; if the Apple sign is set bit, then return the returned data to the host computer through the apple interface, reset the apple sign, and return to step C4.

或者,所述设备上电初始化后,所述功能模块执行以下步骤:Alternatively, after the device is powered on and initialized, the functional module performs the following steps:

步骤D1、打开USB接入中断和苹果接入中断;Step D1, open USB access interrupt and Apple access interrupt;

当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则置位USB接入标志,打开USB数据接收中断,若为低电压则复位所述USB接入标志,关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则置位苹果接入标志,打开苹果数据接收中断,若为低电压则复位所述苹果接入标志,关闭所述苹果数据接收中断;When the USB interface is plugged in or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB access flag is set, and the USB data receiving interrupt is turned on. If it is a low voltage, the interrupt is reset. Said USB access sign, closes said USB data receiving interruption; When the apple interface is plugged in or pulled out, said apple access interruption is triggered, checks the power supply voltage of the apple interface, if it is high voltage, then sets the apple access sign , open the apple data receiving interrupt, if it is low voltage, reset the apple access sign, and close the apple data receiving interrupt;

当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set;

步骤D2、检查所述苹果接入标志是否被置位,是则执行步骤D3,否则执行步骤D4;Step D2, check whether the apple access flag is set, if yes, execute step D3, otherwise execute step D4;

步骤D3、检查所述苹果接收标志是否被置位,是则复位苹果接收标志,置位苹果标志,执行步骤D6,否则返回步骤D2;Step D3, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step D6, otherwise return to step D2;

步骤D4、检查所述USB接入标志是否被置位,是则执行步骤D5,否则返回步骤D2;Step D4, check whether the USB access flag is set, if yes, execute step D5, otherwise return to step D2;

步骤D5、检查所述USB接收标志是否被置位,是则复位USB接收标志,置位USB标志,执行步骤D6,否则返回步骤D4;Step D5, check whether the USB receiving flag is set, if yes, reset the USB receiving flag, set the USB flag, execute step D6, otherwise return to step D4;

步骤D6、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤D7,否则将提示无卡的信息作为返回数据,执行步骤D7;Step D6, determine whether there is a card connected to the device, if yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step D7, otherwise, the message indicating that there is no card is used as Return data, execute step D7;

步骤D7、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤D4;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤D2。Step D7, check the USB sign and the Apple sign, if the USB sign is set, return the return data to the host computer through the USB interface, reset the USB sign, and return to step D4; if the Apple sign is set bit, then return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step D2.

本发明方法的有益效果在于:本发明提供一种支持USB接口和苹果接口的移动安全设备及其工作方法,实现移动安全设备既能应用于PC又能应用于具有苹果接口的智能终端,跨平台的应用,为使用者提供了便利,同时可以减少硬件成本,节约硬件资源。The beneficial effect of the method of the present invention is that: the present invention provides a mobile security device supporting a USB interface and an Apple interface and a working method thereof, so that the mobile security device can be applied to both a PC and an intelligent terminal with an Apple interface, cross-platform The application provides convenience for users, and at the same time can reduce hardware costs and save hardware resources.

附图说明Description of drawings

为了更清楚的说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1为本发明实施例1提供的一种带有电源管理的多接口移动安全设备的方框图;FIG. 1 is a block diagram of a multi-interface mobile security device with power management provided by Embodiment 1 of the present invention;

图2为本发明实施例2提供的一种带有电源管理的多接口移动安全设备的方框图;FIG. 2 is a block diagram of a multi-interface mobile security device with power management provided by Embodiment 2 of the present invention;

图3为本发明实施例3提供的一种带有电源管理的多接口移动安全设备的方框图;FIG. 3 is a block diagram of a multi-interface mobile security device with power management provided by Embodiment 3 of the present invention;

图4为本发明实施例4提供的一种带有电源管理的多接口移动安全设备的方框图;FIG. 4 is a block diagram of a multi-interface mobile security device with power management provided by Embodiment 4 of the present invention;

图5为本发明实施例6提供的一种带有电源管理的多接口移动安全设备的工作方法的流程图;FIG. 5 is a flowchart of a working method of a multi-interface mobile security device with power management provided by Embodiment 6 of the present invention;

图6为本发明实施例8提供的一种带有电源管理的多接口移动安全设备的工作方法的流程图;FIG. 6 is a flowchart of a working method of a multi-interface mobile security device with power management provided by Embodiment 8 of the present invention;

图7为本发明实施例10中提供的定时读卡中断处理流程的流程图;7 is a flow chart of the timing card reading interruption processing flow provided in Embodiment 10 of the present invention;

图8为本发明实施例12中提供的定时读卡中断处理流程的流程图。FIG. 8 is a flow chart of the timing card reading interruption processing flow provided in Embodiment 12 of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present invention.

实施例1Example 1

本发明实施例1提供了一种带有电源管理的多接口移动安全设备,设备带有电池,并具有两个物理接口:USB接口和苹果接口。参见图1,本发明实施例1中提供的设备具体包括:Embodiment 1 of the present invention provides a multi-interface mobile security device with power management. The device has a battery and has two physical interfaces: a USB interface and an Apple interface. Referring to Figure 1, the equipment provided in Embodiment 1 of the present invention specifically includes:

USB接口模块1,与电池模块3、电源管理模块4和功能模块5相连,用于与上位机连接,从上位机获取电能,用获取到的电能对电池模块3充电和通过电源管理模块4向功能模块5供电,与功能模块5和上位机进行通讯;The USB interface module 1 is connected with the battery module 3, the power management module 4 and the function module 5, and is used for connecting with the host computer, obtaining electric energy from the upper computer, charging the battery module 3 with the obtained electric energy and passing the power management module 4 to The functional module 5 supplies power and communicates with the functional module 5 and the host computer;

苹果接口模块2,与电源管理模块4和功能模块5相连,用于与上位机连接,从上位机获取电能,用获取到的电能通过电源管理模块4向功能模块5供电,与功能模块5和上位机进行通讯;The apple interface module 2 is connected with the power management module 4 and the function module 5, and is used to connect with the upper computer, obtain electric energy from the upper computer, use the obtained electric energy to supply power to the function module 5 through the power management module 4, and connect with the function module 5 and the function module 5. The host computer communicates;

电池模块3,与USB接口模块1和电源管理模块4相连,用于当设备仅通过苹果接口模块2与上位机连接时,通过电源管理模块4向功能模块5供电;The battery module 3 is connected to the USB interface module 1 and the power management module 4, and is used to supply power to the function module 5 through the power management module 4 when the device is only connected to the host computer through the Apple interface module 2;

电源管理模块4,与USB接口模块1、苹果接口模块2、电池模块3和功能模块5相连,用于当USB接口模块1与上位机连接时,控制由USB接口模块1用从上位机获取到的电能为功能模块5供电,以及当设备仅通过苹果接口模块2与上位机连接时,控制由电池模块3用储存的电能、苹果接口模块2用从上位机获取到的电能共同为功能模块5供电;The power management module 4 is connected with the USB interface module 1, the apple interface module 2, the battery module 3 and the function module 5, and is used to control the power obtained from the host computer by the USB interface module 1 when the USB interface module 1 is connected to the host computer. The electric energy provided by the battery module 5 supplies power for the functional module 5, and when the device is only connected to the host computer through the Apple interface module 2, the battery module 3 is controlled to use the stored electric energy, and the Apple interface module 2 uses the electric energy obtained from the upper computer to jointly form the functional module 5 powered by;

功能模块5,与USB接口模块1、苹果接口模块2和电源管理模块4相连,用于与USB接口模块1、苹果接口模块2和卡片进行通讯。The function module 5 is connected with the USB interface module 1, the Apple interface module 2 and the power management module 4, and is used for communicating with the USB interface module 1, the Apple interface module 2 and the card.

本发明实施例1提供的设备在USB接口与上位机连接时,设备通过USB接口从上位机获取电能为设备供电,当设备仅通过苹果接口与上位机连接时,设备通过苹果接口从上位机获取电能,与电池一起为设备供电。When the device provided by Embodiment 1 of the present invention is connected to the host computer through the USB interface, the device obtains power from the host computer through the USB interface to supply power for the device. When the device is only connected to the host computer through the Apple interface, the device obtains power from the host computer through the Apple interface. Electrical energy, which together with the battery powers the device.

进一步地,本实施例中,功能模块5还用于当设备仅通过苹果接口模块2与上位机连接,且设备功耗较高时,向电源管理模块4发送控制信号;相应地:Further, in this embodiment, the function module 5 is also used to send a control signal to the power management module 4 when the device is only connected to the host computer through the Apple interface module 2 and the power consumption of the device is high; correspondingly:

电源管理模块4用于当USB接口模块1与上位机连接时,控制由USB接口模块1用从上位机获取到的电能为功能模块5供电,当设备仅通过苹果接口模块2与上位机连接时,控制由苹果接口模块2用从上位机获取到的电能为功能模块5供电,以及当接收到功能模块5发送的控制信号时,控制电池模块3用储存的电能与苹果接口模块2共同为功能模块5供电。The power management module 4 is used to control the USB interface module 1 to supply power to the functional module 5 with the power obtained from the host computer when the USB interface module 1 is connected to the host computer. When the device is only connected to the host computer through the Apple interface module 2 , control the Apple interface module 2 to supply power to the function module 5 with the electric energy obtained from the upper computer, and when receiving the control signal sent by the function module 5, control the battery module 3 to use the stored electric energy to work together with the Apple interface module 2 Module 5 supplies power.

本发明实施例1提供的移动安全设备对供电系统进行了设计,使得苹果接口和USB接口在移动安全设备上的整合成为可能。The mobile security device provided by Embodiment 1 of the present invention has a power supply system designed so that the integration of the Apple interface and the USB interface on the mobile security device becomes possible.

实施例2Example 2

本发明实施例2在实施例1的基础上提供一种带有电源管理的多接口移动安全设备。参见图2,所述设备具体包括:USB接口模块11、苹果接口模块12、电池模块13、电源管理模块14和功能模块15;其中,USB接口模块11与电池模块13、电源管理模块14和功能模块15相连,苹果接口模块12与电源管理模块14和功能模块15相连,电池模块13与USB接口模块11和电源管理模块14相连,电源管理模块14与USB接口模块11、苹果接口模块12、电池模块13和功能模块15连接,功能模块15与USB接口模块11、苹果接口模块12和电源管理模块14相连。Embodiment 2 of the present invention provides a multi-interface mobile security device with power management on the basis of Embodiment 1. Referring to Fig. 2, described equipment specifically comprises: USB interface module 11, apple interface module 12, battery module 13, power management module 14 and function module 15; Wherein, USB interface module 11 and battery module 13, power management module 14 and function Module 15 is connected, and apple interface module 12 is connected with power management module 14 and function module 15, and battery module 13 is connected with USB interface module 11 and power management module 14, and power management module 14 is connected with USB interface module 11, apple interface module 12, battery Module 13 is connected to function module 15 , and function module 15 is connected to USB interface module 11 , Apple interface module 12 and power management module 14 .

具体地,苹果接口模块12包括苹果接口单元121和苹果通讯单元122;电池模块13包括充电管理单元131和电池单元132;电源管理模块14包括供电自动切换电路单元141、电压隔离单元142、系统电源管理单元143和供电隔离单元144;功能模块15包括主控单元151、非接电源控制单元152、非接单元153、接触电源控制单元154、接触单元155和人机交互单元156。Specifically, the Apple interface module 12 includes an Apple interface unit 121 and an Apple communication unit 122; the battery module 13 includes a charging management unit 131 and a battery unit 132; the power management module 14 includes a power supply automatic switching circuit unit 141, a voltage isolation unit 142, a system power supply The management unit 143 and the power supply isolation unit 144 ; the functional module 15 includes a main control unit 151 , a contactless power control unit 152 , a contactless unit 153 , a contact power control unit 154 , a contact unit 155 and a human-computer interaction unit 156 .

本实施例中,各模块和单元的功能和连接关系具体为:In this embodiment, the functions and connections of each module and unit are specifically:

USB接口模块11,与充电管理单元131、供电自动切换电路单元141、电压隔离单元142、系统电源管理单元143和主控单元151相连,用于与上位机连接,从上位机获取电能,通过充电管理单元131对电池单元132充电,向系统电源管理单元143发送电信号,使能系统电源管理单元143,通过供电自动切换电路单元141和系统电源管理单元143向非接电源控制单元152和接触电源控制单元154供电,通过供电自动切换电路单元141、系统电源管理单元143和供电隔离单元144向主控单元151和人机交互单元156供电,还用于与主控单元151和上位机进行数据通讯;The USB interface module 11 is connected with the charging management unit 131, the power supply automatic switching circuit unit 141, the voltage isolation unit 142, the system power management unit 143 and the main control unit 151, and is used for connecting with the host computer, obtaining electric energy from the host computer, and charging The management unit 131 charges the battery unit 132, sends an electric signal to the system power management unit 143, enables the system power management unit 143, and automatically switches the circuit unit 141 and the system power management unit 143 to the contactless power supply control unit 152 and the contact power supply through the power supply. The control unit 154 supplies power to the main control unit 151 and the human-computer interaction unit 156 through the power supply automatic switching circuit unit 141, the system power management unit 143 and the power supply isolation unit 144, and is also used for data communication with the main control unit 151 and the upper computer ;

苹果接口单元121,与苹果通讯单元122、电压隔离单元142和供电隔离单元144相连,用于与上位机连接,从上位机获取电能,通过电压隔离单元142向系统电源管理单元143发送电信号,使能系统电源管理单元143,通过供电隔离单元144向主控单元151和人机交互单元156供电,还用于与苹果通讯单元122和上位机进行数据通讯;The apple interface unit 121 is connected with the apple communication unit 122, the voltage isolation unit 142 and the power supply isolation unit 144, and is used to connect with the host computer, obtain electric energy from the host computer, and send electrical signals to the system power management unit 143 through the voltage isolation unit 142, The system power management unit 143 is enabled to supply power to the main control unit 151 and the human-computer interaction unit 156 through the power supply isolation unit 144, and is also used for data communication with the Apple communication unit 122 and the upper computer;

苹果通讯单元122,与苹果接口单元121和主控单元151相连,用于与苹果接口单元121和主控单元151进行数据通讯;The apple communication unit 122 is connected with the apple interface unit 121 and the main control unit 151, and is used for carrying out data communication with the apple interface unit 121 and the main control unit 151;

充电管理单元131,与USB接口模块11和电池单元132相连,用于当电池单元132电能未蓄满时,从USB接口模块11获取电能传递给电池单元132,当电池单元132电能蓄满时,停止从USB接口模块11获取电能;The charging management unit 131 is connected with the USB interface module 11 and the battery unit 132, and is used to obtain power from the USB interface module 11 and transmit it to the battery unit 132 when the battery unit 132 is not fully charged. When the battery unit 132 is fully charged, Stop obtaining power from the USB interface module 11;

电池单元132,与充电管理单元131和供电自动切换电路单元141相连,用于在设备仅通过苹果接口单元121与上位机连接时,通过供电自动切换电路单元141和系统电源管理单元143向非接电源控制单元152和接触电源控制单元154供电,通过供电自动切换电路单元141、系统电源管理单元143和供电隔离单元144向主控单元151和人机交互单元156供电;The battery unit 132 is connected with the charging management unit 131 and the power supply automatic switching circuit unit 141, and is used to supply the wireless battery through the power supply automatic switching circuit unit 141 and the system power supply management unit 143 when the device is only connected to the host computer through the Apple interface unit 121. The power control unit 152 and the contact power control unit 154 supply power, and supply power to the main control unit 151 and the human-computer interaction unit 156 through the power supply automatic switching circuit unit 141, the system power management unit 143 and the power supply isolation unit 144;

供电自动切换电路单元141,与USB接口模块11、电池单元132和系统电源管理单元143相连,用于当USB接口模块11与上位机连接时,仅允许来自USB接口模块11的电流通过,当USB接口模块11未与上位机连接时,允许来自电池单元132的电流通过;The power supply automatic switching circuit unit 141 is connected with the USB interface module 11, the battery unit 132 and the system power management unit 143, and is used to allow only the current from the USB interface module 11 to pass through when the USB interface module 11 is connected to the host computer. When the interface module 11 is not connected to the host computer, the current from the battery unit 132 is allowed to pass through;

电压隔离单元142,与USB接口模块11、苹果接口单元121和系统电源管理单元143相连,用于将苹果接口单元121发送的电信号发送给系统电源管理单元143,使能系统电源管理单元143,以及阻隔来自USB接口模块11的电压进入苹果接口单元121;The voltage isolation unit 142 is connected with the USB interface module 11, the apple interface unit 121 and the system power management unit 143, and is used to send the electrical signal sent by the apple interface unit 121 to the system power management unit 143, enabling the system power management unit 143, And blocking the voltage from the USB interface module 11 from entering the apple interface unit 121;

系统电源管理单元143,与USB接口模块11、供电自动切换电路单元141、电压隔离单元142、供电隔离单元144、非接电源控制单元152和接触电源控制单元154相连,用于在其被使能时,对输入的电压进行转换得到预设电压,输出预设电压,直接向非接电源控制单元152和接触电源控制单元154供电、通过供电隔离单元144向主控单元151和人机交互单元156供电,其中,预设电压为3.3V的电压;The system power management unit 143 is connected with the USB interface module 11, the power supply automatic switching circuit unit 141, the voltage isolation unit 142, the power supply isolation unit 144, the contactless power supply control unit 152 and the contact power supply control unit 154, for enabling , convert the input voltage to obtain a preset voltage, output the preset voltage, directly supply power to the contactless power supply control unit 152 and the contact power supply control unit 154, and supply power to the main control unit 151 and the human-computer interaction unit 156 through the power supply isolation unit 144 power supply, wherein the preset voltage is a voltage of 3.3V;

供电隔离单元144,与苹果接口单元121、系统电源管理单元143、主控单元151和人机交互单元156相连,用于当苹果接口单元121与上位机连接时,用来自苹果接口单元121的电流为主控单元151和人机交互单元156供电,以及当USB接口模块11与上位机连接时,用来自系统电源管理单元143的电流为主控单元151和人机交互单元156供电,和阻隔来自系统电源管理单元143的电流流入苹果接口单元121;The power supply isolation unit 144 is connected with the apple interface unit 121, the system power management unit 143, the main control unit 151 and the human-computer interaction unit 156, and is used to use the current from the apple interface unit 121 when the apple interface unit 121 is connected to the upper computer. The main control unit 151 and the human-computer interaction unit 156 are powered, and when the USB interface module 11 is connected to the host computer, the current from the system power management unit 143 is used to supply power to the main control unit 151 and the human-computer interaction unit 156, and to block from The current of the system power management unit 143 flows into the apple interface unit 121;

主控单元151,与供电隔离单元144、USB接口模块11、苹果通讯单元122、非接电源控制单元152、非接单元153、接触电源控制单元154、接触单元155和人机交互单元156相连,用于向非接电源控制单元152和接触电源控制单元154发送控制信号,以及与非接单元153、接触单元155、USB接口模块11和苹果通讯单元122进行数据通讯;The main control unit 151 is connected with the power supply isolation unit 144, the USB interface module 11, the Apple communication unit 122, the contactless power control unit 152, the contactless unit 153, the contact power control unit 154, the contact unit 155 and the human-computer interaction unit 156, Used to send control signals to the contactless power control unit 152 and the contact power supply control unit 154, and perform data communication with the contactless unit 153, the contact unit 155, the USB interface module 11 and the Apple communication unit 122;

非接电源控制单元152,与系统电源管理单元143、主控单元151和非接单元153相连,用于接收主控单元151发送的控制信号,控制非接单元153的上电和下电;The contactless power supply control unit 152 is connected with the system power management unit 143, the main control unit 151 and the contactless unit 153, and is used to receive the control signal sent by the main control unit 151, and control the power-on and power-off of the contactless unit 153;

非接单元153,与非接电源控制单元152和主控单元151相连,用于与主控单元151和非接触卡进行数据通讯;The contactless unit 153 is connected with the contactless power supply control unit 152 and the main control unit 151, and is used for data communication with the main control unit 151 and the contactless card;

接触电源控制单元154,与系统电源管理单元143、主控单元151和接触单元155相连,用于接收主控单元151发送的控制信号,控制接触单元155的上电和下电;The contact power control unit 154 is connected with the system power management unit 143, the main control unit 151 and the contact unit 155, and is used to receive the control signal sent by the main control unit 151, and control the power-on and power-off of the contact unit 155;

接触单元155,与接触电源控制单元154和主控单元151相连,用于与主控单元151和接触卡进行数据通讯;The contact unit 155 is connected with the contact power control unit 154 and the main control unit 151, and is used for data communication with the main control unit 151 and the contact card;

人机交互单元156,与供电隔离单元144和主控单元151相连,用于进行人机交互;具体地,人机交互单元156可以包括蜂鸣器和/或显示屏和/或LED和/或键盘等。The human-computer interaction unit 156 is connected with the power supply isolation unit 144 and the main control unit 151 for human-computer interaction; specifically, the human-computer interaction unit 156 may include a buzzer and/or a display screen and/or an LED and/or keyboard etc.

优选地,本实施例中,USB接口模块11包括USB接口,苹果接口单元121包括苹果接口,苹果通讯单元122包括苹果通讯芯片,充电管理单元131包括电池充电芯片,电池单元132包括锂电池,供电自动切换电路单元141为包括两个二极管的供电自动切换电路,电压隔离单元142为包括两个二极管的电压隔离电路,系统电源管理单元143包括电源管理芯片,供电隔离单元144为包括两个二极管的供电隔离电路,主控单元151包括MCU,非接电源控制单元152包括电源管理芯片/三极管/MOS管,非接单元153包括非接芯片和线圈,接触电源控制单元154包括电源管理芯片/三极管/MOS管,接触单元155包括接触芯片和卡槽。Preferably, in this embodiment, the USB interface module 11 includes a USB interface, the Apple interface unit 121 includes an Apple interface, the Apple communication unit 122 includes an Apple communication chip, the charging management unit 131 includes a battery charging chip, and the battery unit 132 includes a lithium battery. The automatic switching circuit unit 141 is a power supply automatic switching circuit comprising two diodes, the voltage isolation unit 142 is a voltage isolation circuit comprising two diodes, the system power management unit 143 comprises a power management chip, and the power supply isolation unit 144 is a circuit comprising two diodes Power supply isolation circuit, the main control unit 151 includes an MCU, the contactless power control unit 152 includes a power management chip/transistor/MOS tube, the contactless unit 153 includes a contactless chip and coil, and the contact power control unit 154 includes a power management chip/transistor/ The MOS tube, the contact unit 155 includes a contact chip and a card slot.

本发明实施例2提供的设备在USB接口与上位机连接时,设备的功能模块均由USB接口供电,在设备仅通过苹果接口与上位机连接时,设备的功能模块中与卡片通讯的部分由电池供电,主控和人机交互部分由电池和苹果接口共同供电。When the device provided by Embodiment 2 of the present invention is connected to the host computer through the USB interface, the functional modules of the device are powered by the USB interface. When the device is only connected to the host computer through the Apple interface, the functional modules of the device communicate with the card. Battery-powered, the main control and human-computer interaction parts are powered by the battery and the Apple interface.

实施例3Example 3

本发明实施例3在实施例1的基础上提供一种带有电源管理的多接口移动安全设备。参见图3,所述设备具体包括:USB接口模块21、苹果接口模块22、电池模块23、电源管理模块24和功能模块25;其中,USB接口模块21与电池模块23、电源管理模块24和功能模块25相连,苹果接口模块22与电源管理模块24和功能模块25相连,电池模块23与USB接口模块21和电源管理模块24相连,电源管理模块24与USB接口模块21、苹果接口模块22、电池模块23和功能模块25连接,功能模块25与USB接口模块21、苹果接口模块22和电源管理模块24相连。Embodiment 3 of the present invention provides a multi-interface mobile security device with power management on the basis of Embodiment 1. Referring to Fig. 3, described equipment specifically comprises: USB interface module 21, apple interface module 22, battery module 23, power management module 24 and function module 25; Wherein, USB interface module 21 and battery module 23, power management module 24 and function Module 25 is connected, and apple interface module 22 is connected with power management module 24 and function module 25, and battery module 23 is connected with USB interface module 21 and power management module 24, and power management module 24 is connected with USB interface module 21, apple interface module 22, battery The module 23 is connected with the function module 25 , and the function module 25 is connected with the USB interface module 21 , the Apple interface module 22 and the power management module 24 .

具体地,苹果接口模块22包括苹果接口单元221和苹果通讯单元222;电池模块23包括充电管理单元231和电池单元232;电源管理模块24包括供电自动切换电路单元241、系统电源管理单元242和供电隔离单元243;功能模块25包括主控单元251、非接电源控制单元252、非接单元253、接触电源控制单元254、接触单元255和人机交互单元256。Specifically, the apple interface module 22 includes an apple interface unit 221 and an apple communication unit 222; the battery module 23 includes a charging management unit 231 and a battery unit 232; the power management module 24 includes a power supply automatic switching circuit unit 241, a system power management unit 242 and a power supply The isolation unit 243 ; the functional module 25 includes a main control unit 251 , a contactless power control unit 252 , a contactless unit 253 , a contact power control unit 254 , a contact unit 255 and a human-computer interaction unit 256 .

本实施例中,各模块和单元的功能和连接关系具体为:In this embodiment, the functions and connections of each module and unit are specifically:

USB接口模块21,与充电管理单元231、供电自动切换电路241、系统电源管理单元242和主控单元251相连,用于与上位机连接,从上位机获取电能,通过充电管理单元231对电池单元232充电,通过供电自动切换电路单元241向非接电源控制单元252和接触电源控制单元254供电,向系统电源管理单元242发送电信号,使能系统电源管理单元242,通过系统电源管理单元242和供电隔离单元243向主控单元251和人机交互单元256供电,还用于与主控单元251和上位机进行数据通讯;The USB interface module 21 is connected with the charging management unit 231, the power supply automatic switching circuit 241, the system power management unit 242 and the main control unit 251, and is used to connect with the host computer, obtain electric energy from the host computer, and charge the battery unit through the charging management unit 231 232 charging, through the power supply automatic switching circuit unit 241 to supply power to the contactless power control unit 252 and the contact power control unit 254, and send an electrical signal to the system power management unit 242 to enable the system power management unit 242, through the system power management unit 242 and the contact power control unit 254 The power supply isolation unit 243 supplies power to the main control unit 251 and the human-computer interaction unit 256, and is also used for data communication with the main control unit 251 and the upper computer;

苹果接口单元221,与苹果通讯单元222和供电隔离单元243相连,用于与上位机连接,从上位机获取电能,通过供电隔离单元243向主控单元251和人机交互单元256供电,还用于与苹果通讯单元222和上位机进行数据通讯;The apple interface unit 221 is connected with the apple communication unit 222 and the power supply isolation unit 243, and is used to connect with the host computer, obtain electric energy from the host computer, supply power to the main control unit 251 and the human-computer interaction unit 256 through the power supply isolation unit 243, and use For data communication with the Apple communication unit 222 and the host computer;

苹果通讯单元222,与苹果接口单元221和主控单元251相连,用于与苹果接口单元221和主控单元251进行数据通讯;The apple communication unit 222 is connected with the apple interface unit 221 and the main control unit 251, and is used for carrying out data communication with the apple interface unit 221 and the main control unit 251;

充电管理单元231,与USB接口模块21和电池单元232相连,用于当电池单元232电能未蓄满时,从USB接口模块21获取电能传递给电池单元232,当电池单元232电能蓄满时,停止从USB接口模块21获取电能;The charging management unit 231 is connected to the USB interface module 21 and the battery unit 232, and is used to obtain power from the USB interface module 21 and transmit it to the battery unit 232 when the battery unit 232 is not fully charged. When the battery unit 232 is fully charged, Stop obtaining power from the USB interface module 21;

电池单元232,与充电管理单元231和供电自动切换电路单元241相连,用于在设备仅通过苹果接口单元221与上位机连接时,通过供电自动切换电路单元241向非接电源控制单元252和接触电源控制单元254供电;The battery unit 232 is connected with the charging management unit 231 and the power supply automatic switching circuit unit 241, and is used to supply the contactless power supply control unit 252 and the contactless power supply control unit 252 through the power supply automatic switching circuit unit 241 when the device is only connected to the upper computer through the Apple interface unit 221. The power supply control unit 254 supplies power;

供电自动切换电路单元241,与USB接口模块21、电池单元232、非接电源控制单元252和接触电源控制单元254相连,用于当USB接口模块21与上位机连接时,仅允许来自USB接口模块21的电流通过,当USB接口模块21未与上位机连接时,允许来自电池单元232的电流通过;The power supply automatic switching circuit unit 241 is connected with the USB interface module 21, the battery unit 232, the contactless power supply control unit 252 and the contact power supply control unit 254, and is used for when the USB interface module 21 is connected with the upper computer, only allowing The current of 21 passes through, and when the USB interface module 21 is not connected with the host computer, the current from the battery unit 232 is allowed to pass;

系统电源管理单元242,与USB接口模块21和供电隔离单元243相连,用于在其被使能时,对输入的电压进行转换得到预设电压,输出预设电压,通过供电隔离单元243向主控单元251和人机交互单元256供电,其中,预设电压为3.3V的电压;The system power management unit 242 is connected with the USB interface module 21 and the power supply isolation unit 243, and is used to convert the input voltage to obtain a preset voltage when it is enabled, output the preset voltage, and send the power to the host through the power supply isolation unit 243. The control unit 251 and the human-computer interaction unit 256 supply power, wherein the preset voltage is a voltage of 3.3V;

供电隔离单元243,与苹果接口单元221、系统电源管理单元242、主控单元251和人机交互单元256相连,用于当苹果接口单元221与上位机连接时,用来自苹果接口单元221的电流对主控单元251和人机交互单元256供电,以及当USB接口模块21与上位机连接时,用来自系统电源管理单元242的电流为主控单元251和人机交互单元256供电,和阻隔来自系统电源管理单元242的电流流入苹果接口单元221;The power supply isolation unit 243 is connected with the apple interface unit 221, the system power management unit 242, the main control unit 251 and the human-computer interaction unit 256, and is used to use the current from the apple interface unit 221 when the apple interface unit 221 is connected to the upper computer. Power the main control unit 251 and the human-computer interaction unit 256, and when the USB interface module 21 is connected to the host computer, use the current from the system power management unit 242 to supply power to the main control unit 251 and the human-computer interaction unit 256, and block the The current of the system power management unit 242 flows into the apple interface unit 221;

主控单元251,与供电隔离单元243、USB接口模块21、苹果通讯单元222、非接电源控制单元252、非接单元253、接触电源控制单元254、接触单元255和人机交互单元256相连,用于向非接电源控制单元252和接触电源控制单元254发送控制信号,以及与非接单元253、接触单元255、USB接口模块21和苹果通讯单元222进行数据通讯;The main control unit 251 is connected with the power supply isolation unit 243, the USB interface module 21, the Apple communication unit 222, the contactless power control unit 252, the contactless unit 253, the contact power control unit 254, the contact unit 255 and the man-machine interaction unit 256, Used to send control signals to the contactless power supply control unit 252 and the contact power supply control unit 254, and perform data communication with the contactless unit 253, the contact unit 255, the USB interface module 21 and the Apple communication unit 222;

非接电源控制单元252,与供电自动切换电路单元241、主控单元251和非接单元253相连,用于接收主控单元251发送的控制信号,控制非接单元253的上电和下电;The contactless power supply control unit 252 is connected with the power supply automatic switching circuit unit 241, the main control unit 251 and the contactless unit 253, and is used to receive the control signal sent by the main control unit 251, and control the power-on and power-off of the contactless unit 253;

非接单元253,与非接电源控制单元252和主控单元251相连,用于与主控单元251和非接触卡进行数据通讯;The contactless unit 253 is connected with the contactless power supply control unit 252 and the main control unit 251, and is used for data communication with the main control unit 251 and the contactless card;

接触电源控制单元254,与供电自动切换电源单元241、主控单元251和接触单元255相连,用于接收主控单元251发送的控制信号,控制接触单元255的上电和下电;The contact power supply control unit 254 is connected with the power supply automatic switching power supply unit 241, the main control unit 251 and the contact unit 255, and is used to receive the control signal sent by the main control unit 251, and control the power-on and power-off of the contact unit 255;

接触单元255,与接触电源控制单元254和主控单元251相连,用于与主控单元251和接触卡进行数据通讯;The contact unit 255 is connected with the contact power control unit 254 and the main control unit 251, and is used for data communication with the main control unit 251 and the contact card;

人机交互单元256,与供电隔离单元243和主控单元251相连,用于进行人机交互;具体地,人机交互单元256可以包括蜂鸣器和/或显示屏和/或LED和/或键盘等。The human-computer interaction unit 256 is connected to the power supply isolation unit 243 and the main control unit 251 for human-computer interaction; specifically, the human-computer interaction unit 256 may include a buzzer and/or a display screen and/or an LED and/or keyboard etc.

优选地,本实施例中,USB接口模块21包括USB接口,苹果接口单元221包括苹果接口,苹果通讯单元222包括苹果通讯芯片,充电管理单元231包括电池充电芯片,电池单元232包括锂电池,供电自动切换电路单元241为包括两个二极管的供电自动切换电路,系统电源管理单元242包括电源管理芯片,供电隔离单元243为包括两个二极管的供电隔离电路,主控单元251包括MCU,非接电源控制单元252包括电源管理芯片/三极管/MOS管,非接单元253包括非接芯片和线圈,接触电源控制单元254包括电源管理芯片/三极管/MOS管,接触单元255包括接触芯片和卡槽。Preferably, in this embodiment, the USB interface module 21 includes a USB interface, the Apple interface unit 221 includes an Apple interface, the Apple communication unit 222 includes an Apple communication chip, the charging management unit 231 includes a battery charging chip, and the battery unit 232 includes a lithium battery. The automatic switching circuit unit 241 is a power supply automatic switching circuit including two diodes, the system power management unit 242 includes a power management chip, the power supply isolation unit 243 is a power supply isolation circuit including two diodes, the main control unit 251 includes an MCU, and the non-connected power supply The control unit 252 includes a power management chip/transistor/MOS tube, the contactless unit 253 includes a contactless chip and a coil, the contact power control unit 254 includes a power management chip/transistor/MOS tube, and the contact unit 255 includes a contact chip and a card slot.

本发明实施例3提供的设备在USB接口与上位机连接时,设备的功能模块均由USB接口供电,在设备仅通过苹果接口与上位机连接时,设备的功能模块中与卡片通讯的部分由电池供电,主控和人机交互部分由苹果接口供电。When the device provided by Embodiment 3 of the present invention is connected to the host computer through the USB interface, the functional modules of the device are powered by the USB interface. The battery power supply, the main control and the human-computer interaction part are powered by the Apple interface.

实施例4Example 4

本发明实施例4在实施例1的基础上提供一种带有电源管理的多接口移动安全设备。参见图4,所述设备具体包括:USB接口模块31、苹果接口模块32、电池模块33、电源管理模块34和功能模块35;其中,USB接口模块31与电池模块33、电源管理模块34和功能模块35相连,苹果接口模块32与电源管理模块34和功能模块35相连,电池模块33与USB接口模块31和电源管理模块34相连,电源管理模块34与USB接口模块31、苹果接口模块32、电池模块33和功能模块35连接,功能模块35与USB接口模块31、苹果接口模块32和电源管理模块34相连。Embodiment 4 of the present invention provides a multi-interface mobile security device with power management on the basis of Embodiment 1. Referring to Fig. 4, described equipment specifically comprises: USB interface module 31, apple interface module 32, battery module 33, power management module 34 and function module 35; Wherein, USB interface module 31 and battery module 33, power management module 34 and function Module 35 links to each other, apple interface module 32 links to each other with power management module 34 and function module 35, battery module 33 links to each other with USB interface module 31 and power management module 34, power management module 34 links to each other with USB interface module 31, apple interface module 32, battery The module 33 is connected to the function module 35 , and the function module 35 is connected to the USB interface module 31 , the Apple interface module 32 and the power management module 34 .

具体地,苹果接口模块32包括苹果接口单元321和苹果通讯单元322;电池模块33包括充电管理单元331和电池单元332;电源管理模块34包括供电自动切换电路单元341、电压隔离单元342、系统电源管理单元343、供电隔离单元344和电池供电控制单元345;功能模块35包括主控单元351、非接电源控制单元352、非接单元353、接触电源控制单元354、接触单元355和人机交互单元356。Specifically, the apple interface module 32 includes an apple interface unit 321 and an apple communication unit 322; the battery module 33 includes a charging management unit 331 and a battery unit 332; the power management module 34 includes a power supply automatic switching circuit unit 341, a voltage isolation unit 342, a system power supply Management unit 343, power supply isolation unit 344 and battery power supply control unit 345; functional module 35 includes main control unit 351, contactless power control unit 352, contactless unit 353, contact power control unit 354, contact unit 355 and human-computer interaction unit 356.

本实施例中,各模块和单元的功能和连接关系具体为:In this embodiment, the functions and connections of each module and unit are specifically:

USB接口模块31,与充电管理单元331、供电自动切换电路单元341、电压隔离单元342、系统电源管理单元343和主控单元351相连,用于与上位机连接,从上位机获取电能,通过充电管理单元331对电池单元332充电,向系统电源管理单元343发送电信号,使能系统电源管理单元343,通过供电自动切换电路单元341、系统电源管理单元343和供电隔离单元344向主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356供电,还用于与主控单元351和上位机进行数据通讯;The USB interface module 31 is connected with the charging management unit 331, the power supply automatic switching circuit unit 341, the voltage isolation unit 342, the system power management unit 343 and the main control unit 351, and is used for connecting with the host computer, obtaining electric energy from the host computer, and charging The management unit 331 charges the battery unit 332, sends an electrical signal to the system power management unit 343, enables the system power management unit 343, and supplies power to the main control unit 351 through the power supply automatic switching circuit unit 341, the system power management unit 343 and the power supply isolation unit 344. , the contactless power supply control unit 352, the contact power supply control unit 354 and the human-computer interaction unit 356 supply power, and are also used for data communication with the main control unit 351 and the host computer;

苹果接口单元321,与苹果通讯单元322、电压隔离单元342和供电隔离单元344相连,用于与上位机连接,从上位机获取电能,通过电压隔离单元342向系统电源管理单元343发送电信号,使能系统电源管理单元343,通过供电隔离单元344向主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356供电,还用于与苹果通讯单元322和上位机进行数据通讯;The apple interface unit 321 is connected with the apple communication unit 322, the voltage isolation unit 342 and the power supply isolation unit 344, and is used to connect with the host computer, obtain electric energy from the host computer, and send an electrical signal to the system power management unit 343 through the voltage isolation unit 342, Enable the system power management unit 343 to supply power to the main control unit 351, the contactless power control unit 352, the contact power control unit 354 and the human-computer interaction unit 356 through the power supply isolation unit 344, and is also used to communicate with the Apple communication unit 322 and the host computer data communication;

苹果通讯单元322,与苹果接口单元321和主控单元351相连,用于与苹果接口单元321和主控单元351进行数据通讯;The apple communication unit 322 is connected with the apple interface unit 321 and the main control unit 351, and is used for carrying out data communication with the apple interface unit 321 and the main control unit 351;

充电管理单元331,与USB接口模块31和电池单元332相连,用于当电池单元332电能未蓄满时,从USB接口模块31获取电能传递给电池单元332,当电池单元332电能蓄满时,停止从USB接口模块31获取电能;The charging management unit 331 is connected with the USB interface module 31 and the battery unit 332, and is used to obtain power from the USB interface module 31 and transmit it to the battery unit 332 when the battery unit 332 is not fully charged. When the battery unit 332 is fully charged, Stop obtaining power from the USB interface module 31;

电池单元332,与充电管理单元331和电池供电控制单元345相连,用于在设备仅通过苹果接口单元321与上位机连接,且设备功耗较大时,通过电池供电控制单元345、供电自动切换电路单元341、系统电源管理单元343和供电隔离单元344向主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356供电;The battery unit 332 is connected to the charging management unit 331 and the battery power supply control unit 345, and is used to automatically switch between the battery power supply control unit 345 and the power supply when the device is only connected to the host computer through the Apple interface unit 321 and the power consumption of the device is large. The circuit unit 341, the system power management unit 343 and the power supply isolation unit 344 supply power to the main control unit 351, the contactless power control unit 352, the contact power control unit 354 and the human-computer interaction unit 356;

供电自动切换电路单元341,与USB接口模块31、系统电源管理单元343和电池供电控制单元345相连,用于当USB接口模块31与上位机连接时,仅允许来自USB接口模块31的电流通过,当USB接口模块31未与上位机连接时,允许来自电池供电控制单元345的电流通过;The power supply automatic switching circuit unit 341 is connected with the USB interface module 31, the system power management unit 343 and the battery power supply control unit 345, and is used to allow only the current from the USB interface module 31 to pass through when the USB interface module 31 is connected to the host computer. When the USB interface module 31 is not connected with the host computer, the current from the battery power supply control unit 345 is allowed to pass through;

电压隔离单元342,与USB接口模块31、苹果接口单元321和系统电源管理单元343相连,用于将苹果接口单元321发送的电信号发送给系统电源管理单元343,使能系统电源管理单元343,以及阻隔来自USB接口模块31的电压进入苹果接口单元321;The voltage isolation unit 342 is connected with the USB interface module 31, the apple interface unit 321 and the system power management unit 343, and is used to send the electrical signal sent by the apple interface unit 321 to the system power management unit 343, enabling the system power management unit 343, And blocking the voltage from the USB interface module 31 from entering the apple interface unit 321;

系统电源管理单元343,与USB接口模块31、供电自动切换电路单元341、电压隔离单元342和供电隔离单元344相连,用于在其被使能时,对输入的电压进行转换得到预设电压,输出预设电压,通过供电隔离单元344向主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356供电,其中,预设电压为3.3V的电压;The system power management unit 343 is connected to the USB interface module 31, the power supply automatic switching circuit unit 341, the voltage isolation unit 342 and the power supply isolation unit 344, and is used to convert the input voltage to obtain a preset voltage when it is enabled, Output a preset voltage, and supply power to the main control unit 351, the contactless power supply control unit 352, the contact power supply control unit 354 and the human-computer interaction unit 356 through the power supply isolation unit 344, wherein the preset voltage is a voltage of 3.3V;

供电隔离单元344,与苹果接口单元321、系统电源管理单元343、主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356相连,用于当苹果接口单元321与上位机连接时,用来自苹果接口单元321的电流为主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356供电,以及当USB接口模块31与上位机连接时,用来自系统电源管理单元343的电流为主控单元351、非接电源控制单元352、接触电源控制单元354和人机交互单元356供电,和阻隔来自系统电源管理单元343的电流流入苹果接口单元321;The power supply isolation unit 344 is connected with the apple interface unit 321, the system power management unit 343, the main control unit 351, the contactless power supply control unit 352, the contact power supply control unit 354 and the human-computer interaction unit 356, and is used to connect the apple interface unit 321 with the human-computer interaction unit 356. When the host computer is connected, the main control unit 351, the contactless power supply control unit 352, the contact power supply control unit 354 and the human-computer interaction unit 356 are powered by the current from the apple interface unit 321, and when the USB interface module 31 is connected with the host computer , use the current from the system power management unit 343 to supply power to the main control unit 351, the contactless power control unit 352, the contact power control unit 354 and the human-computer interaction unit 356, and block the current from the system power management unit 343 from flowing into the apple interface unit 321;

电池供电控制单元345,与电池单元332、供电自动切换电路单元341和主控单元351相连,用于在接收到主控单元351发送的控制信号后允许来自电池单元332的电流通过;The battery power supply control unit 345 is connected to the battery unit 332, the power supply automatic switching circuit unit 341 and the main control unit 351, and is used to allow the current from the battery unit 332 to pass after receiving the control signal sent by the main control unit 351;

主控单元351,与USB接口模块31、苹果通讯单元322、供电隔离单元344、电池供电控制单元345、非接电源控制单元352、非接单元353、接触电源控制单元354、接触单元355和人机交互单元356相连,用于向非接电源控制单元352和接触电源控制单元354发送控制信号,与非接单元353、接触单元355、USB接口模块31和苹果通讯单元322进行数据通讯,以及当设备仅通过苹果接口单元321与上位机连接且功耗较高时向电池供电控制单元345发送控制信号;Main control unit 351, with USB interface module 31, apple communication unit 322, power supply isolation unit 344, battery power supply control unit 345, contactless power control unit 352, contactless unit 353, contact power control unit 354, contact unit 355 and people Connected with the machine interaction unit 356, used to send control signals to the contactless power supply control unit 352 and the contact power supply control unit 354, and carry out data communication with the contactless unit 353, the contact unit 355, the USB interface module 31 and the Apple communication unit 322, and when The device only sends a control signal to the battery-powered control unit 345 when it is connected to the host computer through the Apple interface unit 321 and the power consumption is high;

非接电源控制单元352,与供电隔离单元344、主控单元351和非接单元353相连,用于接收主控单元351发送的控制信号,控制非接单元353的上电和下电;The contactless power supply control unit 352 is connected with the power supply isolation unit 344, the main control unit 351 and the contactless unit 353, and is used to receive the control signal sent by the main control unit 351, and control the power-on and power-off of the contactless unit 353;

非接单元353,与非接电源控制单元352和主控单元351相连,用于与主控单元351和非接触卡进行数据通讯;The contactless unit 353 is connected with the contactless power supply control unit 352 and the main control unit 351, and is used for data communication with the main control unit 351 and the contactless card;

接触电源控制单元354,与供电隔离单元344、主控单元351和接触单元355相连,用于接收主控单元351发送的控制信号,控制接触单元355的上电和下电;The contact power supply control unit 354 is connected with the power supply isolation unit 344, the main control unit 351 and the contact unit 355, and is used to receive the control signal sent by the main control unit 351, and control the power-on and power-off of the contact unit 355;

接触单元355,与接触电源控制单元354和主控单元351相连,用于与主控单元351和接触卡进行数据通讯;The contact unit 355 is connected with the contact power control unit 354 and the main control unit 351, and is used for data communication with the main control unit 351 and the contact card;

人机交互单元356,与供电隔离单元344和主控单元351相连,用于进行人机交互;具体地,人机交互单元356可以包括蜂鸣器和/或显示屏和/或LED和/或键盘等。The human-computer interaction unit 356 is connected to the power supply isolation unit 344 and the main control unit 351 for human-computer interaction; specifically, the human-computer interaction unit 356 may include a buzzer and/or a display screen and/or an LED and/or keyboard etc.

优选地,本实施例中,USB接口模块31包括USB接口,苹果接口单元321包括苹果接口,苹果通讯单元322包括苹果通讯芯片,充电管理单元331包括电池充电芯片,电池单元332包括锂电池,供电自动切换电路单元341为包括两个二极管的供电自动切换电路,电压隔离单元342为包括两个二极管的电压隔离电路,系统电源管理单元343包括电源管理芯片,供电隔离单元344为包括两个二极管的供电隔离电路,电池供电控制单元345包括电源管理芯片/三极管/MOS管,主控单元351包括MCU,非接电源控制单元352包括电源管理芯片/三极管/MOS管,非接单元353包括非接芯片和线圈,接触电源控制单元354包括电源管理芯片/三极管/MOS管,接触单元355包括接触芯片和卡槽。Preferably, in this embodiment, the USB interface module 31 includes a USB interface, the Apple interface unit 321 includes an Apple interface, the Apple communication unit 322 includes an Apple communication chip, the charging management unit 331 includes a battery charging chip, and the battery unit 332 includes a lithium battery. The automatic switching circuit unit 341 is a power supply automatic switching circuit including two diodes, the voltage isolation unit 342 is a voltage isolation circuit including two diodes, the system power management unit 343 includes a power management chip, and the power supply isolation unit 344 is a voltage isolation circuit including two diodes. Power supply isolation circuit, the battery power supply control unit 345 includes a power management chip/transistor/MOS tube, the main control unit 351 includes an MCU, the contactless power supply control unit 352 includes a power management chip/transistor/MOS tube, and the contactless unit 353 includes a contactless chip and the coil, the contact power control unit 354 includes a power management chip/transistor/MOS tube, and the contact unit 355 includes a contact chip and a card slot.

本发明实施例4提供的设备,若USB接口与上位机连接,则由USB接口为设备供电,若设备仅通过苹果接口与上位机连接,当设备功耗较低时由苹果接口为设备供电,当设备功耗较高时由苹果接口和电池共同为设备供电。For the device provided in Embodiment 4 of the present invention, if the USB interface is connected to the host computer, the USB interface is used to supply power to the device; if the device is only connected to the host computer through the Apple interface, when the power consumption of the device is low, the Apple interface supplies power to the device. When the power consumption of the device is high, the device is powered by the Apple interface and the battery.

实施例5Example 5

本发明实施例5提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电,设备上电初始化后,功能模块执行以下步骤:Embodiment 5 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple interface of the device is connected to the host Power on, after the device is powered on and initialized, the function module performs the following steps:

步骤51:打开USB接入中断和苹果接入中断;Step 51: Turn on USB access interrupt and Apple access interrupt;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,检查USB接口的供电电压,若为高电压则打开USB数据接收中断,若为低电压则关闭USB数据接收中断;当苹果接口插入或拔出时,苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则打开苹果数据接收中断,若为低电压则关闭苹果数据接收中断;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If the voltage is high, the USB data receiving interrupt is turned on, and if the voltage is low, the USB data receiving interrupt is turned off; When the apple interface is plugged in or pulled out, the apple access interrupt is triggered, check the power supply voltage of the apple interface, if it is high voltage, turn on the apple data receiving interrupt, if it is low voltage, turn off the apple data receiving interrupt;

当USB接口检测到上位机发送的数据时,USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志。When the USB interface detects the data sent by the host computer, the USB data receiving interrupt is triggered, the data sent by the host computer is received, and the USB receiving flag is set; when the Apple interface receives the data sent by the host computer, the Apple data receiving interrupt is triggered , to receive the data sent by the host computer, and set the Apple receiving flag.

步骤52:检查USB接收标志是否被置位,是则复位USB接收标志,置位USB标志,执行步骤54,否则执行步骤53;Step 52: Check whether the USB receiving flag is set, if so, reset the USB receiving flag, set the USB flag, and execute step 54, otherwise execute step 53;

步骤53:检查苹果接收标志是否被置位,是则复位苹果接收标志,置位苹果标志,执行步骤54,否则返回步骤52;Step 53: Check whether the Apple receiving flag is set, if so, reset the Apple receiving flag, set the Apple flag, and execute step 54, otherwise return to step 52;

步骤54:判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤55,否则将提示无卡的信息作为返回数据,执行步骤55;Step 54: Determine whether there is a card that has established a connection with the device. If yes, send the data sent by the host computer to the card, receive the card’s response, and use the card’s response as the returned data, and execute step 55. Otherwise, the message indicating that there is no card is used as return data, execute step 55;

步骤55:检查USB标志和苹果标志,若USB标志置位,则将返回数据通过USB接口返回给上位机,复位USB标志,返回步骤52,若苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位苹果标志,返回步骤52。Step 55: Check the USB logo and the Apple logo. If the USB logo is set, return the returned data to the host computer through the USB interface, reset the USB logo, and return to step 52. If the Apple logo is set, return the returned data through the Apple interface For the upper computer, reset the Apple logo, and return to step 52.

实施例6Example 6

本发明实施例6提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电,如图5所示,设备上电初始化后,功能模块执行以下步骤:Embodiment 6 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple interface of the device is connected to the host Power on, as shown in Figure 5, after the device is powered on and initialized, the functional module performs the following steps:

步骤501:打开USB接入中断、苹果接入中断和定时读卡中断,开启定时器,复位查询余额标志;Step 501: Turn on the USB access interrupt, Apple access interrupt and timing card reading interrupt, start the timer, and reset the query balance flag;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,进入USB接入中断处理流程;当苹果接口插入或拔出时,苹果接入中断被触发,进入苹果接入中断处理流程;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the USB access interrupt processing flow is entered; when the Apple interface is inserted or pulled out, the Apple access interrupt is triggered, and the Apple access interrupt is entered. processing flow;

USB接入中断处理流程具体包括:检查USB接口的供电电压,若为低电压则关闭USB数据接收中断,退出USB接入中断处理流程;若为高电压则进行USB枚举,对非接单元和接触单元上电,打开USB数据接收中断,复位定时上下电标志,退出USB接入中断处理流程;The USB access interrupt processing flow specifically includes: check the power supply voltage of the USB interface, if it is low voltage, turn off the USB data receiving interrupt, and exit the USB access interrupt processing flow; Power on the contact unit, open the USB data receiving interrupt, reset the timing power on and off flag, and exit the USB access interrupt processing flow;

苹果接入中断处理流程具体包括:检查苹果接口的供电电压,若为低电压则关闭苹果数据接收中断,退出苹果接入中断处理流程;若为高电压则打开苹果数据接收中断,置位定时上下电标志,退出苹果接入中断处理流程。The apple access interrupt processing process specifically includes: check the power supply voltage of the apple interface, if it is low voltage, turn off the apple data receiving interrupt, and exit the apple access interrupt processing flow; if it is high voltage, turn on the apple data receiving interrupt, set the timing up and down Power flag, exit the Apple access interrupt processing flow.

本实施例中,当USB接口检测到上位机发送的数据包时,USB数据接收中断被触发,进入USB数据接收中断处理流程;当苹果接口接收到上位机发送的数据包时,苹果数据接收中断被触发,进入苹果数据接收中断处理流程;In this embodiment, when the USB interface detects the data packet sent by the host computer, the USB data receiving interrupt is triggered and enters the USB data receiving interrupt processing flow; when the Apple interface receives the data packet sent by the host computer, the Apple data receiving interrupt is triggered and enters the Apple data receiving interrupt processing flow;

USB数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位USB接收标志,退出USB数据接收中断处理流程,若接收到的数据包不完整,则退出USB数据接收中断处理流程;The USB data reception interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the USB reception flag, and exit the USB data reception interrupt processing flow, if the received data packet is incomplete, then exit USB data receiving interrupt processing flow;

苹果数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位苹果接收标志,退出苹果数据接收中断处理流程,若接收到的数据包不完整,则退出苹果数据接收中断处理流程。The apple data receiving interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the apple receiving flag, and exit the apple data receiving interrupt processing flow, if the received data packet is incomplete, then exit Apple data receiving interrupt processing flow.

本实施例中,每当定时器达到预设值时,定时读卡中断被触发,进入定时读卡中断处理流程;In this embodiment, whenever the timer reaches the preset value, the timing card reading interruption is triggered, and the timing card reading interruption processing flow is entered;

定时读卡中断处理流程具体包括:The timing card reading interrupt processing flow specifically includes:

步骤i、检查定时上下电标志是否被置位,是则对非接单元和接触单元上电,执行步骤ii,否则直接执行步骤ii;Step i, check whether the timing power on and off flag is set, if yes, power on the non-contact unit and the contact unit, and execute step ii, otherwise directly execute step ii;

步骤ii、检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,退出定时读卡中断处理流程,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,退出定时读卡中断处理流程,若未查询到则设置有卡标识为第三预设值,复位查询余额标志,执行步骤iii;Step ii. Check whether there is a contact card connected to the device. If yes, set the card identification as the first preset value, and exit the timing card reading interrupt processing flow. Otherwise, check whether there is a contactless card connected to the device. If the query If it arrives, set the card identification as the second preset value, exit the timing card reading interrupt processing flow, if not inquire, then set the card identification as the third preset value, reset the query balance flag, and execute step iii;

步骤iii、检查定时上下电标志是否被置位,是则对非接单元和接触单元下电,退出定时读卡中断处理流程,否则直接退出定时读卡中断处理流程。Step iii. Check whether the timing power-on and power-on flag is set. If yes, power off the non-contact unit and the contact unit, and exit the timing card reading interruption processing flow, otherwise directly exit the timing card reading interruption processing flow.

进一步地,USB接入中断处理流程中,当USB接口的供电电压为低电压时,还包括复位USB接入标志,当USB接口的供电电压为高电压时,还包括置位USB接入标志;Further, in the USB access interrupt processing flow, when the power supply voltage of the USB interface is a low voltage, it also includes resetting the USB access flag, and when the power supply voltage of the USB interface is a high voltage, it also includes setting the USB access flag;

相应地,步骤i中,检查到定时上下电标志被置位后,对非接单元和接触单元上电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元上电,否则先控制电池单元开始供电,然后对非接单元和接触单元上电;Correspondingly, in step i, after checking that the timing power-on and power-on flags are set, before powering on the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, to the contactless unit and contact unit Power on the contact unit, otherwise first control the battery unit to start power supply, and then power on the non-contact unit and the contact unit;

步骤iii中,检查到定时上下电标志被置位后,对非接单元和接触单元下电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元下电,否则先控制电池单元停止供电,然后对非接单元和接触单元下电。In step iii, after checking that the timing power-on and power-on flags are set, before powering off the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, powering off the contactless unit and the contact unit Otherwise, first control the battery unit to stop power supply, and then power off the non-contact unit and contact unit.

步骤502:检查USB接收标志是否被置位,是则执行步骤503,否则执行步骤504;Step 502: Check whether the USB receiving flag is set, if yes, execute step 503, otherwise execute step 504;

步骤503:复位USB接收标志,置位USB标志,执行步骤506;Step 503: reset the USB receiving flag, set the USB flag, and execute step 506;

步骤504:检查苹果接收标志是否被置位,是则执行步骤505,否则执行步骤514;Step 504: Check whether the apple receiving flag is set, if yes, execute step 505, otherwise execute step 514;

步骤505:复位苹果接收标志,置位苹果标志,执行步骤506;Step 505: reset the apple receiving flag, set the apple flag, and execute step 506;

步骤506:检查卡标识,若卡标识为第一预设值则执行步骤507,若卡标识为第二预设值则执行步骤508,若为第三预设值则将提示无卡的信息作为返回数据,执行步骤510;Step 506: Check the card ID, if the card ID is the first preset value, then execute step 507, if the card ID is the second preset value, then execute step 508, if it is the third preset value, then use the message prompting no card as return data, execute step 510;

步骤507:将接收到的上位机发送的数据发送给与设备建立连接的接触卡,执行步骤509;Step 507: Send the received data sent by the host computer to the contact card that establishes a connection with the device, and execute step 509;

步骤508:将接收到的上位机发送的数据发送给与设备建立连接的非接触卡,执行步骤509;Step 508: Send the received data sent by the host computer to the contactless card that establishes a connection with the device, and execute step 509;

步骤509:判断预设时间内是否接收到卡片的应答,是则将卡片的应答作为返回数据,执行步骤510,否则将提示卡片超时的信息作为返回数据,执行步骤510;Step 509: Determine whether the response from the card is received within the preset time, if yes, take the response from the card as the return data, and execute step 510, otherwise, use the information prompting that the card has timed out as the return data, and execute step 510;

步骤510:检查USB标志是否被置位,是则执行步骤511,否则执行步骤512;Step 510: Check whether the USB flag is set, if yes, execute step 511, otherwise execute step 512;

步骤511:复位USB标志,将返回数据通过USB接口返回给上位机,返回步骤502;Step 511: reset the USB flag, return the returned data to the host computer through the USB interface, and return to step 502;

步骤512:检查苹果标志是否被置位,是则执行步骤513,否则返回步骤502;Step 512: Check whether the Apple logo is set, if yes, execute step 513, otherwise return to step 502;

步骤513:复位苹果标志,将返回数据通过苹果接口返回给上位机,返回步骤502;Step 513: Reset the Apple logo, return the returned data to the host computer through the Apple interface, and return to step 502;

步骤514:检查查询余额标志是否被置位,是则执行步骤515,否则返回步骤502;Step 514: Check whether the query balance flag is set, if yes, execute step 515, otherwise return to step 502;

步骤515:检查卡标识,若卡标识为第一预设值则执行步骤516,若为第二预设值则执行步骤517,若为第三预设值则返回步骤502;Step 515: Check the card identification, if the card identification is the first preset value, execute step 516, if it is the second preset value, execute step 517, and if it is the third preset value, return to step 502;

步骤516:向与设备建立连接的接触卡发送查询余额指令,执行步骤518;Step 516: Send an instruction to check the balance to the contact card connected with the device, and execute step 518;

步骤517:向与设备建立连接的非接触卡发送查询余额指令,执行步骤518;Step 517: Send an instruction to check the balance to the contactless card connected with the device, and execute step 518;

步骤518:判断预设时间内是否接收到卡片返回的余额信息,是则执行步骤519,否则返回步骤502;Step 518: Determine whether the balance information returned by the card is received within the preset time, if yes, execute step 519, otherwise return to step 502;

步骤519:输出卡片返回的余额信息,置位查询余额标志,返回步骤502。Step 519: Output the balance information returned by the card, set the query balance flag, and return to step 502.

实施例7Example 7

本发明实施例7提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电。设备上电初始化后,功能模块执行以下步骤:Embodiment 7 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple interface of the device is connected to the host computer, the device Power-on. After the device is powered on and initialized, the functional module performs the following steps:

步骤61:打开USB接入中断和苹果接入中断;Step 61: Turn on USB access interrupt and Apple access interrupt;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,检查USB接口的供电电压,若为高电压则打开USB数据接收中断,若为低电压则关闭USB数据接收中断;当苹果接口插入或拔出时,苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则打开苹果数据接收中断,若为低电压则关闭苹果数据接收中断;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If the voltage is high, the USB data receiving interrupt is turned on, and if the voltage is low, the USB data receiving interrupt is turned off; When the apple interface is plugged in or pulled out, the apple access interrupt is triggered, check the power supply voltage of the apple interface, if it is high voltage, turn on the apple data receiving interrupt, if it is low voltage, turn off the apple data receiving interrupt;

当USB接口检测到上位机发送的数据时,USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志。When the USB interface detects the data sent by the host computer, the USB data receiving interrupt is triggered, the data sent by the host computer is received, and the USB receiving flag is set; when the Apple interface receives the data sent by the host computer, the Apple data receiving interrupt is triggered , to receive the data sent by the host computer, and set the Apple receiving flag.

步骤62:检查苹果接收标志是否被置位,是则复位苹果接收标志,置位苹果标志,执行步骤64,否则执行步骤63;Step 62: Check whether the Apple receiving flag is set, if so, reset the Apple receiving flag, set the Apple flag, and execute step 64, otherwise execute step 63;

步骤63:检查USB接收标志是否被置位,是则复位USB接收标志,置位USB标志,执行步骤64,否则返回步骤62;Step 63: Check whether the USB receiving flag is set, if so, reset the USB receiving flag, set the USB flag, and execute step 64, otherwise return to step 62;

步骤64:判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤65,否则将提示无卡的信息作为返回数据,执行步骤65;Step 64: Determine whether there is a card that has established a connection with the device. If yes, send the data sent by the host computer to the card, receive the card’s response, and use the card’s response as the returned data, and execute step 65. Otherwise, the message indicating that there is no card is used as return data, execute step 65;

步骤65:检查USB标志和苹果标志,若苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位苹果标志,返回步骤62,若USB标志置位,则将返回数据通过USB接口返回给上位机,复位USB标志,返回步骤62。Step 65: Check the USB logo and the Apple logo. If the Apple logo is set, return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step 62. If the USB flag is set, return the returned data through the USB interface For the upper computer, reset the USB flag, and return to step 62.

实施例8Example 8

本发明实施例8提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电,如图6所示,设备上电初始化后,功能模块执行以下步骤:Embodiment 8 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple interface of the device is connected to the host computer, the device Power on, as shown in Figure 6, after the device is powered on and initialized, the functional module performs the following steps:

步骤601:打开USB接入中断、苹果接入中断和定时读卡中断,开启定时器,复位查询余额标志;Step 601: Turn on the USB access interrupt, Apple access interrupt and timing card reading interrupt, start the timer, and reset the query balance flag;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,进入USB接入中断处理流程;当苹果接口插入或拔出时,苹果接入中断被触发,进入苹果接入中断处理流程;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the USB access interrupt processing flow is entered; when the Apple interface is inserted or pulled out, the Apple access interrupt is triggered, and the Apple access interrupt is entered. processing flow;

USB接入中断处理流程具体包括:检查USB接口的供电电压,若为低电压则关闭USB数据接收中断,退出USB接入中断处理流程;若为高电压则进行USB枚举,对非接单元和接触单元上电,打开USB数据接收中断,复位定时上下电标志,退出USB接入中断处理流程;The USB access interrupt processing flow specifically includes: check the power supply voltage of the USB interface, if it is low voltage, turn off the USB data receiving interrupt, and exit the USB access interrupt processing flow; Power on the contact unit, open the USB data receiving interrupt, reset the timing power on and off flag, and exit the USB access interrupt processing flow;

苹果接入中断处理流程具体包括:检查苹果接口的供电电压,若为低电压则关闭苹果数据接收中断,退出苹果接入中断处理流程;若为高电压则打开苹果数据接收中断,置位定时上下电标志,退出苹果接入中断处理流程。The apple access interrupt processing process specifically includes: check the power supply voltage of the apple interface, if it is low voltage, turn off the apple data receiving interrupt, and exit the apple access interrupt processing flow; if it is high voltage, turn on the apple data receiving interrupt, set the timing up and down Power flag, exit the Apple access interrupt processing flow.

本实施例中,当USB接口检测到上位机发送的数据包时,USB数据接收中断被触发,进入USB数据接收中断处理流程;当苹果接口接收到上位机发送的数据包时,苹果数据接收中断被触发,进入苹果数据接收中断处理流程;In this embodiment, when the USB interface detects the data packet sent by the host computer, the USB data receiving interrupt is triggered and enters the USB data receiving interrupt processing flow; when the Apple interface receives the data packet sent by the host computer, the Apple data receiving interrupt is triggered and enters the Apple data receiving interrupt processing flow;

USB数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位USB接收标志,退出USB数据接收中断处理流程,若接收到的数据包不完整,则退出USB数据接收中断处理流程;The USB data reception interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the USB reception flag, and exit the USB data reception interrupt processing flow, if the received data packet is incomplete, then exit USB data receiving interrupt processing flow;

苹果数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位苹果接收标志,退出苹果数据接收中断处理流程,若接收到的数据包不完整,则退出苹果数据接收中断处理流程。The apple data receiving interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the apple receiving flag, and exit the apple data receiving interrupt processing flow, if the received data packet is incomplete, then exit Apple data receiving interrupt processing flow.

本实施例中,每当定时器达到预设值时,定时读卡中断被触发,进入定时读卡中断处理流程;In this embodiment, whenever the timer reaches the preset value, the timing card reading interruption is triggered, and the timing card reading interruption processing flow is entered;

定时读卡中断处理流程具体包括:The timing card reading interrupt processing flow specifically includes:

步骤i、检查定时上下电标志是否被置位,是则对非接单元和接触单元上电,执行步骤ii,否则直接执行步骤ii;Step i, check whether the timing power on and off flag is set, if yes, power on the non-contact unit and the contact unit, and execute step ii, otherwise directly execute step ii;

步骤ii、检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,退出定时读卡中断处理流程,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,退出定时读卡中断处理流程,若未查询到则设置有卡标识为第三预设值,复位查询余额标志,执行步骤iii;Step ii. Check whether there is a contact card connected to the device. If yes, set the card identification as the first preset value, and exit the timing card reading interrupt processing flow. Otherwise, check whether there is a contactless card connected to the device. If the query If it arrives, set the card identification as the second preset value, exit the timing card reading interrupt processing flow, if not inquire, then set the card identification as the third preset value, reset the query balance flag, and execute step iii;

步骤iii、检查定时上下电标志是否被置位,是则对非接单元和接触单元下电,退出定时读卡中断处理流程,否则直接退出定时读卡中断处理流程。Step iii. Check whether the timing power-on and power-on flag is set. If yes, power off the non-contact unit and the contact unit, and exit the timing card reading interruption processing flow, otherwise directly exit the timing card reading interruption processing flow.

进一步地,USB接入中断处理流程中,当USB接口的供电电压为低电压时,还包括复位USB接入标志,当USB接口的供电电压为高电压时,还包括置位USB接入标志;Further, in the USB access interrupt processing flow, when the power supply voltage of the USB interface is a low voltage, it also includes resetting the USB access flag, and when the power supply voltage of the USB interface is a high voltage, it also includes setting the USB access flag;

相应地,步骤i中,检查到定时上下电标志被置位后,对非接单元和接触单元上电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元上电,否则先控制电池单元开始供电,然后对非接单元和接触单元上电;Correspondingly, in step i, after checking that the timing power-on and power-on flags are set, before powering on the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, to the contactless unit and contact unit Power on the contact unit, otherwise first control the battery unit to start power supply, and then power on the non-contact unit and the contact unit;

步骤iii中,检查到定时上下电标志被置位后,对非接单元和接触单元下电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元下电,否则先控制电池单元停止供电,然后对非接单元和接触单元下电。In step iii, after checking that the timing power-on and power-on flags are set, before powering off the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, powering off the contactless unit and the contact unit Otherwise, first control the battery unit to stop power supply, and then power off the non-contact unit and contact unit.

步骤602:检查苹果接收标志是否被置位,是则执行步骤603,否则执行步骤604;Step 602: Check whether the apple receiving flag is set, if yes, execute step 603, otherwise execute step 604;

步骤603:复位苹果接收标志,置位苹果标志,执行步骤606;Step 603: reset the apple receiving flag, set the apple flag, and execute step 606;

步骤604:检查USB接收标志是否被置位,是则执行步骤605,否则执行步骤614;Step 604: Check whether the USB receiving flag is set, if yes, execute step 605, otherwise execute step 614;

步骤605:复位USB接收标志,置位USB标志,执行步骤606;Step 605: reset the USB receiving flag, set the USB flag, and execute step 606;

步骤606:检查卡标识,若卡标识为第一预设值则执行步骤607,若卡标识为第二预设值则执行步骤608,若为第三预设值则将提示无卡的信息作为返回数据,执行步骤610;Step 606: Check the card ID, if the card ID is the first preset value, then execute step 607, if the card ID is the second preset value, then execute step 608, if it is the third preset value, then use the message prompting no card as return data, execute step 610;

步骤607:将接收到的上位机发送的数据发送给与设备建立连接的接触卡,执行步骤609;Step 607: Send the received data sent by the host computer to the contact card that establishes a connection with the device, and execute step 609;

步骤608:将接收到的上位机发送的数据发送给与设备建立连接的非接触卡,执行步骤609;Step 608: Send the received data sent by the host computer to the contactless card that establishes a connection with the device, and execute step 609;

步骤609:判断预设时间内是否接收到卡片的应答,是则将卡片的应答作为返回数据,执行步骤610,否则将提示卡片超时的信息作为返回数据,执行步骤610;Step 609: Determine whether the response from the card is received within the preset time, if yes, use the response from the card as the return data, and execute step 610, otherwise, use the information prompting that the card has timed out as the return data, and execute step 610;

步骤610:检查苹果标志是否被置位,是则执行步骤611,否则执行步骤612;Step 610: Check whether the Apple logo is set, if yes, execute step 611, otherwise execute step 612;

步骤611:复位苹果标志,将返回数据通过苹果接口返回给上位机,返回步骤602;Step 611: Reset the Apple logo, return the returned data to the host computer through the Apple interface, and return to step 602;

步骤612:检查USB标志是否被置位,是则执行步骤613,否则返回步骤602;Step 612: Check whether the USB flag is set, if yes, execute step 613, otherwise return to step 602;

步骤613:复位USB标志,将返回数据通过USB接口返回给上位机,返回步骤602;Step 613: Reset the USB flag, return the returned data to the host computer through the USB interface, and return to step 602;

步骤614:检查查询余额标志是否被置位,是则执行步骤615,否则返回步骤602;Step 614: Check whether the query balance flag is set, if yes, execute step 615, otherwise return to step 602;

步骤615:检查卡标识,若卡标识为第一预设值则执行步骤616,若为第二预设值则执行步骤617,若为第三预设值则返回步骤602;Step 615: Check the card identification, if the card identification is the first preset value, execute step 616, if it is the second preset value, execute step 617, and if it is the third preset value, return to step 602;

步骤616:向与设备建立连接的接触卡发送查询余额指令,执行步骤618;Step 616: Send an instruction to check the balance to the contact card connected with the device, and execute step 618;

步骤617:向与设备建立连接的非接触卡发送查询余额指令,执行步骤618;Step 617: Send an instruction to check the balance to the contactless card connected with the device, and execute step 618;

步骤618:判断预设时间内是否接收到卡片返回的余额信息,是则执行步骤619,否则返回步骤602;Step 618: Determine whether the balance information returned by the card is received within the preset time, if yes, execute step 619, otherwise return to step 602;

步骤619:输出卡片返回的余额信息,置位查询余额标志,返回步骤602。Step 619: Output the balance information returned by the card, set the query balance flag, and return to step 602.

实施例9Example 9

本发明实施例9提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电。设备上电初始化后,功能模块执行以下步骤:Embodiment 9 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or the Apple interface of the device is connected to the host computer, Power-on. After the device is powered on and initialized, the functional module performs the following steps:

步骤71:打开USB接入中断和苹果接入中断;Step 71: Turn on USB access interrupt and Apple access interrupt;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,检查USB接口的供电电压,若为高电压则置位USB接入标志,打开USB数据接收中断,若为低电压则复位USB接入标志,关闭USB数据接收中断;当苹果接口插入或拔出时,苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则置位苹果接入标志,打开苹果数据接收中断,若为低电压则复位苹果接入标志,关闭苹果数据接收中断;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB access flag is set, and the USB data reception interrupt is turned on. If it is a low voltage Then reset the USB access flag and close the USB data receiving interrupt; when the Apple interface is inserted or pulled out, the Apple access interrupt is triggered, check the power supply voltage of the Apple interface, if it is high voltage, set the Apple access flag, and open the Apple interface. Data receiving interrupt, if the voltage is low, reset the Apple access flag, close the Apple data receiving interrupt;

当USB接口检测到上位机发送的数据时,USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志。When the USB interface detects the data sent by the host computer, the USB data receiving interrupt is triggered, the data sent by the host computer is received, and the USB receiving flag is set; when the Apple interface receives the data sent by the host computer, the Apple data receiving interrupt is triggered , to receive the data sent by the host computer, and set the Apple receiving flag.

步骤72:检查USB接入标志是否被置位,是则执行步骤73,否则执行步骤74;Step 72: Check whether the USB access flag is set, if yes, execute step 73, otherwise execute step 74;

步骤73、检查USB接收标志是否被置位,是则复位USB接收标志,置位USB标志,执行步骤76,否则返回步骤72;Step 73, check whether the USB receiving flag is set, if so, reset the USB receiving flag, set the USB flag, and execute step 76, otherwise return to step 72;

步骤74、检查苹果接入标志是否被置位,是则执行步骤75,否则返回步骤72;Step 74, check whether the apple access flag is set, if yes, execute step 75, otherwise return to step 72;

步骤75、检查苹果接收标志是否被置位,是则复位苹果接收标志,置位苹果标志,执行步骤76,否则返回步骤74;Step 75, check whether the Apple receiving sign is set, if so, reset the Apple receiving sign, set the Apple sign, execute step 76, otherwise return to step 74;

步骤76、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤77,否则将提示无卡的信息作为返回数据,执行步骤77;Step 76. Determine whether there is a card that has established a connection with the device. If yes, send the data sent by the host computer to the card, receive the card’s response, and use the card’s response as the returned data, and execute step 77. Otherwise, the message indicating that there is no card is used as return data, execute step 77;

步骤77、检查USB标志和所述苹果标志,若USB标志置位,则将返回数据通过USB接口返回给上位机,复位USB标志,返回步骤72;若苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位苹果标志,返回步骤74。Step 77, check the USB sign and the Apple sign, if the USB sign is set, return the returned data to the host computer through the USB interface, reset the USB sign, and return to step 72; if the Apple sign is set, then return the returned data through the Apple The interface returns to the host computer, resets the Apple logo, and returns to step 74.

实施例10Example 10

本发明实施例10提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电,如图7所示,设备上电初始化后,功能模块执行以下步骤:Embodiment 10 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple Power on, as shown in Figure 7, after the device is powered on and initialized, the functional module performs the following steps:

步骤701:打开USB接入中断、苹果接入中断和定时读卡中断,开启定时器,复位查询余额标志;Step 701: Turn on the USB access interrupt, Apple access interrupt and timing card reading interrupt, start the timer, and reset the query balance flag;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,进入USB接入中断处理流程;当苹果接口插入或拔出时,苹果接入中断被触发,进入苹果接入中断处理流程;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the USB access interrupt processing flow is entered; when the Apple interface is inserted or pulled out, the Apple access interrupt is triggered, and the Apple access interrupt is entered. processing flow;

USB接入中断处理流程具体包括:检查USB接口的供电电压,若为低电压则复位USB接入标志,关闭USB数据接收中断,退出USB接入中断处理流程;若为高电压则进行USB枚举,对非接单元和接触单元上电,置位USB接入标志,打开USB数据接收中断,复位定时上下电标志,退出USB接入中断处理流程;The USB access interrupt processing flow specifically includes: check the power supply voltage of the USB interface, if it is low voltage, reset the USB access flag, close the USB data receiving interrupt, and exit the USB access interrupt processing flow; if it is high voltage, perform USB enumeration , power on the non-contact unit and the contact unit, set the USB access flag, enable the USB data receiving interrupt, reset the timing power-on and power-on flag, and exit the USB access interrupt processing flow;

苹果接入中断处理流程具体包括:检查苹果接口的供电电压,若为低电压则复位苹果接入标志,关闭苹果数据接收中断,退出苹果接入中断处理流程;若为高电压则置位苹果接入标志,打开苹果数据接收中断,置位定时上下电标志,退出苹果接入中断处理流程。The apple access interrupt processing flow specifically includes: check the power supply voltage of the apple interface, if it is low voltage, reset the apple access flag, close the apple data receiving interrupt, and exit the apple access interrupt processing flow; if it is high voltage, set the apple interface flag Enter the flag, open the Apple data receiving interrupt, set the timing power on and off flag, and exit the Apple access interrupt processing flow.

本实施例中,当USB接口检测到上位机发送的数据包时,USB数据接收中断被触发,进入USB数据接收中断处理流程;当苹果接口接收到上位机发送的数据包时,苹果数据接收中断被触发,进入苹果数据接收中断处理流程;In this embodiment, when the USB interface detects the data packet sent by the host computer, the USB data receiving interrupt is triggered and enters the USB data receiving interrupt processing flow; when the Apple interface receives the data packet sent by the host computer, the Apple data receiving interrupt is triggered and enters the Apple data receiving interrupt processing flow;

USB数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位USB接收标志,退出USB数据接收中断处理流程,若接收到的数据包不完整,则退出USB数据接收中断处理流程;The USB data reception interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the USB reception flag, and exit the USB data reception interrupt processing flow, if the received data packet is incomplete, then exit USB data receiving interrupt processing flow;

苹果数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位苹果接收标志,退出苹果数据接收中断处理流程,若接收到的数据包不完整,则退出苹果数据接收中断处理流程。The apple data receiving interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the apple receiving flag, and exit the apple data receiving interrupt processing flow, if the received data packet is incomplete, then exit Apple data receiving interrupt processing flow.

本实施例中,每当定时器达到预设值时,定时读卡中断被触发,进入定时读卡中断处理流程;In this embodiment, whenever the timer reaches the preset value, the timing card reading interruption is triggered, and the timing card reading interruption processing flow is entered;

定时读卡中断处理流程具体包括:The timing card reading interrupt processing flow specifically includes:

步骤i、检查定时上下电标志是否被置位,是则对非接单元和接触单元上电,执行步骤ii,否则直接执行步骤ii;Step i, check whether the timing power on and off flag is set, if yes, power on the non-contact unit and the contact unit, and execute step ii, otherwise directly execute step ii;

步骤ii、检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,退出定时读卡中断处理流程,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,退出定时读卡中断处理流程,若未查询到则设置有卡标识为第三预设值,复位查询余额标志,执行步骤iii;Step ii. Check whether there is a contact card connected to the device. If yes, set the card identification as the first preset value, and exit the timing card reading interrupt processing flow. Otherwise, check whether there is a contactless card connected to the device. If the query If it arrives, set the card identification as the second preset value, exit the timing card reading interrupt processing flow, if not inquire, then set the card identification as the third preset value, reset the query balance flag, and execute step iii;

步骤iii、检查定时上下电标志是否被置位,是则对非接单元和接触单元下电,退出定时读卡中断处理流程,否则直接退出定时读卡中断处理流程。Step iii. Check whether the timing power-on and power-on flag is set. If yes, power off the non-contact unit and the contact unit, and exit the timing card reading interruption processing flow, otherwise directly exit the timing card reading interruption processing flow.

进一步地,步骤i中,检查到定时上下电标志被置位后,对非接单元和接触单元上电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元上电,否则先控制电池单元开始供电,然后对非接单元和接触单元上电;Further, in step i, after checking that the timing power-on and power-on flags are set, before powering on the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, setting the contactless unit and contact unit Power on the contact unit, otherwise first control the battery unit to start power supply, and then power on the non-contact unit and the contact unit;

步骤iii中,检查到定时上下电标志被置位后,对非接单元和接触单元下电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元下电,否则先控制电池单元停止供电,然后对非接单元和接触单元下电。In step iii, after checking that the timing power-on and power-on flags are set, before powering off the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, powering off the contactless unit and the contact unit Otherwise, first control the battery unit to stop power supply, and then power off the non-contact unit and contact unit.

步骤702:检查USB接入标志是否被置位,是则执行步骤703,否则执行步骤705;Step 702: Check whether the USB access flag is set, if yes, execute step 703, otherwise execute step 705;

步骤703:检查USB接收标志是否被置位,是则执行步骤704,否则执行步骤716;Step 703: Check whether the USB receiving flag is set, if yes, execute step 704, otherwise execute step 716;

步骤704:复位USB接收标志,置位USB标志,执行步骤708;Step 704: reset the USB receiving flag, set the USB flag, and execute step 708;

步骤705:检查苹果接入标志是否被置位,是则执行步骤706,否则返回步骤702;Step 705: Check whether the Apple access flag is set, if yes, execute step 706, otherwise return to step 702;

步骤706:检查苹果接收标志是否被置位,是则执行步骤707,否则执行步骤716;Step 706: Check whether the apple receiving flag is set, if yes, execute step 707, otherwise execute step 716;

步骤707:复位苹果接收标志,置位苹果标志,执行步骤708;Step 707: reset the apple receiving flag, set the apple flag, and execute step 708;

步骤708:检查卡标识,若卡标识为第一预设值则执行步骤709,若卡标识为第二预设值则执行步骤710,若为第三预设值则将提示无卡的信息作为返回数据,执行步骤712;Step 708: Check the card identification, if the card identification is the first default value, execute step 709, if the card identification is the second default value, execute step 710, if it is the third default value, then use the message prompting no card as return data, execute step 712;

步骤709:将接收到的上位机发送的数据发送给与设备建立连接的接触卡,执行步骤711;Step 709: Send the received data sent by the host computer to the contact card that establishes a connection with the device, and execute step 711;

步骤710:将接收到的上位机发送的数据发送给与设备建立连接的非接触卡,执行步骤711;Step 710: Send the received data sent by the host computer to the contactless card that establishes a connection with the device, and execute step 711;

步骤711:判断预设时间内是否接收到卡片的应答,是则将卡片的应答作为返回数据,执行步骤712,否则将提示卡片超时的信息作为返回数据,执行步骤712;Step 711: Determine whether the response from the card is received within the preset time, if yes, use the response from the card as the return data, and execute step 712, otherwise, use the information prompting that the card has timed out as the return data, and execute step 712;

步骤712:检查USB标志是否被置位,是则执行步骤713,否则执行步骤714;Step 712: Check whether the USB flag is set, if yes, execute step 713, otherwise execute step 714;

步骤713:复位USB标志,将返回数据通过USB接口返回给上位机,返回步骤702;Step 713: Reset the USB flag, return the returned data to the host computer through the USB interface, and return to step 702;

步骤714:检查苹果标志是否被置位,是则执行步骤715,否则返回步骤702;Step 714: Check whether the Apple logo is set, if yes, execute step 715, otherwise return to step 702;

步骤715:复位苹果标志,将返回数据通过苹果接口返回给上位机,返回步骤705;Step 715: Reset the Apple logo, return the returned data to the host computer through the Apple interface, and return to step 705;

步骤716:检查查询余额标志是否被置位,是则执行步骤717,否则返回步骤702;Step 716: Check whether the query balance flag is set, if yes, execute step 717, otherwise return to step 702;

步骤717:检查卡标识,若卡标识为第一预设值则执行步骤718,若为第二预设值则执行步骤719,若为第三预设值则返回步骤702;Step 717: Check the card identification, if the card identification is the first preset value, execute step 718, if it is the second preset value, execute step 719, and if it is the third preset value, return to step 702;

步骤718:向与设备建立连接的接触卡发送查询余额指令,执行步骤720;Step 718: Send an instruction to check the balance to the contact card connected with the device, and execute step 720;

步骤719:向与设备建立连接的非接触卡发送查询余额指令,执行步骤720;Step 719: Send an instruction to check the balance to the contactless card connected with the device, and execute step 720;

步骤720:判断预设时间内是否接收到卡片返回的余额信息,是则执行步骤721,否则返回步骤702;Step 720: Determine whether the balance information returned by the card is received within the preset time, if yes, execute step 721, otherwise return to step 702;

步骤721:输出卡片返回的余额信息,置位查询余额标志,返回步骤702。Step 721: Output the balance information returned by the card, set the query balance flag, and return to step 702.

实施例11Example 11

本发明实施例11提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电。设备上电初始化后,功能模块执行以下步骤:Embodiment 11 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple interface of the device is connected to the host computer, the device Power-on. After the device is powered on and initialized, the functional module performs the following steps:

步骤81:打开USB接入中断和苹果接入中断;Step 81: Turn on USB access interrupt and Apple access interrupt;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,检查USB接口的供电电压,若为高电压则置位USB接入标志,打开USB数据接收中断,若为低电压则复位USB接入标志,关闭USB数据接收中断;当苹果接口插入或拔出时,苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则置位苹果接入标志,打开苹果数据接收中断,若为低电压则复位苹果接入标志,关闭苹果数据接收中断;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB access flag is set, and the USB data reception interrupt is turned on. If it is a low voltage Then reset the USB access flag and close the USB data receiving interrupt; when the Apple interface is inserted or pulled out, the Apple access interrupt is triggered, check the power supply voltage of the Apple interface, if it is high voltage, set the Apple access flag, and open the Apple interface. Data receiving interrupt, if the voltage is low, reset the Apple access flag, close the Apple data receiving interrupt;

当USB接口检测到上位机发送的数据时,USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志。When the USB interface detects the data sent by the host computer, the USB data receiving interrupt is triggered, the data sent by the host computer is received, and the USB receiving flag is set; when the Apple interface receives the data sent by the host computer, the Apple data receiving interrupt is triggered , to receive the data sent by the host computer, and set the Apple receiving flag.

步骤82:检查苹果接入标志是否被置位,是则执行步骤83,否则执行步骤84;Step 82: Check whether the Apple access flag is set, if yes, execute step 83, otherwise execute step 84;

步骤83:检查苹果接收标志是否被置位,是则复位苹果接收标志,置位苹果标志,执行步骤86,否则返回步骤82;Step 83: Check whether the Apple receiving flag is set, if so, reset the Apple receiving flag, set the Apple flag, execute step 86, otherwise return to step 82;

步骤84:检查USB接入标志是否被置位,是则执行步骤85,否则返回步骤82;Step 84: check whether the USB access flag is set, if yes, execute step 85, otherwise return to step 82;

步骤85:检查USB接收标志是否被置位,是则复位USB接收标志,置位USB标志,执行步骤86,否则返回步骤84;Step 85: Check whether the USB receiving flag is set, if so, reset the USB receiving flag, set the USB flag, and execute step 86, otherwise return to step 84;

步骤86:判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤87,否则将提示无卡的信息作为返回数据,执行步骤87;Step 86: Determine whether there is a card that has established a connection with the device. If yes, send the data sent by the host computer to the card, receive the card’s response, and use the card’s response as the returned data, and execute step 87. Otherwise, the message indicating that there is no card is used as return data, execute step 87;

步骤87:检查USB标志和所述苹果标志,若USB标志置位,则将返回数据通过USB接口返回给上位机,复位USB标志,返回步骤84;若苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位苹果标志,返回步骤82。Step 87: Check the USB sign and the Apple sign, if the USB sign is set, return the returned data to the host computer through the USB interface, reset the USB sign, and return to step 84; if the Apple sign is set, then return the returned data through the Apple The interface returns to the host computer, resets the Apple logo, and returns to step 82.

实施例12Example 12

本发明实施例12提供了一种带有电源管理的多接口移动安全设备的工作方法,所述方法具体包括当设备的USB接口接入上位机,或设备的苹果接口接入上位机时,设备上电,如图7所示,设备上电初始化后,功能模块执行以下步骤:Embodiment 12 of the present invention provides a working method of a multi-interface mobile security device with power management. The method specifically includes when the USB interface of the device is connected to the host computer, or when the Apple interface of the device is connected to the host computer, the device Power on, as shown in Figure 7, after the device is powered on and initialized, the functional module performs the following steps:

步骤801:打开USB接入中断、苹果接入中断和定时读卡中断,开启定时器,复位查询余额标志;Step 801: Turn on the USB access interrupt, Apple access interrupt and timing card reading interrupt, start the timer, and reset the query balance flag;

本实施例中,当USB接口插入或拔出时,USB接入中断被触发,进入USB接入中断处理流程;当苹果接口插入或拔出时,苹果接入中断被触发,进入苹果接入中断处理流程;In this embodiment, when the USB interface is inserted or pulled out, the USB access interrupt is triggered, and the USB access interrupt processing flow is entered; when the Apple interface is inserted or pulled out, the Apple access interrupt is triggered, and the Apple access interrupt is entered. processing flow;

USB接入中断处理流程具体包括:检查USB接口的供电电压,若为低电压则复位USB接入标志,关闭USB数据接收中断,退出USB接入中断处理流程;若为高电压则进行USB枚举,对非接单元和接触单元上电,置位USB接入标志,打开USB数据接收中断,复位定时上下电标志,退出USB接入中断处理流程;The USB access interrupt processing flow specifically includes: check the power supply voltage of the USB interface, if it is low voltage, reset the USB access flag, close the USB data receiving interrupt, and exit the USB access interrupt processing flow; if it is high voltage, perform USB enumeration , power on the non-contact unit and the contact unit, set the USB access flag, enable the USB data receiving interrupt, reset the timing power-on and power-on flag, and exit the USB access interrupt processing flow;

苹果接入中断处理流程具体包括:检查苹果接口的供电电压,若为低电压则复位苹果接入标志,关闭苹果数据接收中断,退出苹果接入中断处理流程;若为高电压则置位苹果接入标志,打开苹果数据接收中断,置位定时上下电标志,退出苹果接入中断处理流程。The apple access interrupt processing flow specifically includes: check the power supply voltage of the apple interface, if it is low voltage, reset the apple access flag, close the apple data receiving interrupt, and exit the apple access interrupt processing flow; if it is high voltage, set the apple interface flag Enter the flag, open the Apple data receiving interrupt, set the timing power on and off flag, and exit the Apple access interrupt processing flow.

本实施例中,当USB接口检测到上位机发送的数据包时,USB数据接收中断被触发,进入USB数据接收中断处理流程;当苹果接口接收到上位机发送的数据包时,苹果数据接收中断被触发,进入苹果数据接收中断处理流程;In this embodiment, when the USB interface detects the data packet sent by the host computer, the USB data receiving interrupt is triggered and enters the USB data receiving interrupt processing flow; when the Apple interface receives the data packet sent by the host computer, the Apple data receiving interrupt is triggered and enters the Apple data receiving interrupt processing flow;

USB数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位USB接收标志,退出USB数据接收中断处理流程,若接收到的数据包不完整,则退出USB数据接收中断处理流程;The USB data reception interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the USB reception flag, and exit the USB data reception interrupt processing flow, if the received data packet is incomplete, then exit USB data receiving interrupt processing flow;

苹果数据接收中断处理流程具体包括:接收上位机发送的数据包,若接收到的数据包完整则置位苹果接收标志,退出苹果数据接收中断处理流程,若接收到的数据包不完整,则退出苹果数据接收中断处理流程。The apple data receiving interrupt processing flow specifically includes: receiving the data packet sent by the host computer, if the received data packet is complete, set the apple receiving flag, and exit the apple data receiving interrupt processing flow, if the received data packet is incomplete, then exit Apple data receiving interrupt processing flow.

本实施例中,每当定时器达到预设值时,定时读卡中断被触发,进入定时读卡中断处理流程;In this embodiment, whenever the timer reaches the preset value, the timing card reading interruption is triggered, and the timing card reading interruption processing flow is entered;

定时读卡中断处理流程具体包括:The timing card reading interrupt processing flow specifically includes:

步骤i、检查定时上下电标志是否被置位,是则对非接单元和接触单元上电,执行步骤ii,否则直接执行步骤ii;Step i, check whether the timing power on and off flag is set, if yes, power on the non-contact unit and the contact unit, and execute step ii, otherwise directly execute step ii;

步骤ii、检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,退出定时读卡中断处理流程,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,退出定时读卡中断处理流程,若未查询到则设置有卡标识为第三预设值,复位查询余额标志,执行步骤iii;Step ii. Check whether there is a contact card connected to the device. If yes, set the card identification as the first preset value, and exit the timing card reading interrupt processing flow. Otherwise, check whether there is a contactless card connected to the device. If the query If it arrives, set the card identification as the second preset value, exit the timing card reading interrupt processing flow, if not inquire, then set the card identification as the third preset value, reset the query balance flag, and execute step iii;

步骤iii、检查定时上下电标志是否被置位,是则对非接单元和接触单元下电,退出定时读卡中断处理流程,否则直接退出定时读卡中断处理流程。Step iii. Check whether the timing power-on and power-on flag is set. If yes, power off the non-contact unit and the contact unit, and exit the timing card reading interruption processing flow, otherwise directly exit the timing card reading interruption processing flow.

进一步地,步骤i中,检查到定时上下电标志被置位后,对非接单元和接触单元上电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元上电,否则先控制电池单元开始供电,然后对非接单元和接触单元上电;Further, in step i, after checking that the timing power-on and power-on flags are set, before powering on the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, setting the contactless unit and contact unit Power on the contact unit, otherwise first control the battery unit to start power supply, and then power on the non-contact unit and the contact unit;

步骤iii中,检查到定时上下电标志被置位后,对非接单元和接触单元下电之前,还可以包括:检查USB接入标志是否被置位,是则对非接单元和接触单元下电,否则先控制电池单元停止供电,然后对非接单元和接触单元下电。In step iii, after checking that the timing power-on and power-on flags are set, before powering off the contactless unit and the contact unit, it may also include: checking whether the USB access flag is set, and if so, powering off the contactless unit and the contact unit Otherwise, first control the battery unit to stop power supply, and then power off the non-contact unit and contact unit.

步骤802:检查苹果接入标志是否被置位,是则执行步骤803,否则执行步骤805;Step 802: Check whether the Apple access flag is set, if yes, execute step 803, otherwise execute step 805;

步骤803:检查苹果接收标志是否被置位,是则执行步骤804,否则执行步骤816;Step 803: Check whether the apple receiving flag is set, if yes, execute step 804, otherwise execute step 816;

步骤804:复位苹果接收标志,置位苹果标志,执行步骤808;Step 804: reset the apple receiving flag, set the apple flag, and execute step 808;

步骤805:检查USB接入标志是否被置位,是则执行步骤806,否则返回步骤802;Step 805: Check whether the USB access flag is set, if yes, execute step 806, otherwise return to step 802;

步骤806:检查USB接收标志是否被置位,是则执行步骤807,否则执行步骤816;Step 806: Check whether the USB receiving flag is set, if yes, execute step 807, otherwise execute step 816;

步骤807:复位USB接收标志,置位USB标志,执行步骤808;Step 807: reset the USB receiving flag, set the USB flag, and execute step 808;

步骤808:检查卡标识,若卡标识为第一预设值则执行步骤809,若卡标识为第二预设值则执行步骤810,若为第三预设值则将提示无卡的信息作为返回数据,执行步骤812;Step 808: Check the card ID, if the card ID is the first preset value, then execute step 809, if the card ID is the second preset value, then execute step 810, if it is the third preset value, then use the message prompting no card as return data, execute step 812;

步骤809:将接收到的上位机发送的数据发送给与设备建立连接的接触卡,执行步骤811;Step 809: Send the received data sent by the host computer to the contact card that establishes a connection with the device, and execute step 811;

步骤810:将接收到的上位机发送的数据发送给与设备建立连接的非接触卡,执行步骤811;Step 810: Send the received data sent by the host computer to the contactless card that establishes a connection with the device, and execute step 811;

步骤811:判断预设时间内是否接收到卡片的应答,是则将卡片的应答作为返回数据,执行步骤812,否则将提示卡片超时的信息作为返回数据,执行步骤812;Step 811: Determine whether the response from the card is received within the preset time, if yes, take the response from the card as the return data, and execute step 812, otherwise, use the information prompting that the card has timed out as the return data, and execute step 812;

步骤812:检查苹果标志是否被置位,是则执行步骤813,否则执行步骤814;Step 812: Check whether the Apple logo is set, if yes, execute step 813, otherwise execute step 814;

步骤813:复位苹果标志,将返回数据通过苹果接口返回给上位机,返回步骤802;Step 813: Reset the Apple logo, return the returned data to the host computer through the Apple interface, and return to step 802;

步骤814:检查USB标志是否被置位,是则执行步骤815,否则返回步骤802;Step 814: Check whether the USB flag is set, if yes, execute step 815, otherwise return to step 802;

步骤815:复位USB标志,将返回数据通过苹果接口返回给上位机,返回步骤805;Step 815: Reset the USB flag, return the returned data to the host computer through the Apple interface, and return to step 805;

步骤816:检查查询余额标志是否被置位,是则执行步骤817,否则返回步骤802;Step 816: Check whether the query balance flag is set, if yes, execute step 817, otherwise return to step 802;

步骤817:检查卡标识,若卡标识为第一预设值则执行步骤818,若为第二预设值则执行步骤819,若为第三预设值则返回步骤802;Step 817: Check the card identification, if the card identification is the first preset value, execute step 818, if it is the second preset value, execute step 819, and if it is the third preset value, return to step 802;

步骤818:向与设备建立连接的接触卡发送查询余额指令,执行步骤820;Step 818: Send an instruction to check the balance to the contact card connected with the device, and execute step 820;

步骤819:向与设备建立连接的非接触卡发送查询余额指令,执行步骤820;Step 819: Send an instruction to check the balance to the contactless card connected with the device, and execute step 820;

步骤820:判断预设时间内是否接收到卡片返回的余额信息,是则执行步骤821,否则返回步骤802;Step 820: Determine whether the balance information returned by the card is received within the preset time, if yes, execute step 821, otherwise return to step 802;

步骤821:输出卡片返回的余额信息,置位查询余额标志,返回步骤802。以上所述的实施例只是本发明较优选的具体实施方式,本领域的技术人员在本发明技术方案范围内进行的通常变化和替换都应包含在本发明的保护范围内。Step 821: Output the balance information returned by the card, set the query balance flag, and return to step 802. The above-described embodiments are only preferred specific implementations of the present invention, and ordinary changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.

Claims (33)

1.一种带有电源管理的多接口移动安全设备,其特征在于,包括:USB接口模块、苹果接口模块、电池模块、电源管理模块和功能模块;1. A multi-interface mobile security device with power management, characterized in that it comprises: a USB interface module, an apple interface module, a battery module, a power management module and a function module; 所述USB接口模块,与所述电池模块、所述电源管理模块和所述功能模块相连,用于与上位机连接,从上位机获取电能,用获取到的电能对所述电池模块充电以及通过所述电源管理模块向所述功能模块供电,与所述功能模块和上位机进行通讯;The USB interface module is connected with the battery module, the power management module and the functional module, and is used to connect with the upper computer, obtain electric energy from the upper computer, use the obtained electric energy to charge the battery module, and pass The power management module supplies power to the functional module, and communicates with the functional module and the host computer; 所述苹果接口模块,与所述电源管理模块和所述功能模块相连,用于与上位机连接,从上位机获取电能,用获取到的电能通过所述电源管理模块向所述功能模块供电,与所述功能模块和上位机进行通讯;The apple interface module is connected with the power management module and the functional module, and is used to connect with the upper computer, obtain electric energy from the upper computer, and use the obtained electric energy to supply power to the functional module through the power management module, Communicate with the functional module and the host computer; 所述电池模块,与所述USB接口模块和所述电源管理模块相连,用于当所述设备仅通过所述苹果接口模块与上位机连接时,通过所述电源管理模块向所述功能模块供电;The battery module is connected to the USB interface module and the power management module, and is used to supply power to the functional module through the power management module when the device is only connected to the host computer through the Apple interface module ; 所述电源管理模块,与所述USB接口模块、所述苹果接口模块、所述电池模块和所述功能模块相连,用于当所述USB接口模块与上位机连接时,控制由所述USB接口模块用从上位机获取到的电能为所述功能模块供电,以及当所述设备仅通过所述苹果接口模块与上位机连接时,控制由所述电池模块用储存的电能、所述苹果接口模块用从上位机获取到的电能共同为所述功能模块供电;The power management module is connected with the USB interface module, the Apple interface module, the battery module and the function module, and is used to control the power supply by the USB interface when the USB interface module is connected to the upper computer. The module uses the electric energy obtained from the upper computer to supply power to the functional module, and when the device is only connected to the upper computer through the apple interface module, it controls the electric energy stored by the battery module, the apple interface module Using the electric energy obtained from the upper computer to jointly supply power to the functional modules; 所述功能模块,与所述USB接口模块、所述苹果接口模块和所述电源管理模块相连,用于与所述USB接口模块、所述苹果接口模块和卡片进行通讯。The function module is connected with the USB interface module, the Apple interface module and the power management module, and is used for communicating with the USB interface module, the Apple interface module and the card. 2.如权利要求1所述的设备,其特征在于,所述功能模块,还用于当所述设备仅通过所述苹果接口模块与上位机连接,且所述设备与卡片进行通讯时,向所述电源管理模块发送控制信号;2. The device as claimed in claim 1, wherein the functional module is also used to send information to the host computer when the device is only connected to the host computer through the Apple interface module and the device communicates with the card. The power management module sends a control signal; 所述电源管理模块,具体用于当所述USB接口模块与上位机连接时,控制由所述USB接口模块用从上位机获取到的电能为所述功能模块供电,当所述设备仅通过所述苹果接口模块与上位机连接时,控制由所述苹果接口模块用从上位机获取到的电能为所述功能模块供电,以及当接收到所述功能模块发送的控制信号时,控制所述电池模块用储存的电能与所述苹果接口模块共同为所述功能模块供电。The power management module is specifically used to control the USB interface module to supply power to the functional modules with the power obtained from the host computer when the USB interface module is connected to the host computer. When the apple interface module is connected with the host computer, the apple interface module is controlled to supply power to the functional module with the electric energy obtained from the host computer, and when receiving the control signal sent by the functional module, control the battery The module uses the stored electric energy to supply power to the functional module together with the apple interface module. 3.如权利要求1设备,其特征在于,所述苹果接口模块包括苹果接口单元和苹果通讯单元;所述电池模块包括充电管理单元和电池单元;所述功能模块包括主控单元、非接电源控制单元、非接单元、接触电源控制单元、接触单元和人机交互单元;3. equipment as claimed in claim 1, is characterized in that, described apple interface module comprises apple interface unit and apple communication unit; Described battery module comprises charge management unit and battery unit; Described function module comprises main control unit, contactless power supply Control unit, contactless unit, contact power control unit, contact unit and human-computer interaction unit; 所述USB接口模块,与所述充电管理单元、所述电源管理模块和所述主控单元相连,用于与上位机连接,从上位机获取电能,通过所述充电管理单元向所述电池单元充电,通过所述电源管理模块向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,以及与所述主控单元和上位机进行数据通讯;The USB interface module is connected with the charging management unit, the power management module and the main control unit, and is used to connect with a host computer, obtain electric energy from the host computer, and supply power to the battery unit through the charging management unit. Charging, supplying power to the main control unit, the contactless power supply control unit, the contact power supply control unit and the human-computer interaction unit through the power management module, and communicating with the main control unit and the host computer communication; 所述苹果接口单元,与所述苹果通讯单元和所述电源管理模块相连,用于与上位机连接,从上位机获取电能,通过所述电源管理模块为所述主控单元和所述人机交互单元供电,以及所述苹果通讯单元和上位机进行数据通讯;The apple interface unit is connected with the apple communication unit and the power management module, and is used to connect with the host computer, obtain electric energy from the host computer, and provide power for the main control unit and the man-machine through the power management module. The interactive unit supplies power, and the Apple communication unit and the upper computer perform data communication; 所述苹果通讯单元,与所述苹果接口单元和所述主控单元相连,用于与所述苹果接口单元和所述主控单元进行数据通讯;The apple communication unit is connected with the apple interface unit and the main control unit, and is used for data communication with the apple interface unit and the main control unit; 所述充电管理单元,与所述USB接口模块和所述电池单元相连,用于当所述电池单元电能未蓄满时,从所述USB接口模块获取电能传递给所述电池单元,当所述电池单元电能蓄满时,停止从所述USB接口模块获取电能;The charging management unit is connected to the USB interface module and the battery unit, and is used to obtain power from the USB interface module and transmit it to the battery unit when the battery unit is not fully charged. When the electric energy of the battery unit is fully stored, stop obtaining electric energy from the USB interface module; 所述电池单元,与所述充电管理单元和所述电源管理模块相连,用于在所述设备仅通过所述苹果接口单元与上位机连接时,通过所述电源管理模块为所述非接电源控制单元和所述接触电源控制单元供电;The battery unit is connected to the charging management unit and the power management module, and is used to provide the non-connected power supply through the power management module when the device is only connected to the upper computer through the Apple interface unit. The control unit and the contact power control unit supply power; 所述电源管理模块,与所述USB接口模块、所述苹果接口单元、所述电池单元、所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元相连,用于当所述USB接口模块与上位机连接时,控制由所述USB接口模块用从上位机获取到的电能为所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,当所述设备仅通过所述苹果接口单元与上位机连接时,控制由电池单元用储存的电能为所述非接电源控制单元和所述接触电源控制单元供电,由所述苹果接口单元用从上位机获取到的电能为所述主控单元和所述人机交互单元供电;The power management module interacts with the USB interface module, the Apple interface unit, the battery unit, the main control unit, the contactless power control unit, the contact power control unit, and the human-computer interaction The unit is connected, and is used to control the power obtained from the host computer by the USB interface module to provide the main control unit, the contactless power supply control unit, and the contactor when the USB interface module is connected to the host computer. The power supply control unit and the human-computer interaction unit supply power. When the device is only connected to the host computer through the Apple interface unit, the battery unit is controlled to use the stored electric energy to provide the contactless power supply control unit and the contact power supply. The control unit is powered, and the main control unit and the human-computer interaction unit are powered by the apple interface unit with the electric energy obtained from the upper computer; 所述主控单元,与所述USB接口模块、所述苹果通讯单元、所述电源管理模块、所述非接电源控制单元、非接单元、接触电源控制单元、接触单元和人机交互单元相连,用于向所述非接电源控制单元和所述接触电源控制单元发送控制信号,以及与所述非接单元、所述接触单元、所述USB接口模块和所述苹果通讯单元进行数据通讯;The main control unit is connected with the USB interface module, the Apple communication unit, the power management module, the contactless power control unit, the contactless unit, the contact power control unit, the contact unit and the human-computer interaction unit , for sending control signals to the contactless power supply control unit and the contact power supply control unit, and performing data communication with the contactless unit, the contact unit, the USB interface module and the Apple communication unit; 所述非接电源控制单元,与所述电源管理模块、所述主控单元和所述非接单元相连,用于接收所述主控单元发送的控制信号,控制所述非接单元的上电和下电;The contactless power supply control unit is connected with the power management module, the main control unit and the contactless unit, and is used to receive the control signal sent by the main control unit and control the power-on of the contactless unit and power off; 所述非接单元,与所述非接电源控制单元和所述主控单元相连,用于与所述主控单元和非接触卡进行数据通讯;The contactless unit is connected to the contactless power supply control unit and the main control unit, and is used for data communication with the main control unit and the contactless card; 所述接触电源控制单元,与所述电源管理模块、所述主控单元和所述接触单元相连,用于接收所述主控单元发送的控制信号,控制所述接触单元的上电和下电;The contact power control unit is connected with the power management module, the main control unit and the contact unit, and is used to receive the control signal sent by the main control unit, and control the power-on and power-off of the contact unit ; 所述接触单元,与所述接触电源控制单元和所述主控单元相连,用于与所述主控单元和接触卡进行数据通讯;The contact unit is connected with the contact power control unit and the main control unit, and is used for data communication with the main control unit and the contact card; 所述人机交互单元,与所述电源管理模块和所述主控单元相连,用于进行人机交互。The human-computer interaction unit is connected with the power management module and the main control unit for human-computer interaction. 4.如权利要求3所述的设备,其特征在于,所述电池单元,还用于通过所述电源管理模块为所述主控单元和所述人机交互单元供电;4. The device according to claim 3, wherein the battery unit is also used to supply power to the main control unit and the human-computer interaction unit through the power management module; 所述电源管理模块,当所述设备仅通过所述苹果接口单元与上位机连接时,还用于控制所述电池单元用储存的电能为所述主控单元和所述人机交互单元供电。The power management module is also used to control the battery unit to supply power to the main control unit and the human-computer interaction unit with stored electric energy when the device is only connected to the host computer through the Apple interface unit. 5.如权利要求3所述的设备,其特征在于,所述电源管理模块包括供电自动切换电路单元、系统电源管理单元和供电隔离单元;5. The device according to claim 3, wherein the power management module comprises a power supply automatic switching circuit unit, a system power management unit and a power supply isolation unit; 所述供电自动切换电路单元,与所述USB接口模块、所述电池单元、所述非接电源控制单元和所述接触电源控制单元相连,用于当所述USB接口模块与上位机连接时,仅允许来自所述USB接口模块的电流通过,当所述USB接口模块未与上位机连接时,允许来自所述电池单元的电流通过;The power supply automatic switching circuit unit is connected with the USB interface module, the battery unit, the contactless power supply control unit and the contact power supply control unit, for when the USB interface module is connected to the upper computer, Only allow the current from the USB interface module to pass through, and when the USB interface module is not connected to the host computer, allow the current from the battery unit to pass through; 所述系统电源管理单元,与所述USB接口模块和所述供电隔离单元相连,用于在被使能时,对输入的电压进行转换得到预设电压,输出预设电压,通过所述供电隔离单元向所述主控单元和所述人机交互单元供电;The system power management unit is connected to the USB interface module and the power supply isolation unit, and is used to convert the input voltage to obtain a preset voltage when enabled, output a preset voltage, and isolate the voltage through the power supply The unit supplies power to the main control unit and the human-computer interaction unit; 所述供电隔离单元,与所述苹果接口单元、所述系统电源管理单元、所述主控单元和所述人机交互单元相连,用于当所述苹果接口单元与上位机连接时,用来自所述苹果接口单元的电流对所述主控单元和所述人机交互单元供电,以及当所述USB接口模块与上位机连接时,用来自所述系统电源管理单元的电流为所述主控单元和所述人机交互单元供电,和阻隔来自所述系统电源管理单元的电流流入所述苹果接口单元。The power supply isolation unit is connected with the apple interface unit, the system power management unit, the main control unit and the human-computer interaction unit, and is used for when the apple interface unit is connected with the upper computer The current of the apple interface unit supplies power to the main control unit and the human-computer interaction unit, and when the USB interface module is connected to the upper computer, the current from the system power management unit is used to power the main control unit. The unit and the human-computer interaction unit are powered, and the current from the system power management unit is blocked from flowing into the apple interface unit. 6.如权利要求5所述的设备,其特征在于,6. The apparatus of claim 5, wherein 所述USB接口模块,具体用于与上位机连接,从上位机获取电能,通过所述充电管理单元对所述电池单元充电,通过所述供电自动切换电路单元向所述非接电源控制单元和所述接触电源控制单元供电,向所述系统电源管理单元发送电信号,使能所述系统电源管理单元,通过所述系统电源管理单元和所述供电隔离单元向所述主控单元和所述人机交互单元供电,还用于与所述主控单元和上位机进行数据通讯;The USB interface module is specifically used to connect with a host computer, obtain electric energy from the host computer, charge the battery unit through the charging management unit, and supply power to the contactless power supply control unit and the contactless power supply control unit through the power supply automatic switching circuit unit. The contact power supply control unit supplies power, sends an electrical signal to the system power management unit, enables the system power management unit, and supplies power to the main control unit and the power supply isolation unit through the system power management unit and the power supply isolation unit. The human-computer interaction unit supplies power, and is also used for data communication with the main control unit and the host computer; 所述苹果接口单元,具体用于与上位机连接,从上位机获取电能,通过所述供电隔离单元向所述主控单元和所述人机交互单元供电,还用于与所述苹果通讯单元和上位机进行数据通讯;The apple interface unit is specifically used to connect with the host computer, obtain electric energy from the host computer, supply power to the main control unit and the human-computer interaction unit through the power supply isolation unit, and is also used to communicate with the apple communication unit Data communication with host computer; 所述电池单元,具体用于在所述设备仅通过所述苹果接口单元与上位机连接时,通过所述供电自动切换电路单元向所述非接电源控制单元和所述接触电源控制单元供电。The battery unit is specifically used to supply power to the contactless power supply control unit and the contact power supply control unit through the power supply automatic switching circuit unit when the device is only connected to the host computer through the Apple interface unit. 7.如权利要求4所述的设备,其特征在于,所述电源管理模块包括供电自动切换电路单元、电压隔离单元、系统电源管理单元和供电隔离单元;7. The device according to claim 4, wherein the power management module comprises a power supply automatic switching circuit unit, a voltage isolation unit, a system power management unit and a power supply isolation unit; 所述供电自动切换电路单元,与所述USB接口模块、所述电池单元和所述系统电源管理单元相连,用于当所述USB接口模块与上位机连接时,仅允许来自所述USB接口模块的电流通过,当所述USB接口模块未与上位机连接时,允许来自所述电池单元的电流通过;The power supply automatic switching circuit unit is connected with the USB interface module, the battery unit and the system power management unit, and is used to only allow power from the USB interface module when the USB interface module is connected to the upper computer The current from the battery unit is allowed to pass through when the USB interface module is not connected to the host computer; 所述电压隔离单元,与所述USB接口模块、所述苹果接口单元和所述系统电源管理单元相连,用于将所述苹果接口单元发送的电信号发送给所述系统电源管理单元,使能所述系统电源管理单元,以及阻隔来自所述USB接口模块的电压进入所述苹果接口单元;The voltage isolation unit is connected to the USB interface module, the Apple interface unit and the system power management unit, and is used to send the electrical signal sent by the Apple interface unit to the system power management unit, enabling The system power management unit, and blocking the voltage from the USB interface module from entering the apple interface unit; 所述系统电源管理单元,与所述USB接口模块、所述供电自动切换电路单元、所述电压隔离单元、所述供电隔离单元、所述非接电源控制单元和所述接触电源控制单元相连,用于在被使能时,对输入的电压进行转换得到预设电压,输出预设电压,直接向所述非接电源控制单元和所述接触电源控制单元供电、通过所述供电隔离单元向所述主控单元和所述人机交互单元供电;The system power management unit is connected to the USB interface module, the power supply automatic switching circuit unit, the voltage isolation unit, the power supply isolation unit, the contactless power supply control unit and the contact power supply control unit, When enabled, convert the input voltage to obtain a preset voltage, output the preset voltage, directly supply power to the contactless power supply control unit and the contact power supply control unit, and supply power to all power supply control units through the power supply isolation unit The main control unit and the human-computer interaction unit are powered; 所述供电隔离单元,与所述苹果接口单元、所述系统电源管理单元、所述主控单元和所述人机交互单元相连,用于当所述苹果接口单元与上位机连接时,用来自所述苹果接口单元的电流为所述主控单元和所述人机交互单元供电,以及当所述USB接口模块与上位机连接时,用来自所述系统电源管理单元的电流为所述主控单元和所述人机交互单元供电,和阻隔来自所述系统电源管理单元的电流流入所述苹果接口单元。The power supply isolation unit is connected with the apple interface unit, the system power management unit, the main control unit and the human-computer interaction unit, and is used for when the apple interface unit is connected with the upper computer The current of the apple interface unit supplies power for the main control unit and the human-computer interaction unit, and when the USB interface module is connected to the host computer, the current from the system power management unit is used to power the main control unit. The unit and the human-computer interaction unit are powered, and the current from the system power management unit is blocked from flowing into the apple interface unit. 8.如权利要求7所述的设备,其特征在于,8. The apparatus of claim 7, wherein 所述USB接口模块,具体用于与上位机连接,从上位机获取电能,通过所述充电管理单元对所述电池单元充电,向所述系统电源管理单元发送电信号,使能所述系统电源管理单元,通过所述供电自动切换电路单元和所述系统电源管理单元,为所述非接电源控制单元和所述接触电源控制单元供电,通过所述供电自动切换电路单元、所述系统电源管理单元和所述供电隔离单元,向所述主控单元和所述人机交互单元供电,还用于与所述主控单元和上位机进行数据通讯;The USB interface module is specifically used to connect with the host computer, obtain electric energy from the host computer, charge the battery unit through the charging management unit, send an electrical signal to the system power management unit, and enable the system power supply The management unit supplies power to the contactless power supply control unit and the contact power supply control unit through the power supply automatic switching circuit unit and the system power management unit, through the power supply automatic switching circuit unit, the system power management unit The unit and the power supply isolation unit supply power to the main control unit and the human-computer interaction unit, and are also used for data communication with the main control unit and the host computer; 所述苹果接口单元,具体用于与上位机连接,从上位机获取电能,通过所述电压隔离单元向所述系统电源管理单元发送电信号,使能所述系统电源管理单元,通过所述供电隔离单元向所述主控单元和所述人机交互单元供电,还用于与所述苹果通讯单元和上位机进行数据通讯;The apple interface unit is specifically used to connect with the host computer, obtain electric energy from the host computer, send an electrical signal to the system power management unit through the voltage isolation unit, enable the system power management unit, and pass the power supply The isolation unit supplies power to the main control unit and the human-computer interaction unit, and is also used for data communication with the apple communication unit and the upper computer; 所述电池单元,具体用于在所述设备仅通过所述苹果接口单元与上位机连接时,通过所述供电自动切换电路单元和所述系统电源管理单元向所述非接电源控制单元和所述接触电源控制单元供电,通过所述供电自动切换电路单元、所述系统电源管理单元和所述供电隔离单元向所述主控单元和所述人机交互单元供电。The battery unit is specifically used to provide power to the contactless power supply control unit and the power supply control unit through the power supply automatic switching circuit unit and the system power management unit when the device is only connected to the host computer through the Apple interface unit. The contact power supply control unit supplies power to the main control unit and the human-computer interaction unit through the power supply automatic switching circuit unit, the system power management unit and the power supply isolation unit. 9.如权利要求2所述的设备,其特征在于,所述苹果接口模块包括苹果接口单元和苹果通讯单元;所述电池模块包括充电管理单元和电池单元;所述功能模块包括主控单元、非接电源控制单元、非接单元、接触电源控制单元、接触单元和人机交互单元;9. The device according to claim 2, wherein the apple interface module includes an apple interface unit and an apple communication unit; the battery module includes a charge management unit and a battery unit; the functional module includes a main control unit, Contactless power control unit, contactless unit, contact power control unit, contact unit and human-computer interaction unit; 所述USB接口模块,与所述充电管理单元、所述电源管理模块和所述主控单元相连,用于与上位机连接,从上位机获取电能,通过所述充电管理单元对所述电池单元充电,通过所述电源管理模块向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,还用于与所述主控单元和上位机进行数据通讯;The USB interface module is connected with the charging management unit, the power management module and the main control unit, and is used for connecting with a host computer, obtaining electric energy from the host computer, and charging the battery unit through the charging management unit Charging, supplying power to the main control unit, the contactless power supply control unit, the contact power supply control unit and the human-computer interaction unit through the power management module, and also used to communicate with the main control unit and the upper computer data communication; 所述苹果接口单元,与所述苹果通讯单元和所述电源管理模块相连,用于与上位机连接,从上位机获取电能,通过所述电源管理模块向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,还用于与所述苹果通讯单元和上位机进行数据通讯;The apple interface unit is connected with the apple communication unit and the power management module, and is used to connect with the upper computer, obtain electric energy from the upper computer, and send electricity to the main control unit and the contactless through the power management module. The power supply control unit, the contact power control unit and the human-computer interaction unit supply power, and are also used for data communication with the apple communication unit and the host computer; 所述苹果通讯单元,与所述苹果接口单元和所述主控单元相连,用于与所述苹果接口单元和所述主控单元进行数据通讯;The apple communication unit is connected with the apple interface unit and the main control unit, and is used for data communication with the apple interface unit and the main control unit; 所述充电管理单元,与所述USB接口模块和所述电池单元相连,用于当所述电池单元电能未蓄满时,从所述USB接口模块获取电能传递给所述电池单元,当所述电池单元电能蓄满时,停止从所述USB接口模块获取电能;The charging management unit is connected to the USB interface module and the battery unit, and is used to obtain power from the USB interface module and transmit it to the battery unit when the battery unit is not fully charged. When the electric energy of the battery unit is fully stored, stop obtaining electric energy from the USB interface module; 所述电池单元,与所述充电管理单元和所述电源管理模块相连,用于在所述设备仅通过所述苹果接口单元与上位机连接,且所述设备功耗较大时,通过所述电源管理模块向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电;The battery unit is connected to the charging management unit and the power management module, and is used to connect the device to the host computer only through the Apple interface unit, and the device consumes a large amount of power, The power management module supplies power to the main control unit, the contactless power control unit, the contact power control unit and the human-computer interaction unit; 所述电源管理模块,与所述USB接口模块、所述苹果接口单元、所述电池单元、所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元相连,用于当所述USB接口模块与上位机连接时,控制由所述USB接口模块用从上位机获取到的电能为所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,当所述设备仅通过所述苹果接口单元与上位机连接时,控制由所述苹果接口单元用从上位机获取到的电能为所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,以及当接收到所述主控单元发送的控制信号时,控制所述电池单元用储存的电能与所述苹果接口单元共同为所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电;The power management module interacts with the USB interface module, the Apple interface unit, the battery unit, the main control unit, the contactless power control unit, the contact power control unit, and the human-computer interaction The unit is connected, and is used to control the power obtained from the host computer by the USB interface module to provide the main control unit, the contactless power supply control unit, and the contactor when the USB interface module is connected to the host computer. The power supply control unit and the human-computer interaction unit supply power. When the device is only connected to the host computer through the apple interface unit, the apple interface unit is controlled to use the electric energy obtained from the host computer to power the main control unit. , the contactless power supply control unit, the contact power supply control unit and the human-computer interaction unit supply power, and when receiving the control signal sent by the main control unit, control the battery unit to use the stored electric energy with the The apple interface unit supplies power for the main control unit, the contactless power control unit, the contact power control unit and the human-computer interaction unit; 所述主控单元,与所述USB接口模块、所述苹果通讯单元、所述电源管理模块、所述非接电源控制单元、非接单元、接触电源控制单元、接触单元和人机交互单元相连,用于向所述非接电源控制单元和所述接触电源控制单元发送控制信号,与所述非接单元、所述接触单元、所述USB接口模块和所述苹果通讯单元进行数据通讯,以及当所述设备仅通过所述苹果接口单元与上位机连接,且功耗较高时向所述电源管理模块发送控制信号;The main control unit is connected with the USB interface module, the Apple communication unit, the power management module, the contactless power control unit, the contactless unit, the contact power control unit, the contact unit and the human-computer interaction unit , for sending control signals to the contactless power supply control unit and the contact power supply control unit, and performing data communication with the contactless unit, the contact unit, the USB interface module and the Apple communication unit, and When the device is only connected to the host computer through the Apple interface unit and the power consumption is high, send a control signal to the power management module; 所述非接电源控制单元,与所述电源管理模块、所述主控单元和所述非接单元相连,用于接收所述主控单元发送的控制信号,控制所述非接单元的上电和下电;The contactless power supply control unit is connected with the power management module, the main control unit and the contactless unit, and is used to receive the control signal sent by the main control unit and control the power-on of the contactless unit and power off; 所述非接单元,与所述非接电源控制单元和所述主控单元相连,用于与所述主控单元和非接触卡进行数据通讯;The contactless unit is connected to the contactless power supply control unit and the main control unit, and is used for data communication with the main control unit and the contactless card; 所述接触电源控制单元,与所述电源管理模块、所述主控单元和所述接触单元相连,用于接收所述主控单元发送的控制信号,控制所述接触单元的上电和下电;The contact power control unit is connected with the power management module, the main control unit and the contact unit, and is used to receive the control signal sent by the main control unit, and control the power-on and power-off of the contact unit ; 所述接触单元,与所述接触电源控制单元和所述主控单元相连,用于与所述主控单元和接触卡进行数据通讯;The contact unit is connected with the contact power control unit and the main control unit, and is used for data communication with the main control unit and the contact card; 所述人机交互单元,与所述电源管理模块和所述主控单元相连,用于进行人机交互。The human-computer interaction unit is connected with the power management module and the main control unit for human-computer interaction. 10.如权利要求9所述的设备,其特征在于,所述电源管理模块包括供电自动切换电路单元、电压隔离单元、系统电源管理单元、供电隔离单元和电池供电控制单元;10. The device according to claim 9, wherein the power management module comprises a power supply automatic switching circuit unit, a voltage isolation unit, a system power management unit, a power supply isolation unit and a battery power supply control unit; 所述供电自动切换电路单元,与所述USB接口模块、所述系统电源管理单元和所述电池供电控制单元相连,用于当所述USB接口模块与上位机连接时,仅允许来自所述USB接口模块的电流通过,当所述USB接口模块未与所述上位机连接时,允许来自所述电池供电控制单元的电流通过;The power supply automatic switching circuit unit is connected to the USB interface module, the system power management unit and the battery power supply control unit, and is used to allow only The current of the interface module passes through, and when the USB interface module is not connected with the host computer, the current from the battery-powered control unit is allowed to pass; 所述电压隔离单元,与所述USB接口模块、所述苹果接口单元和所述系统电源管理单元相连,用于将所述苹果接口单元发送的电信号发送给所述系统电源管理单元,使能所述系统电源管理单元,以及阻隔来自所述USB接口模块的电压进入所述苹果接口单元;The voltage isolation unit is connected to the USB interface module, the Apple interface unit and the system power management unit, and is used to send the electrical signal sent by the Apple interface unit to the system power management unit, enabling The system power management unit, and blocking the voltage from the USB interface module from entering the apple interface unit; 所述系统电源管理单元,与所述USB接口模块、所述供电自动切换电路单元、所述电压隔离单元和所述供电隔离单元相连,用于在被使能时,对输入的电压进行转换得到预设电压,输出预设电压,通过所述供电隔离单元向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电;The system power management unit is connected to the USB interface module, the power supply automatic switching circuit unit, the voltage isolation unit and the power supply isolation unit, and is used to convert the input voltage to obtain A preset voltage, outputting a preset voltage, and supplying power to the main control unit, the contactless power supply control unit, the contact power supply control unit and the human-computer interaction unit through the power supply isolation unit; 所述供电隔离单元,与所述苹果接口单元、所述系统电源管理单元、所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元相连,用于当所述苹果接口单元与上位机连接时,用来自所述苹果接口单元的电流为所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,以及当所述USB接口模块与上位机连接时,用来自所述系统电源管理单元的电流为所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,和阻隔来自所述系统电源管理单元的电流流入所述苹果接口单元;The power supply isolation unit is connected with the apple interface unit, the system power management unit, the main control unit, the contactless power control unit, the contact power control unit and the human-computer interaction unit, When the apple interface unit is connected with the upper computer, the current from the apple interface unit is used to provide the power for the main control unit, the contactless power supply control unit, the contact power supply control unit and the human-computer interaction unit power supply, and when the USB interface module is connected with the upper computer, use the current from the system power management unit to provide the main control unit, the contactless power control unit, the contact power control unit and the human The computer interaction unit supplies power, and blocks the current from the system power management unit from flowing into the apple interface unit; 所述电池供电控制单元,与所述电池单元、所述供电自动切换电路单元和所述主控单元相连,用于在接收到所述主控单元发送的控制信号后允许来自所述电池单元的电流通过。The battery power supply control unit is connected with the battery unit, the power supply automatic switching circuit unit and the main control unit, and is used to allow the power supply from the battery unit after receiving the control signal sent by the main control unit current passes through. 11.如权利要求10所述的设备,其特征在于,11. The apparatus of claim 10, wherein 所述USB接口模块,具体用于与上位机连接,从上位机获取电能,通过上述充电管理单元对所述电池单元充电,向所述系统电源管理单元发送电信号,使能所述系统电源管理单元,通过所述供电自动切换电路单元、所述系统电源管理单元和所述供电隔离单元向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,还用于与所述主控单元和上位机进行数据通讯;The USB interface module is specifically used to connect with the host computer, obtain electric energy from the host computer, charge the battery unit through the charging management unit, send an electrical signal to the system power management unit, and enable the system power management unit, through the power supply automatic switching circuit unit, the system power management unit and the power supply isolation unit to the main control unit, the contactless power supply control unit, the contact power supply control unit and the human-computer interaction The unit supplies power, and is also used for data communication with the main control unit and the host computer; 所述苹果接口单元,具体用于与上位机连接,从上位机获取电能,通过所述电压隔离单元向所述系统电源管理单元发送电信号,使能所述系统电源管理单元,通过所述供电隔离单元向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电,还用于与所述苹果通讯单元和上位机进行数据通讯;The apple interface unit is specifically used to connect with the host computer, obtain electric energy from the host computer, send an electrical signal to the system power management unit through the voltage isolation unit, enable the system power management unit, and pass the power supply The isolation unit supplies power to the main control unit, the contactless power supply control unit, the contact power supply control unit and the human-computer interaction unit, and is also used for data communication with the apple communication unit and the upper computer; 所述电池单元,具体用于在所述设备仅通过所述苹果接口单元与上位机连接,且所述设备功耗较大时,通过所述电池供电控制单元、所述供电自动切换电路单元、所述系统电源管理单元和所述供电隔离单元向所述主控单元、所述非接电源控制单元、所述接触电源控制单元和所述人机交互单元供电。The battery unit is specifically used to supply power through the battery power control unit, the power supply automatic switching circuit unit, The system power management unit and the power supply isolation unit supply power to the main control unit, the contactless power control unit, the contact power control unit and the human-computer interaction unit. 12.如权利要求5、7或10所述的设备,其特征在于,所述预设电压为3.3V电压。12. The device according to claim 5, 7 or 10, wherein the preset voltage is 3.3V. 13.如权利要求3或9所述的设备,其特征在于,所述人机交互单元包括蜂鸣器和/或显示屏和/或LED和/或键盘。13. The device according to claim 3 or 9, wherein the human-computer interaction unit comprises a buzzer and/or a display screen and/or an LED and/or a keyboard. 14.一种如权利要求1所述的设备的工作方法,其特征在于,包括:所述设备上电初始化后,设备的功能模块执行以下步骤:14. A working method of the device according to claim 1, characterized in that it comprises: after the device is powered on and initialized, the functional modules of the device perform the following steps: 步骤A1、打开USB接入中断和苹果接入中断;Step A1, open USB access interrupt and Apple access interrupt; 当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则打开USB数据接收中断,若为低电压则关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则打开苹果数据接收中断,若为低电压则关闭所述苹果数据接收中断;When the USB interface is inserted or pulled out, the USB access interruption is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB data reception interruption is opened, and if it is a low voltage, the USB data reception interruption is closed; When the apple interface is inserted or pulled out, the apple access interruption is triggered, and the power supply voltage of the apple interface is checked. If it is high voltage, the apple data reception interruption is opened, and if it is low voltage, the apple data reception interruption is closed; 当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set; 步骤A2、检查所述USB接收标志是否被置位,是则复位所述USB接收标志,置位USB标志,执行步骤A4,否则执行步骤A3;Step A2, check whether the USB receiving flag is set, if so, reset the USB receiving flag, set the USB flag, and execute step A4, otherwise execute step A3; 步骤A3、检查所述苹果接收标志是否被置位,是则复位所述苹果接收标志,置位苹果标志,执行步骤A4,否则返回步骤A2;Step A3, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step A4, otherwise return to step A2; 步骤A4、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤A5,否则将提示无卡的信息作为返回数据,执行步骤A5;Step A4. Determine whether there is a card connected to the device. If yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step A5. Otherwise, the message indicating that there is no card is used as Return the data and execute step A5; 步骤A5、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤A2;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤A2。Step A5, check the USB sign and the Apple sign, if the USB sign is set, return the return data to the host computer through the USB interface, reset the USB sign, and return to step A2; if the Apple sign is set bit, then return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step A2. 15.如权利要求14所述的方法,其特征在于,所述步骤A1中,还包括打开定时读卡中断,开启定时器;15. The method according to claim 14, characterized in that, in the step A1, it also includes opening a timing card reading interrupt and opening a timer; 每当所述定时器达到预设值时,所述定时读卡中断被触发,检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,若未查询到则设置有卡标识为第三预设值;Whenever the timer reaches a preset value, the timing card reading interrupt is triggered to detect whether there is a contact card connected to the device, if yes, the card identification is set as the first preset value, otherwise, it is inquired whether there is a contact card with The non-contact card for which the device establishes a connection, if found, the card identification is set as the second preset value, and if it is not found, the card identification is set as the third preset value; 所述步骤A4具体包括:检查所述有卡标识,若所述有卡标识为第一预设值,则将上位机发送的数据发送给与设备建立连接的接触卡片,接收接触卡片的应答,将接触卡片的应答作为返回数据,执行步骤A5,若所述有卡标识为第二预设值,则将上位机发送的数据发送给与设备建立连接的非接触卡片,接收非接触卡片的应答,将非接触卡片的应答作为返回数据,执行步骤A5,若所述有卡标识为第三预设值,将提示无卡的信息作为返回数据,执行步骤A5。The step A4 specifically includes: checking the card identification, if the card identification is the first preset value, sending the data sent by the host computer to the contact card that establishes a connection with the device, and receiving the response of the contact card, Use the response of the contact card as the return data, and execute step A5. If the card presence flag is the second preset value, send the data sent by the host computer to the contactless card that establishes a connection with the device, and receive the response of the contactless card , using the response of the non-contact card as the return data, execute step A5, and if the card presence flag is the third preset value, use the information indicating that there is no card as the return data, and execute step A5. 16.如权利要求15所述的方法,其特征在于,16. The method of claim 15, wherein, 所述USB接入中断被触发后:当USB接口的供电电压为高电压时,还包括对非接单元和接触单元上电;当USB接口的供电电压为低电压时,还包括对非接单元和接触单元下电;After the USB access interrupt is triggered: when the power supply voltage of the USB interface is a high voltage, it also includes powering on the contactless unit and the contact unit; when the power supply voltage of the USB interface is a low voltage, it also includes powering on the contactless unit Power off the contact unit; 所述苹果接入中断被触发后:当苹果接口的供电电压为高电压时,还包括置位定时上下电标志;当苹果接口的供电电压为低电压时,还包括复位定时上下电标志;After the apple access interruption is triggered: when the power supply voltage of the apple interface is a high voltage, it also includes a reset timing power-on and power-on flag; when the power supply voltage of the apple interface is a low voltage, it also includes a reset timing power-on and power-on flag; 所述定时读卡中断被触发后:检测是否有与设备建立连接的接触卡片之前,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元上电;当未查询到与设备建立连接的非接触卡片时,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元下电。After the timing card reading interrupt is triggered: before detecting whether there is a contact card connected to the device, it also includes checking the timing power-on and power-on flags, and when the timing power-on and power-off flags are set, the contact unit and the non-contact Powering on the unit; when no contactless card connected with the device is found, checking the timing power-on and power-on flag, and powering off the contact unit and the non-contact unit when the timing power-on and power-on flag is set. 17.如权利要求16所述的方法,其特征在于,所述USB接入中断被触发后:当USB接口的供电电压为高电压时,还包括置位USB接入标志;当USB接口的供电电压为低电压时,还包括复位所述USB接入标志;17. The method according to claim 16, wherein after the USB access interrupt is triggered: when the power supply voltage of the USB interface is a high voltage, it also includes setting a USB access flag; when the power supply of the USB interface When the voltage is a low voltage, it also includes resetting the USB access flag; 所述定时读卡中断被触发后:当所述定时上下电标志被置位时,对接触单元和非接触单元上电之前,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元开始供电;当所述定时上下电标志被置位时,对接触单元和非接触单元下电之后,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元停止供电。After the timing card reading interrupt is triggered: when the timing power-on and power-on flag is set, before powering on the contact unit and the non-contact unit, it also includes checking the USB access flag, and when the USB access When the flag is not set, the control battery unit starts to supply power; when the timing power-on and power-off flag is set, after the contact unit and the non-contact unit are powered off, it also includes checking the USB access flag, and when the When the USB access flag is not set, the battery unit is controlled to stop supplying power. 18.如权利要求15所述的方法,其特征在于,18. The method of claim 15, wherein, 所述步骤A1中,还包括复位查询余额标志;In the step A1, it also includes resetting the query balance flag; 所述步骤A3中,当所述苹果接收标志未被置位时,还包括:检查查询余额标志,以及当所述查询余额标志未被置位时,判断是否有与设备建立连接的卡片,是则向卡片发送查询余额指令,接收并输出卡片返回的余额信息,置位所述查询余额标志,否则返回步骤A2;In the step A3, when the Apple receiving flag is not set, it also includes: checking the query balance flag, and when the query balance flag is not set, judging whether there is a card connected to the device, yes Then send a query balance command to the card, receive and output the balance information returned by the card, set the query balance flag, otherwise return to step A2; 所述定时读卡中断被触发后,当未查询到与设备建立连接的非接触卡片时,还包括,复位所述查询余额标志。After the timing card reading interrupt is triggered, when no contactless card connected with the device is found, the method further includes resetting the query balance flag. 19.一种如权利要求1所述的设备的工作方法,其特征在于,所述设备上电初始化后,所述功能模块执行以下步骤:19. A working method of the device according to claim 1, characterized in that, after the device is powered on and initialized, the functional module performs the following steps: 步骤B1、打开USB接入中断和苹果接入中断;Step B1, open USB access interrupt and Apple access interrupt; 当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则打开USB数据接收中断,若为低电压则关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则打开苹果数据接收中断,若为低电压则关闭所述苹果数据接收中断;When the USB interface is inserted or pulled out, the USB access interruption is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB data reception interruption is opened, and if it is a low voltage, the USB data reception interruption is closed; When the apple interface is inserted or pulled out, the apple access interruption is triggered, and the power supply voltage of the apple interface is checked. If it is high voltage, the apple data reception interruption is opened, and if it is low voltage, the apple data reception interruption is closed; 当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set; 步骤B2、检查所述苹果接收标志是否被置位,是则复位所述苹果接收标志,置位苹果标志,执行步骤B4,否则执行步骤B3;Step B2, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step B4, otherwise execute step B3; 步骤B3、检查所述USB接收标志是否被置位,是则复位所述USB接收标志,置位USB标志,执行步骤B4,否则返回步骤B2;Step B3, check whether the USB reception flag is set, if yes, reset the USB reception flag, set the USB flag, and execute step B4, otherwise return to step B2; 步骤B4、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤B5,否则将提示无卡的信息作为返回数据,执行步骤B5;Step B4, determine whether there is a card connected to the device, if yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step B5, otherwise, the message indicating that there is no card is used as Return data, execute step B5; 步骤B5、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤B2;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤B2。Step B5, check the USB sign and the Apple sign, if the USB sign is set, return data to the host computer through the USB interface, reset the USB sign, and return to step B2; if the Apple sign is set bit, then return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step B2. 20.如权利要求19所述的方法,其特征在于,所述步骤B1中,还包括打开定时读卡中断,开启定时器;20. The method according to claim 19, characterized in that, in the step B1, it also includes opening a timing card reading interrupt and starting a timer; 每当所述定时器达到预设值时,所述定时读卡中断被触发,检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,若未查询到则设置有卡标识为第三预设值;Whenever the timer reaches a preset value, the timing card reading interrupt is triggered to detect whether there is a contact card connected to the device, if yes, the card identification is set as the first preset value, otherwise, it is inquired whether there is a contact card with The non-contact card for which the device establishes a connection, if found, the card identification is set as the second preset value, and if it is not found, the card identification is set as the third preset value; 所述步骤B4具体包括:检查所述有卡标识,若所述有卡标识为第一预设值,则将上位机发送的数据发送给与设备建立连接的接触卡片,接收接触卡片的应答,将接触卡片的应答作为返回数据,执行步骤B5,若所述有卡标识为第二预设值,则将上位机发送的数据发送给与设备建立连接的非接触卡,接收非接触卡片的应答,将非接触卡片的应答作为返回数据,执行步骤B5,若所述有卡标识为第三预设值,将提示无卡的信息作为返回数据,执行步骤B5。The step B4 specifically includes: checking the card identification, if the card identification is the first preset value, sending the data sent by the host computer to the contact card connected with the device, receiving the response of the contact card, The response of the contact card is used as the return data, and step B5 is executed. If the card has the second preset value, the data sent by the host computer is sent to the contactless card connected with the device, and the response of the contactless card is received , taking the response of the non-contact card as the return data, and performing step B5, and if the card presence flag is the third preset value, taking the information indicating that there is no card as the return data, and performing step B5. 21.如权利要求20所述的方法,其特征在于,21. The method of claim 20, wherein, 所述USB接入中断被触发后:当USB接口的供电电压为高电压时,还包括对非接单元和接触单元上电;当USB接口的供电电压为低电压时,还包括对非接单元和接触单元下电;After the USB access interrupt is triggered: when the power supply voltage of the USB interface is a high voltage, it also includes powering on the contactless unit and the contact unit; when the power supply voltage of the USB interface is a low voltage, it also includes powering on the contactless unit Power off the contact unit; 所述苹果接入中断被触发后:当苹果接口的供电电压为高电压时,还包括置位定时上下电标志;当苹果接口的供电电压为低电压时,还包括复位定时上下电标志;After the apple access interruption is triggered: when the power supply voltage of the apple interface is a high voltage, it also includes a set timing power-on and power-on flag; when the power supply voltage of the apple interface is a low voltage, it also includes a reset timing power-on and power-on flag; 所述定时读卡中断被触发后:检测是否有与设备建立连接的接触卡片之前,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元上电;当未查询到与设备建立连接的非接触卡片时,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元下电。After the timing card reading interrupt is triggered: before detecting whether there is a contact card connected to the device, it also includes checking the timing power-on and power-on flags, and when the timing power-on and power-off flags are set, the contact unit and the non-contact Powering on the unit; when no contactless card connected with the device is found, checking the timing power-on and power-on flag, and powering off the contact unit and the non-contact unit when the timing power-on and power-on flag is set. 22.如权利要求21所述的方法,其特征在于,所述USB接入中断被触发后:当USB接口的供电电压为高电压时,还包括置位USB接入标志;当USB接口的供电电压为低电压时,还包括复位所述USB接入标志;22. The method according to claim 21, wherein after the USB access interrupt is triggered: when the power supply voltage of the USB interface is a high voltage, it also includes setting a USB access flag; when the power supply of the USB interface When the voltage is a low voltage, it also includes resetting the USB access flag; 所述定时读卡中断被触发后:当所述定时上下电标志被置位时,对接触单元和非接触单元上电之前,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元开始供电;当所述定时上下电标志被置位时,对接触单元和非接触单元下电之后,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元停止供电。After the timing card reading interrupt is triggered: when the timing power-on and power-on flag is set, before powering on the contact unit and the non-contact unit, it also includes checking the USB access flag, and when the USB access When the flag is not set, the control battery unit starts to supply power; when the timing power-on and power-off flag is set, after the contact unit and the non-contact unit are powered off, it also includes checking the USB access flag, and when the When the USB access flag is not set, the battery unit is controlled to stop supplying power. 23.如权利要求20所述的方法,其特征在于,23. The method of claim 20, wherein, 所述步骤B1中,还包括复位查询余额标志;In the step B1, it also includes resetting the query balance flag; 所述步骤B3中,当所述USB接收标志未被置位时,还包括:检查查询余额标志,以及当所述查询余额标志未被置位时,判断是否有与设备建立连接的卡片,是则向卡片发送查询余额指令,接收并输出卡片返回的余额信息,置位所述查询余额标志,否则返回步骤B2;In the step B3, when the USB receiving flag is not set, it also includes: checking the query balance flag, and when the query balance flag is not set, judging whether there is a card connected to the device, yes Then send a query balance command to the card, receive and output the balance information returned by the card, set the query balance flag, otherwise return to step B2; 所述定时读卡中断被触发后,当未查询到与设备建立连接的非接触卡片时,还包括,复位所述查询余额标志。After the timing card reading interrupt is triggered, when no contactless card connected with the device is found, the method further includes resetting the query balance flag. 24.一种如权利要求1所述的设备的工作方法,其特征在于,所述设备上电初始化后,所述功能模块执行以下步骤:24. A working method of the device according to claim 1, characterized in that, after the device is powered on and initialized, the functional module performs the following steps: 步骤C1、打开USB接入中断和苹果接入中断;Step C1, open USB access interrupt and Apple access interrupt; 当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则置位USB接入标志,打开USB数据接收中断,若为低电压则复位所述USB接入标志,关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则置位苹果接入标志,打开苹果数据接收中断,若为低电压则复位所述苹果接入标志,关闭所述苹果数据接收中断;When the USB interface is plugged in or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB access flag is set, and the USB data receiving interrupt is turned on. If it is a low voltage, the interrupt is reset. Said USB access sign, closes said USB data receiving interruption; When the apple interface is plugged in or pulled out, said apple access interruption is triggered, checks the power supply voltage of the apple interface, if it is high voltage, then sets the apple access sign , open the apple data receiving interrupt, if it is low voltage, reset the apple access sign, and close the apple data receiving interrupt; 当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set; 步骤C2、检查所述USB接入标志是否被置位,是则执行步骤C3,否则执行步骤C4;Step C2, check whether the USB access flag is set, if yes, execute step C3, otherwise execute step C4; 步骤C3、检查所述USB接收标志是否被置位,是则复位所述USB接收标志,置位USB标志,执行步骤C6,否则返回步骤C2;Step C3, check whether the USB receiving flag is set, if yes, reset the USB receiving flag, set the USB flag, execute step C6, otherwise return to step C2; 步骤C4、检查所述苹果接入标志是否被置位,是则执行步骤C5,否则返回步骤C2;Step C4, check whether the Apple access flag is set, if yes, execute step C5, otherwise return to step C2; 步骤C5、检查所述苹果接收标志是否被置位,是则复位所述苹果接收标志,置位苹果标志,执行步骤C6,否则返回步骤C4;Step C5, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step C6, otherwise return to step C4; 步骤C6、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤C7,否则将提示无卡的信息作为返回数据,执行步骤C7;Step C6, determine whether there is a card connected to the device, if yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step C7, otherwise, the message indicating that there is no card is used as return data, execute step C7; 步骤C7、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤C2;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤C4。Step C7, check the USB sign and the Apple sign, if the USB sign is set, return the return data to the host computer through the USB interface, reset the USB sign, and return to step C2; if the Apple sign is set bit, then return the returned data to the host computer through the apple interface, reset the apple sign, and return to step C4. 25.如权利要求24所述的方法,其特征在于,所述步骤C1中,还包括打开定时读卡中断,开启定时器;25. The method according to claim 24, characterized in that, in the step C1, further comprising enabling a timing card reading interrupt and enabling a timer; 每当所述定时器达到预设值时,所述定时读卡中断被触发,检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,若未查询到则设置有卡标识为第三预设值;Whenever the timer reaches a preset value, the timing card reading interrupt is triggered to detect whether there is a contact card connected to the device, if yes, the card identification is set as the first preset value, otherwise, it is inquired whether there is a contact card with The non-contact card for which the device establishes a connection, if found, the card identification is set as the second preset value, and if it is not found, the card identification is set as the third preset value; 所述步骤C6具体包括:检查所述有卡标识,若所述有卡标识为第一预设值,则将上位机发送的数据发送给与设备建立连接的接触卡片,接收接触卡片的应答,将接触卡片的应答作为返回数据,执行步骤C7,若所述有卡标识为第二预设值,则将上位机发送的数据发送给与设备建立连接的非接触卡,接收非接触卡片的应答,将非接触卡片的应答作为返回数据,执行步骤C7,若所述有卡标识为第三预设值,将提示无卡的信息作为返回数据,执行步骤C7。The step C6 specifically includes: checking the card identification, if the card identification is the first preset value, sending the data sent by the host computer to the contact card connected with the device, receiving the response of the contact card, The response of the contact card is used as the return data, and step C7 is executed. If the card is identified as the second preset value, the data sent by the host computer is sent to the contactless card connected with the device, and the response of the contactless card is received. , using the response of the non-contact card as the return data, execute step C7, and if the card presence flag is the third preset value, use the information indicating that there is no card as the return data, and execute step C7. 26.如权利要求25所述的方法,其特征在于,26. The method of claim 25, wherein, 所述USB接入中断被触发后:当USB接口的供电电压为高电压时,还包括对非接单元和接触单元上电;当USB接口的供电电压为低电压时,还包括对非接单元和接触单元下电;After the USB access interrupt is triggered: when the power supply voltage of the USB interface is a high voltage, it also includes powering on the contactless unit and the contact unit; when the power supply voltage of the USB interface is a low voltage, it also includes powering on the contactless unit Power off the contact unit; 所述苹果接入中断被触发后:当苹果接口的供电电压为高电压时,还包括置位定时上下电标志;当苹果接口的供电电压为低电压时,还包括复位定时上下电标志;After the apple access interruption is triggered: when the power supply voltage of the apple interface is a high voltage, it also includes a set timing power-on and power-on flag; when the power supply voltage of the apple interface is a low voltage, it also includes a reset timing power-on and power-on flag; 所述定时读卡中断被触发后:检测是否有与设备建立连接的接触卡片之前,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元上电;当未查询到与设备建立连接的非接触卡片时,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元下电。After the timing card reading interrupt is triggered: before detecting whether there is a contact card connected to the device, it also includes checking the timing power-on and power-on flags, and when the timing power-on and power-off flags are set, the contact unit and the non-contact Powering on the unit; when no contactless card connected with the device is found, checking the timing power-on and power-on flag, and powering off the contact unit and the non-contact unit when the timing power-on and power-on flag is set. 27.如权利要求26所述的方法,其特征在于,所述定时读卡中断被触发后:当所述定时上下电标志被置位时,对接触单元和非接触单元上电之前,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元开始供电;当所述定时上下电标志被置位时,对接触单元和非接触单元下电之后,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元停止供电。27. The method according to claim 26, wherein after the timing card reading interrupt is triggered: when the timing power-on and power-on flag is set, before powering on the contact unit and the non-contact unit, further comprising: Check the USB access flag, and when the USB access flag is not set, the control battery unit starts to supply power; when the timing power-on and power-on flag is set, after the contact unit and the non-contact unit are powered off , further comprising checking the USB access flag, and when the USB access flag is not set, controlling the battery unit to stop supplying power. 28.如权利要求25所述的方法,其特征在于,28. The method of claim 25, wherein, 所述步骤C1中,还包括复位查询余额标志;In the step C1, it also includes resetting the query balance flag; 所述步骤C3中,当所述USB接收标志未被置位时,还包括:检查查询余额标志,以及当所述查询余额标志未被置位时,判断是否有与设备建立连接的卡片,是则向卡片发送查询余额指令,接收并输出卡片返回的余额信息,置位所述查询余额标志,否则返回步骤C2;In the step C3, when the USB receiving flag is not set, it also includes: checking the query balance flag, and when the query balance flag is not set, judging whether there is a card connected to the device, yes Then send a query balance command to the card, receive and output the balance information returned by the card, set the query balance flag, otherwise return to step C2; 所述步骤C5中,当所述苹果标志未被置位时,还包括:检查查询余额标志,以及当所述查询余额标志未被置位时,判断是否有与设备建立连接的卡片,是则向卡片发送查询余额指令,接收并输出卡片返回的余额信息,置位所述查询余额标志,否则返回步骤C4;In the step C5, when the Apple logo is not set, it also includes: checking the query balance flag, and when the query balance flag is not set, judging whether there is a card connected to the device, if so Send a query balance instruction to the card, receive and output the balance information returned by the card, set the query balance flag, otherwise return to step C4; 所述定时读卡中断被触发后,当未查询到与设备建立连接的非接触卡片时,还包括,复位所述查询余额标志。After the timing card reading interrupt is triggered, when no contactless card connected with the device is found, the method further includes resetting the query balance flag. 29.一种如权利要求1所述的设备的工作方法,其特征在于,所述设备上电初始化后,所述功能模块执行以下步骤:29. A working method of the device according to claim 1, characterized in that, after the device is powered on and initialized, the functional module performs the following steps: 步骤D1、打开USB接入中断和苹果接入中断;Step D1, open USB access interrupt and Apple access interrupt; 当USB接口插入或拔出时,所述USB接入中断被触发,检查USB接口的供电电压,若为高电压则置位USB接入标志,打开USB数据接收中断,若为低电压则复位所述USB接入标志,关闭所述USB数据接收中断;当苹果接口插入或拔出时,所述苹果接入中断被触发,检查苹果接口的供电电压,若为高电压则置位苹果接入标志,打开苹果数据接收中断,若为低电压则复位所述苹果接入标志,关闭所述苹果数据接收中断;When the USB interface is plugged in or pulled out, the USB access interrupt is triggered, and the power supply voltage of the USB interface is checked. If it is a high voltage, the USB access flag is set, and the USB data receiving interrupt is turned on. If it is a low voltage, the interrupt is reset. Said USB access sign, closes said USB data receiving interruption; When the apple interface is plugged in or pulled out, said apple access interruption is triggered, checks the power supply voltage of the apple interface, if it is high voltage, then sets the apple access sign , open the apple data receiving interrupt, if it is low voltage, reset the apple access sign, and close the apple data receiving interrupt; 当USB接口检测到上位机发送的数据时,所述USB数据接收中断被触发,接收上位机发送的数据,置位USB接收标志;当苹果接口接收到上位机发送的数据时,所述苹果数据接收中断被触发,接收上位机发送的数据,置位苹果接收标志;When the USB interface detects the data sent by the host computer, the USB data reception interrupt is triggered, receives the data sent by the host computer, and sets the USB receiving flag; when the apple interface receives the data sent by the host computer, the apple data The receiving interrupt is triggered, the data sent by the upper computer is received, and the Apple receiving flag is set; 步骤D2、检查所述苹果接入标志是否被置位,是则执行步骤D3,否则执行步骤D4;Step D2, check whether the apple access flag is set, if yes, execute step D3, otherwise execute step D4; 步骤D3、检查所述苹果接收标志是否被置位,是则复位苹果接收标志,置位苹果标志,执行步骤D6,否则返回步骤D2;Step D3, check whether the apple receiving flag is set, if so, reset the apple receiving flag, set the apple flag, execute step D6, otherwise return to step D2; 步骤D4、检查所述USB接入标志是否被置位,是则执行步骤D5,否则返回步骤D2;Step D4, check whether the USB access flag is set, if yes, execute step D5, otherwise return to step D2; 步骤D5、检查所述USB接收标志是否被置位,是则复位USB接收标志,置位USB标志,执行步骤D6,否则返回步骤D4;Step D5, check whether the USB receiving flag is set, if yes, reset the USB receiving flag, set the USB flag, execute step D6, otherwise return to step D4; 步骤D6、判断是否有与设备建立连接的卡片,是则将上位机发送的数据发送给卡片,接收卡片的应答,将卡片的应答作为返回数据,执行步骤D7,否则将提示无卡的信息作为返回数据,执行步骤D7;Step D6, determine whether there is a card connected to the device, if yes, send the data sent by the host computer to the card, receive the card’s response, use the card’s response as the returned data, and execute step D7, otherwise, the message indicating that there is no card is used as Return data, execute step D7; 步骤D7、检查所述USB标志和所述苹果标志,若所述USB标志置位,则将返回数据通过USB接口返回给上位机,复位所述USB标志,返回步骤D4;若所述苹果标志置位,则将返回数据通过苹果接口返回给上位机,复位所述苹果标志,返回步骤D2。Step D7, check the USB sign and the Apple sign, if the USB sign is set, return the return data to the host computer through the USB interface, reset the USB sign, and return to step D4; if the Apple sign is set bit, then return the returned data to the host computer through the Apple interface, reset the Apple logo, and return to step D2. 30.如权利要求29所述的方法,其特征在于,所述步骤D1中,还包括打开定时读卡中断,开启定时器;30. The method according to claim 29, characterized in that, in the step D1, further comprising enabling a timing card reading interrupt and enabling a timer; 每当所述定时器达到预设值时,所述定时读卡中断被触发,检测是否有与设备建立连接的接触卡片,是则设置有卡标识为第一预设值,否则查询是否有与设备建立连接的非接触卡片,若查询到则设置有卡标识为第二预设值,若未查询到则设置有卡标识为第三预设值;Whenever the timer reaches a preset value, the timing card reading interrupt is triggered to detect whether there is a contact card connected to the device, if yes, the card identification is set as the first preset value, otherwise, it is inquired whether there is a contact card with The non-contact card for which the device establishes a connection, if found, the card identification is set as the second preset value, and if it is not found, the card identification is set as the third preset value; 所述步骤D6具体包括:检查所述有卡标识,若所述有卡标识为第一预设值,则将上位机发送的数据发送给与设备建立连接的接触卡片,接收接触卡片的应答,将接触卡片的应答作为返回数据,执行步骤D7,若所述有卡标识为第二预设值,则将上位机发送的数据发送给与设备建立连接的非接触卡,接收非接触卡片的应答,将非接触卡片的应答作为返回数据,执行步骤D7,若所述有卡标识为第三预设值,将提示无卡的信息作为返回数据,执行步骤D7。The step D6 specifically includes: checking the card identification, if the card identification is the first preset value, sending the data sent by the host computer to the contact card that establishes a connection with the device, and receiving the response of the contact card, The response of the contact card is used as the return data, and step D7 is executed. If the card identification is the second preset value, the data sent by the host computer is sent to the non-contact card connected with the device, and the response of the non-contact card is received. , taking the response of the non-contact card as the return data, and performing step D7, and if the card presence flag is the third preset value, taking the information indicating that there is no card as the return data, and performing step D7. 31.如权利要求30所述的方法,其特征在于,31. The method of claim 30, wherein, 所述USB接入中断被触发后:当USB接口的供电电压为高电压时,还包括对非接单元和接触单元上电;当USB接口的供电电压为低电压时,还包括对非接单元和接触单元下电;After the USB access interrupt is triggered: when the power supply voltage of the USB interface is a high voltage, it also includes powering on the contactless unit and the contact unit; when the power supply voltage of the USB interface is a low voltage, it also includes powering on the contactless unit Power off the contact unit; 所述苹果接入中断被触发后:当苹果接口的供电电压为高电压时,还包括置位定时上下电标志;当苹果接口的供电电压为低电压时,还包括复位定时上下电标志;After the apple access interruption is triggered: when the power supply voltage of the apple interface is a high voltage, it also includes a set timing power-on and power-on flag; when the power supply voltage of the apple interface is a low voltage, it also includes a reset timing power-on and power-on flag; 所述定时读卡中断被触发后:检测是否有与设备建立连接的接触卡片之前,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元上电;当未查询到与设备建立连接的非接触卡片时,还包括检查所述定时上下电标志,以及当所述定时上下电标志被置位时对接触单元和非接触单元下电。After the timing card reading interrupt is triggered: before detecting whether there is a contact card connected to the device, it also includes checking the timing power-on and power-on flags, and when the timing power-on and power-off flags are set, the contact unit and the non-contact Powering on the unit; when no contactless card connected with the device is found, checking the timing power-on and power-on flag, and powering off the contact unit and the non-contact unit when the timing power-on and power-on flag is set. 32.如权利要求31所述的方法,其特征在于,所述定时读卡中断被触发后:当所述定时上下电标志被置位时,对接触单元和非接触单元上电之前,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元开始供电;当所述定时上下电标志被置位时,对接触单元和非接触单元下电之后,还包括检查所述USB接入标志,以及当所述USB接入标志未被置位时,控制电池单元停止供电。32. The method according to claim 31, wherein after the timing card reading interrupt is triggered: when the timing power-on and power-on flag is set, before powering on the contact unit and the non-contact unit, further comprising: Check the USB access flag, and when the USB access flag is not set, the control battery unit starts to supply power; when the timing power-on and power-on flag is set, after the contact unit and the non-contact unit are powered off , further comprising checking the USB access flag, and when the USB access flag is not set, controlling the battery unit to stop supplying power. 33.如权利要求30所述的方法,其特征在于,33. The method of claim 30, wherein, 所述步骤D1中,还包括复位查询余额标志;In the step D1, it also includes resetting the query balance flag; 所述步骤D3中,当所述苹果接收标志未被置位时,还包括:检查查询余额标志,以及当所述查询余额标志未被置位时,判断是否有与设备建立连接的卡片,是则向卡片发送查询余额指令,接收并输出卡片返回的余额信息,置位所述查询余额标志,否则返回步骤D2;In the step D3, when the Apple receiving flag is not set, it also includes: checking the query balance flag, and when the query balance flag is not set, judging whether there is a card connected to the device, yes Then send a query balance command to the card, receive and output the balance information returned by the card, set the query balance flag, otherwise return to step D2; 所述步骤D5中,当所述USB接收标志未被置位时,还包括:检查查询余额标志,以及当所述查询余额标志未被置位时,判断是否有与设备建立连接的卡片,是则向卡片发送查询余额指令,接收并输出卡片返回的余额信息,置位所述查询余额标志,否则返回步骤D4;In the step D5, when the USB receiving flag is not set, it also includes: checking the query balance flag, and when the query balance flag is not set, judging whether there is a card connected to the device, yes Then send a query balance instruction to the card, receive and output the balance information returned by the card, set the query balance flag, otherwise return to step D4; 所述定时读卡中断被触发后,当未查询到与设备建立连接的非接触卡片时,还包括,复位所述查询余额标志。After the timing card reading interrupt is triggered, when no contactless card connected with the device is found, the method further includes resetting the query balance flag.
CN201410584525.4A 2014-10-27 2014-10-27 Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment Active CN104317761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410584525.4A CN104317761B (en) 2014-10-27 2014-10-27 Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410584525.4A CN104317761B (en) 2014-10-27 2014-10-27 Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment

Publications (2)

Publication Number Publication Date
CN104317761A true CN104317761A (en) 2015-01-28
CN104317761B CN104317761B (en) 2017-05-10

Family

ID=52372996

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410584525.4A Active CN104317761B (en) 2014-10-27 2014-10-27 Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment

Country Status (1)

Country Link
CN (1) CN104317761B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106303822A (en) * 2015-06-25 2017-01-04 朗新科技股份有限公司 Mobile audio interface communication equipment
CN108021832A (en) * 2017-12-18 2018-05-11 宁波三星医疗电气股份有限公司 A kind of electric energy meter of compatible more card operations knows chucking method
CN112579500A (en) * 2020-12-08 2021-03-30 深圳市道通科技股份有限公司 Method and device for prompting anti-misplug USB interface and electronic equipment

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102043751A (en) * 2010-06-29 2011-05-04 北京飞天诚信科技有限公司 Method for identifying host operation system by using USB equipment
US20120078751A1 (en) * 2010-09-24 2012-03-29 Macphail William Mobile device point of sale transaction system
CN102819707A (en) * 2012-07-27 2012-12-12 郑州信大捷安信息技术股份有限公司 Second generation USB (Universal Serial Bus) key system for implementing safety pavement of mobile terminals
CN102831519A (en) * 2012-07-27 2012-12-19 郑州信大捷安信息技术股份有限公司 Security intelligent cryptosystem for Apple mobile devices and internet-banking transaction method thereof
CN202736055U (en) * 2012-07-27 2013-02-13 郑州信大捷安信息技术股份有限公司 Second-generation U shield system for realization of secure payment of mobile terminal
CN103106167A (en) * 2013-01-22 2013-05-15 矽力杰半导体技术(杭州)有限公司 Universal Serial Bus (USB) equipment and control method thereof
WO2014025416A1 (en) * 2012-08-10 2014-02-13 Apple Inc. Connector with gold-palladium plated contacts
US20140087789A1 (en) * 2012-09-27 2014-03-27 Siva G. Narendra Lightning connector accessory device
CN203573401U (en) * 2013-11-06 2014-04-30 飞天诚信科技股份有限公司 Payment terminal equipment
CN203659022U (en) * 2013-12-31 2014-06-18 上海普天邮通科技股份有限公司 Second generation resident identity card bluetooth reader based on IOS platform
WO2014135874A1 (en) * 2013-03-05 2014-09-12 Hugh Brogan Portable battery pack for a rechargeable electronic device

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102043751A (en) * 2010-06-29 2011-05-04 北京飞天诚信科技有限公司 Method for identifying host operation system by using USB equipment
US20120078751A1 (en) * 2010-09-24 2012-03-29 Macphail William Mobile device point of sale transaction system
CN102819707A (en) * 2012-07-27 2012-12-12 郑州信大捷安信息技术股份有限公司 Second generation USB (Universal Serial Bus) key system for implementing safety pavement of mobile terminals
CN102831519A (en) * 2012-07-27 2012-12-19 郑州信大捷安信息技术股份有限公司 Security intelligent cryptosystem for Apple mobile devices and internet-banking transaction method thereof
CN202736055U (en) * 2012-07-27 2013-02-13 郑州信大捷安信息技术股份有限公司 Second-generation U shield system for realization of secure payment of mobile terminal
WO2014025416A1 (en) * 2012-08-10 2014-02-13 Apple Inc. Connector with gold-palladium plated contacts
US20140087789A1 (en) * 2012-09-27 2014-03-27 Siva G. Narendra Lightning connector accessory device
CN103106167A (en) * 2013-01-22 2013-05-15 矽力杰半导体技术(杭州)有限公司 Universal Serial Bus (USB) equipment and control method thereof
WO2014135874A1 (en) * 2013-03-05 2014-09-12 Hugh Brogan Portable battery pack for a rechargeable electronic device
CN203573401U (en) * 2013-11-06 2014-04-30 飞天诚信科技股份有限公司 Payment terminal equipment
CN203659022U (en) * 2013-12-31 2014-06-18 上海普天邮通科技股份有限公司 Second generation resident identity card bluetooth reader based on IOS platform

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106303822A (en) * 2015-06-25 2017-01-04 朗新科技股份有限公司 Mobile audio interface communication equipment
CN106303822B (en) * 2015-06-25 2021-06-08 朗新科技集团股份有限公司 Mobile phone audio interface communication equipment
CN108021832A (en) * 2017-12-18 2018-05-11 宁波三星医疗电气股份有限公司 A kind of electric energy meter of compatible more card operations knows chucking method
CN112579500A (en) * 2020-12-08 2021-03-30 深圳市道通科技股份有限公司 Method and device for prompting anti-misplug USB interface and electronic equipment

Also Published As

Publication number Publication date
CN104317761B (en) 2017-05-10

Similar Documents

Publication Publication Date Title
CN103699201B (en) Multifunctional power-on circuit and Bluetooth product
CN106356925B (en) Mobile terminal, charging control device and charging control method thereof
CN101340652B (en) Electric power managing method for split type mobile terminal, managing apparatus and split type terminal
CN104716750B (en) A kind of low power consuming wireless power method and relevant apparatus, system
CN110797925A (en) Battery control system and method, electronic device
CN111313938A (en) Near Field Communication Tag and Its Control System
CN104505551B (en) A kind of charging circuit of charging method and wearable device
CN101159027A (en) Near field communication terminal power supply device and method
CN109217411B (en) Charging method and device and electronic equipment
CN104065124B (en) There is the mobile terminal of false battery functi on and the method for enable, forbidden energy vacation battery thereof
CN104348230A (en) Charging device and charging control method
CN106025727B (en) A kind of intelligent socket with speech identifying function
CN104317761B (en) Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment
CN104795866A (en) Power control method for visual cards
CN106921192A (en) Terminal and electricity sharing method
CN207251269U (en) A Single Output Port Multiple Output Voltage Adaptive Charger
JP2014036504A (en) Electronic apparatus, charge control method and charge control program
CN104346722B (en) A kind of Mobile payment terminal and its method of work for supporting bluetooth communication
CN201142684Y (en) Near field communication terminal power supply device
CN105429246B (en) A circuit and method for automatically disconnecting a terminal after it is fully charged
CN203260874U (en) Adapter of portable device
CN105896662A (en) Single-port mobile power control circuit and control method thereof
CN104734289A (en) A mobile power supply with remote control
CN209281474U (en) Mobile power source leasing system
CN103914120A (en) Power management method and power management system for external module of hand-held device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
OL01 Intention to license declared
OL01 Intention to license declared