Framework
The vmc_framework
is the core component of the Marshall SDK, acting as the primary interface between your application and the vending machine controller (VMC). It handles all the essential operations, from initiating and managing sessions to processing transactions and communicating with various peripherals.
Get a framework instance
To begin using the vmc_framework
, you need to obtain its singleton instance. The Singleton pattern ensures that only one framework instance is active, providing a consistent and controlled interaction point for all SDK operations.
To initiate the framework instance, you can use the following command:
vmc_framework m_vmc = vmc_framework.getInstance();
vmc_framework vmc_instance = vmc_framework.getInstance();
Where:
vmc_framework
: Main class of the Marshall SDK that manages the interaction with the vending machine controller (VMC).m_vmc
orvmc_instance
: Variable that holds the instance of thevmc_framework
.getInstance()
: This method returns the singleton instance of thevmc_framework
. The Singleton pattern ensures that only one framework instance runs in the application.
API Methods
The primary methods to control the lifecycle of the SDK are:
start()
: Initializes and starts the SDK thread, enabling the framework to handle vending operations and device communication.stop()
: Terminates the SDK thread, halting all operations and safely shutting down the framework
Framework configuration structure
The vmc_configuration
class is used to set up various parameters and flags that control the behaviour of the VMC. Proper configuration is crucial for ensuring smooth operation and compatibility with different peripherals. See the following code examples:
public class vmc_configuration
public Object port_vpos;
public int port_vpos_baud;
public String serial;
public String model;
public String sw_ver;
public int machine_type;
boolean explicit_vend_success;
public boolean price_not_final_support;
public boolean mag_card_approved_by_vmc_support;
public boolean mifare_approved_by_vmc_support;
public boolean debug;
public int dump_packets_level;
public boolean reader_always_on;
public boolean multi_session_support;
public boolean multi_vend_support;
public boolean always_idle;
public
public class vmc_configuration
public string port_vpos;
public int port_vpos_baud;
public string serial;
public string model;
public string sw_ver;
public int machine_type;
public bool reader_always_on;
public bool multi_session_support;
public bool multi_vend_support;
public bool always_idle;
public bool explicit_vend_success;
public bool price_not_final_support;
public bool mag_card_approved_by_vmc_support;
public bool mifare_approved_by_vmc_support;
public bool debug;
public int dump_packets_level;
Where:
public Object port_vpos
The port to which the VPOS is connected.public int port_vpos_baud
The baud rate for the VPOS communication port.public String serial
The serial number of the VMC.public String model
The model name of the VMC.public String sw_ver
The software version of the VMC.public int machine_type
The type of machine connected to the VMC.public boolean explicit_vend_success
Flag to indicate explicit vending success.public boolean price_not_final_support
Indicates if the price is not final, which is helpful for pre-authorization.public boolean mag_card_approved_by_vmc_support
Support for magnetic card approval by VMC.public boolean mifare_approved_by_vmc_support
Support for MIFARE card approval by VMC.public boolean debug
Enables or disables debugging.public int dump_packets_level
Sets the level of packet logging for debugging purposes.public boolean reader_always_on
It keeps the reader always enabled.public boolean multi_session_support
Enables support for multiple sessions.public boolean multi_vend_support
Enables support for multi-vend operationspublic boolean always_idle
Configures the device to start transactions by product selection without initial card presentation.
public string port_vpos
The port to which the VPOS is connected.public int port_vpos_baud
The baud rate for the VPOS communication port.public String serial
The serial number of the VMC.public String model
The model name of the VMC.public String sw_ver
The software version of the VMC.public int machine_type
The type of machine connected to the VMC.public bool explicit_vend_success
Flag to indicate explicit vending success.public bool price_not_final_support
Indicates if the price is not final, which is helpful for pre-authorization.public bool mag_card_approved_by_vmc_support
Support for magnetic card approval by VMC.public bool mag_card_approved_by_vmc_support
Support for MIFARE card approval by VMC.ublic bool debug
Enables or disables debugging.public int dump_packets_level
Sets the level of packet logging for debugging purposes.public bool reader_always_on
It keeps the reader always enabled.public bool multi_session_support
Enables support for multiple sessions.public bool multi_vend_support
Enables support for multi-vend operationspublic bool always_idle
Configures the device to start transactions by product selection without initial card presentation.
Refer to SDK Flags Descriptions to learn about other flags that can be initiated to control specific configurations.
Updated 3 months ago