The following diagram illustrates the life cycle of the mPress SDK from instantiation to destruction:
The mPress SDK requires that the following classes which have been implemented by the mobile application developer be passed to it during its instantiation by the mobile application:
and before any further calls to mPress SDK methods can be made the defaults that the mPress SDK needs to use must be set by calling the “initialize” method.
This is the implementation of the commsProvider interface in the mPressSDK as performed by the mobile application developer and provides the mechanism that the mPressSDK will use to actually communicate with the MPOS device. The reason for this design is to be able to use the same communications mechanism irrespective of whether the link between the application and the MPOS device is over a serial interface, WiFi, Ethernet or Bluetooth. When implementing the commsProvider is must be kept in mind that the reader has to be a non-blocking reader.
|string||String data type|
|boolean||Boolean data type having the value of either true or false|
|integer||Integer data type|
|array||An array of strings in JSON format e.g. [“05”,”22”] is an array of two values “05” and “”22”.|
|decimal||decimal numeric value including the decimal point|
This is the implementation of the callback interface in the mPressSDK as performed by the mobile application developer and will execute whenever the mPress SDK needs to inform the mobile application of any events that would be of interest to the mobile application.
The following will be the format of the JSON string data passed into the notify method of the callback class as implemented within the mobile application. The notify method is called by the mPress SDK whenever the mPress SDK needs to inform the mobile application of any events that may require rectification.
|Mobile application callback function Name / Value pairs|
Indicates whether the mPress SDK can successfully communicate with the mPress SDK device as well as whether the device is in a state that is able to process a transaction.
0 – Success1 – Failure, Look at the StatusDescription
Populated with a text description of the Status