Document title:simcom Smart Device Scan Head Interface description
version:1.01
Date:2014-02-13
Status:release
Document Control id:sim0005
Writer:Yunqi.miao
Open Scan with program code
Broadcast implementation, broadcast name: Android.intent.action.SIMSCAN
Example:
Context.sendbroadcast (New Intent ("Android.intent.action.SIMSCAN"));
Description
The scanning light lasts for up to 6 seconds when the scan is turned on via program broadcast, i.e. the laser light of the scanning head is automatically switched off after 6 seconds.
To turn off scanning through program code
Broadcast implementation, broadcast name: Android.intent.action.SIMSCAN
Example:
Context.sendbroadcast (New Intent ("Android.intent.action.SIMSCAN"));
Description
When scanning via program broadcast, the scanning lamp lasts for a maximum of 6 seconds, that is, the laser light of the scanning head will be automatically closed after 6 seconds, then the scanning head can be closed by the above broadcast in 6 seconds.
Get scan results from program code
Broadcast implementation, broadcast name is: Com.sim.action.SIMSCAN, broadcast parameters are: value, parameter type: String
Example:
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Mreceiver = new Broadcastreceiver () {
@Override
public void OnReceive (context context, Intent Intent) {
To allow other broadcast registrants to be unable to obtain broadcast information, * * * here must be * * *
This.abortbroadcast ();
Get scan results Information here
Final String Scanresult = Intent.getstringextra ("value");
Mtvscanresult.settext (Scanresult);
Mtvscanresult.invalidate ();
}
};
Mfilter = new Intentfilter ("Com.sim.action.SIMSCAN");
When the user gets the data themselves, the broadcast priority is tuned to the highest 1000,*** here must * * *
Mfilter.setpriority (intentfilter.system_high_priority);
}
@Override
protected void Onresume () {
Super.onresume ();
Register a broadcast to get scan results
This.registerreceiver (Mreceiver, Mfilter);
}
@Override
protected void OnPause () {
Log off the broadcast to get scan results
This.unregisterreceiver (Mreceiver);
Super.onpause ();
}
Note: When getting the scan results, it is important to focus on
1) When the program captures the broadcast, it needs to execute:
This.abortbroadcast ();
2) The broadcast receive priority needs to be adjusted to the highest level:
Mfilter.setpriority (intentfilter.system_high_priority);
Simcom Smart Device Scan Head interface description [go]