Example #1
0
        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);
        }