The design of the mPress SDK is to be independent of the type of communications that are used between the mobile phone and the MPOS device. In most cases this communication would be over a bluetooth connection between the mobile phone and the MPOS device and control over this connection is NOT performed by the mPress SDK, but is expected to be performed by the application running on the mobile phone.
The developer of the mobile phone application is expected to establish and maintain the connection to the MPOS device on a communications level and to make this available to the mPress SDK so that the mPress SDK can communicate with the MPOS device.
Schematically this can be represented as follows where the green sections represent what the mobile application developer must implement.
The commsProvider is implemented by the mobile application developer and establishes and maintains the connection to the MPOS device and the mPress SDK makes use of this commsProvider in order to send and receive data to and from the device.
The mPress SDK makes available methods that the mobile phone application will utilise to collect the card details that are required in order to process a transaction and these methods use the commsProvider to communicate to the mPOS device. Although the mobile application developer implements the commsProvider, the mobile phone application never makes direct use of it, it only makes use of the commsProvider by calling a method of the mPress SDK which in turn makes use of the commsProvider.
The callback class implemented by the mobile application developer is used by the mPress SDK whenever an event happens on the MPOS device that the mobile application needs to know about. An example of this would be if the MPOS device notifies the mPress SDK that the battery is running low and that it needs to be charged. In this event the mPress SDK would execute the notify method of the callback class of the Mobile phone application which can then inform the user that the MPOS device's battery is running low and that it needs to be charged.