private ERROR_ID SetDeviceCommunications(string port) { SETTINGS_COMMUNICATION commSet = new SETTINGS_COMMUNICATION(); SETTINGS_COMM_TIMEOUTS commTimeouts; uint connectTimeout = 5000; commTimeouts.ConnectTimeout = connectTimeout; commTimeouts.ReceiveTimeout = connectTimeout; commTimeouts.SendTimeout = connectTimeout; RBA_API.SetCommTimeouts(commTimeouts); commSet.interface_id = (uint)COMM_INTERFACE.SERIAL_INTERFACE; commSet.rs232_config.ComPort = port; commSet.rs232_config.BaudRate = Convert.ToUInt32(ComBaudRate); commSet.rs232_config.DataBits = Convert.ToUInt32(ComDataBits); commSet.rs232_config.Parity = (uint)0; commSet.rs232_config.StopBits = Convert.ToUInt32(1); commSet.rs232_config.FlowControl = (uint)0; //Connect to pin pad ERROR_ID result = RBA_API.Connect(commSet); return(result); }
public ERROR_ID UpdateDevice(string formFilePath) { string filename = Path.GetFileName(formFilePath); RBA_API.SetParam(PARAMETER_ID.P62_REQ_RECORD_TYPE, "0"); RBA_API.SetParam(PARAMETER_ID.P62_REQ_ENCODING_FORMAT, "8"); //this will be a tgz file for all forms - application files are set to 1 if (formFilePath.ToLower().Contains("ogz")) { RBA_API.SetParam(PARAMETER_ID.P62_REQ_UNPACK_FLAG, "0"); } else { RBA_API.SetParam(PARAMETER_ID.P62_REQ_UNPACK_FLAG, "1"); } RBA_API.SetParam(PARAMETER_ID.P62_REQ_FAST_DOWNLOAD, "1"); RBA_API.SetParam(PARAMETER_ID.P62_REQ_OS_FILE_NAME, formFilePath); RBA_API.SetParam(PARAMETER_ID.P62_REQ_FILE_NAME, filename); ERROR_ID result = RBA_API.ProcessMessage(MESSAGE_ID.FILE_WRITE); return(result); }
public ERROR_ID SoftReset() { RBA_API.SetParam(PARAMETER_ID.P15_REQ_RESET_TYPE, "9"); ERROR_ID result = RBA_API.ProcessMessage(MESSAGE_ID.M15_SOFT_RESET); return(result); }
public string Connect(string port, LogHandler traceLog, IngenicoLoggingLevel logLevel) { //RBA_API.logHandler = new LogHandler(traceLog); //RBA_API.SetDefaultLogLevel((LOG_LEVEL)logLevel); RBA_API.Initialize(); //RBA_API.SetNotifyRbaDisconnected(new DisconnectHandler(DeviceConnectionEvent)); //RBA_API.pinpadHandler = new PinPadMessageHandler(pinpadHandler); ERROR_ID result = SetDeviceCommunications(port); //set configuration for on demand //TODO - make this configuration driven SetDeviceToOnDemand(); SoftReset(); if (result.ToString().Contains("SUCCESS") || result.ToString().Contains("RESULT_ERROR_ALREADY_CONNECTED")) { Connected = true; //make sure Encryption is on //if (!IsEncryptionOn(CheckKeys())) //{ // Connected = false; //} } return(result.ToString()); }
public ERROR_ID WriteConfiguration(string group, string index, string data) { RBA_API.SetParam(PARAMETER_ID.P60_REQ_GROUP_NUM, group); RBA_API.SetParam(PARAMETER_ID.P60_REQ_INDEX_NUM, index); RBA_API.SetParam(PARAMETER_ID.P60_REQ_DATA_CONFIG_PARAM, data); ERROR_ID result = RBA_API.ProcessMessage(MESSAGE_ID.M60_CONFIGURATION_WRITE); return(result); }
public string Get24RebootTime() { RBA_API.SetParam(PARAMETER_ID.P61_REQ_GROUP_NUM, "0007"); RBA_API.SetParam(PARAMETER_ID.P61_REQ_INDEX_NUM, "0046"); RBA_API.ProcessMessage(MESSAGE_ID.M61_CONFIGURATION_READ); string status = RBA_API.GetParam(PARAMETER_ID.P61_RES_DATA_CONFIG_PARAMETER); return(status); }
public string GetVariable_29(string varId) { RBA_API.SetParam(PARAMETER_ID.P29_REQ_VARIABLE_ID, varId); RBA_API.ProcessMessage(MESSAGE_ID.M29_GET_VARIABLE); string status = RBA_API.GetParam(PARAMETER_ID.P29_RES_STATUS); string variable = RBA_API.GetParam(PARAMETER_ID.P29_RES_VARIABLE_ID); string value = RBA_API.GetParam(PARAMETER_ID.P29_RES_VARIABLE_DATA); return(value); }
public string RetrieveFile(string filename) { RBA_API.SetParam(PARAMETER_ID.P65_REQ_RECORD_TYPE, "1"); //dataformat - 0 = plain text and 1 = BASE64 Format - all should be plain text 0 RBA_API.SetParam(PARAMETER_ID.P65_REQ_DATA_TYPE, "0"); RBA_API.SetParam(PARAMETER_ID.P65_REQ_FILE_NAME, filename); ERROR_ID result = RBA_API.ProcessMessage(MESSAGE_ID.M65_RETRIVE_FILE); //get value that will determine is the file was actually found and retreived string resultMessage = RBA_API.GetParam(PARAMETER_ID.P65_RES_RESULT); string fileData = RBA_API.GetParam(PARAMETER_ID.P65_RES_DATA); return(fileData); }
public ERROR_ID ShowMessage(DeviceForms form, string message) { ERROR_ID Result; Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_FORM_NUMBER, StringEnum.GetStringValue(form)); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_TYPE_OF_ELEMENT, StringEnum.GetStringValue(DeviceFormTypeOf.Text)); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_TEXT_ELEMENTID, StringEnum.GetStringValue(DeviceFormElementID.PromptLine1)); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_PROMPT_IDX, message); Result = RBA_API.ProcessMessage(MESSAGE_ID.M24_FORM_ENTRY); //Make sure the form shows on the device long enough for the user to see it Thread.Sleep(2000); return(Result); }
public ERROR_ID UpdateDeviceCustom(string form_file_path) { ERROR_ID Result = ERROR_ID.RESULT_SUCCESS; try { string filename = Path.GetFileName(form_file_path); Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_UNPACK_FLAG, "0"); Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_ENCODING_FORMAT, "8"); //this will be a tgz file for all forms - application files are set to 1 if (form_file_path.ToLower().Contains("ogz")) { Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_UNPACK_FLAG, "0"); } else { Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_UNPACK_FLAG, "1"); } Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_FAST_DOWNLOAD, "1"); Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_OS_FILE_NAME, form_file_path); Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_FILE_NAME, filename); Result = RBA_API.SetParam(PARAMETER_ID.P60_REQ_GROUP_NUM, "13"); Result = RBA_API.SetParam(PARAMETER_ID.P60_REQ_INDEX_NUM, "11"); Result = RBA_API.SetParam(PARAMETER_ID.P60_REQ_DATA_CONFIG_PARAM, "1"); Result = RBA_API.ProcessMessage(MESSAGE_ID.M60_CONFIGURATION_WRITE); Result = RBA_API.SetParam(PARAMETER_ID.P62_REQ_LAST_MESSAGE_TIMEOUT_SEC, "360"); ShowMessage("Device Form Loading ..."); Result = RBA_API.ProcessMessage(MESSAGE_ID.FILE_WRITE); Debug.WriteLine("DEVICE UPDATER: SetParam() FILE_WRITE RESULT-----------={0}", Result); } catch (Exception e) { Debug.WriteLine("DeviceConfig: EXCEPTION={0}", (object)e.Message); } return(Result); }
public void Disconnect() { try { if (RBA_API.GetConnectionStatus().Equals(CONNECTION_STATUS.CONNECTED)) { Result = RBA_API.Disconnect().ToString(); ingenicoDevice.DeviceConnectionEvent(); Connected = ingenicoDevice.Connected; Debug.WriteLine("device disconnect: connected={0} --------------------------------------------------", Connected); } } catch (Exception) { //log error //if (ex.Source == "RBA_SDK_CS") //MessageBox.Show("Exception Occured during Disconnect:" + Environment.NewLine + ex.ToString() + Environment.NewLine + Environment.NewLine + "Suggested Resolution:" + Environment.NewLine + "For 32-bit machine: Add directory path for the dll to Environment variable PATH" + Environment.NewLine + "For 64-bit machine: Copy the dll to C:\\Windows\\SysWOW64"); } }
public ERROR_ID LoadForm(string formName, string message) { ERROR_ID Result = RBA_API.ProcessMessage(MESSAGE_ID.M01_ONLINE);; Debug.WriteLine("device online : {0} --------------------------------------------------", (object)result); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_FORM_NUMBER, formName); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_TYPE_OF_ELEMENT, StringEnum.GetStringValue(DeviceFormTypeOf.Text)); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_TEXT_ELEMENTID, StringEnum.GetStringValue(DeviceFormElementID.PromptLine1)); Result = RBA_API.SetParam(PARAMETER_ID.P24_REQ_PROMPT_IDX, message); Result = RBA_API.ProcessMessage(MESSAGE_ID.M24_FORM_ENTRY); //Make sure the form shows on the device long enough for the user to see it //System.Threading.Thread.Sleep(4000); return(Result); }
private void SetDeviceToOnDemand() { //check to see if the device is already in OnDemand RBA_API.SetParam(PARAMETER_ID.P61_REQ_GROUP_NUM, "7"); RBA_API.SetParam(PARAMETER_ID.P61_REQ_INDEX_NUM, "15"); RBA_API.ProcessMessage(MESSAGE_ID.M61_CONFIGURATION_READ); string dataValue = RBA_API.GetParam(PARAMETER_ID.P61_RES_DATA_CONFIG_PARAMETER); //Not Set - so set it if (!OnDemandSet || dataValue != "1") { RBA_API.SetParam(PARAMETER_ID.P60_REQ_GROUP_NUM, "7"); RBA_API.SetParam(PARAMETER_ID.P60_REQ_INDEX_NUM, "15"); RBA_API.SetParam(PARAMETER_ID.P60_REQ_DATA_CONFIG_PARAM, "1"); RBA_API.ProcessMessage(MESSAGE_ID.M60_CONFIGURATION_WRITE); OnDemandSet = true; } }
public ERROR_ID HardDeviceReset() { ERROR_ID result = RBA_API.ProcessMessage(MESSAGE_ID.M97_REBOOT); return(result); }
public void Offline() { RBA_API.ProcessMessage(MESSAGE_ID.M00_OFFLINE); }
public void Reset() { ERROR_ID Result = RBA_API.ProcessMessage(MESSAGE_ID.M10_HARD_RESET); }
public ERROR_ID Offline() { ERROR_ID result = RBA_API.ProcessMessage(MESSAGE_ID.M00_OFFLINE); return(result); }