예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="settings"></param>
        public usbModem(transport instTransport)
        {
            modemSettings settings = modemSettings.parse(instTransport);

            this.name     = instTransport.transportName;
            this.id       = instTransport.idTransport;
            this.settings = settings;
            this.modemOperationTimeOut = (30 * 1000); //* Timeout in milliseconds
            this.modemResponseTimeout  = 30;          //* Seconds
            this.initialise();
            //this.instPort.ErrorReceived += new SerialErrorReceivedEventHandler(instPort_ErrorReceived);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static modemSettings getStandardUSBModemSetting()
        {
            SerialPort    instSP = new SerialPort();
            modemSettings instUsbModemSettings = new modemSettings("COM3"
                                                                   , 9600                    //instSP.BaudRate
                                                                   , Parity.None             // instSP.Parity
                                                                   , 8                       //instSP.DataBits
                                                                   , StopBits.One            // instSP.StopBits
                                                                   , Handshake.RequestToSend // instSP.Handshake
                                                                   , instSP.ReadTimeout
                                                                   , instSP.WriteTimeout
                                                                   , instSP.ReadBufferSize
                                                                   , instSP.WriteBufferSize
                                                                   , true  //instSP.RtsEnable
                                                                   , true  //instSP.DtrEnable
                                                                   , consts.modemDirection.Both
                                                                   );

            return(instUsbModemSettings);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="instTransport"></param>
        /// <returns></returns>
        public static modemSettings parse(dataAccess.Entity.transport instTransport)
        {
            modemSettings instModemSettings = null;

            instModemSettings = new modemSettings(instTransport.commPort
                                                  , instTransport.baudRate
                                                  , instTransport.parity
                                                  , instTransport.dataBits
                                                  , instTransport.stopBits
                                                  , instTransport.handShake
                                                  , instTransport.readTimeOut
                                                  , instTransport.writeTimeOut
                                                  , instTransport.readTimeOut
                                                  , instTransport.writeTimeOut
                                                  , instTransport.dtrEnable
                                                  , instTransport.rtsEnable
                                                  , (consts.modemDirection)instTransport.direction);

            return(instModemSettings);
        }