C# & Java SDK Integration
This guide shows you how to integrate the Marshall SDK into your C# or Java application. You’ll learn how to:
- Import the SDK package into your project
- Create and configure a VMC settings object
- Set up the serial (COM) port for communication
- Register event listeners and start the SDK
The instructions are presented side by side for both languages.
Pre-requisites
Before you begin, make sure you have:
- Downloaded the appropriate SDK files,
.jar
for Java or.dll
for C#. - Identified the correct COM port for the Marshall cable.
Integrate Marshall
To perform the integration, follow the steps below:
-
Import the provided.
.JAR
or SDK DLL file into your project. -
Import the necessary namespaces in your code.
import com.bitmick.marshall.models.*;
using com.bitmick.marshall.models;
-
Instantiate a VMC configuration object:
public vmc_configuration vmc_config = new vmc_configuration();
vmc_configuration vmc_config = new vmc_configuration();
-
Fill in the appropriate fields. The following code block presents a standard configuration:
public static void main(string[] args) { vmc_config.multi_vend_support = false; vmc_config.multi_session_support = false; vmc_config.price_not_final_support = true; vmc_config.reader_always_on = false; vmc_config.always_idle = false; vmc_config.vend_denied_policy = vmc_configuration.vend_denied_policy_cancel; vmc_config.mifare_approved_by_vmc_support = false; vmc_config.mag_card_approved_by_vmc_support = false; vmc_config.dump_packets_level = vmc_configuration.debug_level_dump_moderate; vmc_config.debug = true; }
public class vend_machine vmc_config.multi_session_support = false; vmc_config.multi_vend_support = false; vmc_config.price_not_final_support = false; vmc_config.reader_always_on = false; vmc_config.always_idle = false; vmc_config.vend_denied_policy = vmc_configuration.vend_denied_policy_cancel; vmc_config.mag_card_approved_by_vmc_support = false; vmc_config.mifare_approved_by_vmc_support = false; vmc_config.debug = true; vmc_config.dump_packets_level = vmc_configuration.debug_level_dump_moderate;
Mandatory Fields
The customer machine information is mandatory for the VMC configuration. These are the
model
,serial
,hw_ver
, and themanuf_code
. Read more about these fields in VMC Configuration Object. -
Setup the COM port.
m_vmc.link.set_serial_port(new pc_port("COM18", 115200))
m_vmc.link.set_serial_port(new pc_port("COM18", 115200))
COM Port
Make sure that you change the
COM
parameter to the one your Marshall cable is connected to. -
Configure the SDK and register to link events.
m_vmc.link.configure(vmc_config);
m_vmc.link.set_events(new vmc_link_events());
- Start the SDK and wait for the
onReady()
event:
vmc_instance .start();
m_vmc.link.start();
Using Android
On android, either you need support from your provider or use FTDI chip, which we provide
port implementation for it. (see the “android” folder in the JAVA SDK release)
See Also
Updated about 2 hours ago