Beside the cmbSDK it is possible to communicate with MX-1000 and MX-1502 via Intents on Android devices. This page summarizes the different type of intents that can be used for interaction.
As MX Connect provides the connectivity between your Android device and MX mobile terminal, it is necessary that you install the latest MX Connect app on you device.
Introduction to Android intents and their usage is out of scope for this document.
The following broadcast intents can be used in apps to trigger some operation on mobile terminals via MXConnect.
Action String | Parameter (name: type) | Description |
---|---|---|
"com.cognex.mxconnect.action.START_SCANNING" | Starts scanning on mobile terminal. | |
"com.cognex.mxconnect.action.STOP_SCANNING" | Stops scanning on mobile terminal. | |
"com.cognex.mxconnect.query.DEVICE_TYPE" |
Queries the device type of mobile terminal. Returns "com.cognex.mxconnect.status.READER_NOT_AVAILABLE" if MX mobile terminal is not attached to the phone or it is sleeping. |
|
"com.cognex.mxconnect.query.BATTERY_CHARGE" | Queries the battery charge of mobile terminal. |
The following activity intents can be used in apps to trigger some operation on mobile terminals via MXConnect.
Action String | Parameter (name: type) | Description |
---|---|---|
"com.cognex.mxconnect.action.FIRMWARE_UPGRADE" |
uriString: String |
Device's firmware is going to be upgraded with the file that was passed as parameter in uriString. uriString: http/https:// or file:// address |
verbose: int |
Verbose parameter determines whether notifications should be shown during the process.
|
|
"com.cognex.mxconnect.action.CONFIG_UPLOAD" | uriString: String |
Device's configuration is going to be changed according to the file that was passed as parameter in uriString. uriString: http/https:// or file:// address |
verbose: int |
Verbose parameter determines whether notifications should be shown during the process.
|
MX Connect is sending the following intents as response for some action (e.g. information was requested, availability of the device has been changed,etc.)
Action String | Parameter (name: type) | Description |
---|---|---|
"com.cognex.mxconnect.status.READER_NOT_AVAILABLE" | Indicates that the reader device is not attached or disconnected. | |
"com.cognex.mxconnect.status.READER_AVAILABLE" | Indicates that the reader is connected and ready. | |
"com.cognex.mxconnect.status.READER_LOCKED" | Indicates that the reader device is exclusively used by an app. (e.g. QSA) | |
"com.cognex.mxconnect.action.MX_ATTACHED" | Indicates that an MX reader was attached. | |
"com.cognex.mxconnect.action.MX_DETACHED" | Indicates that an MX reader was detached. | |
"com.cognex.mxconnect.response.DEVICE_TYPE" | value: String | Response to request for device type intent. Type string is in the 'value' extra field. |
"com.cognex.mxconnect.response.BATTERY_CHARGE" | value: String | Response to request for battery status intent. Current charge in percents is in the 'value' extra field. |
"com.cognex.mxconnect.status.DOWNLOAD_PROGRESS" | status:int | Provides regular information about download progress during firmware upgrade or config upload. |
"com.cognex.mxconnect.response.DOWNLOAD_ERROR" | text: String | Provides information about the failure that occurred during downloading firmware/config file. |
"com.cognex.mxconnect.response.FILE_ERROR" | text: String | Provides information about the failure that occurred during opening firmware/config file. |
"com.cognex.mxconnect.status.FIRMWARE_UPGRADE_STARTED" | Indicates that MXConnect started the firmware upgrade operation on the device. | |
"com.cognex.mxconnect.status.FIRMWARE_UPGRADE_FAILED" | text: String | Provides information about the failure that occurred during firmware upgrade. |
"com.cognex.mxconnect.status.CONFIG_UPLOAD_STARTED" | Indicates that MXConnect started the config upload operation on the device. | |
"com.cognex.mxconnect.status.CONFIG_UPLOAD_FAILED" | text: String | Provides information about the failure that occurred during config upload. |
MX Connect is sending the following intent periodically to inform apps about MX mobile terminal's battery state.
Action String | Parameter (name: type) | Description |
---|---|---|
"com.cognex.mxconnect.status.BATTERY_CHARGE" | value: int |
Report the battery state of MX mobile terminal periodically (available from MX Connect 2.0.0). value: the battery charge state in percentage. |
Please check the following example:
private class BatteryChargeUpdatesReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("com.cognex.mxconnect.status.BATTERY_CHARGE".equals(action)) {
final int percent = intent.getIntExtra("value", 0);
// TODO
}
}
}
Read result is sent with "com.cognex.mxconnect.action.READ_RESULT_RECEIVED" action string.