Ejemplo n.º 1
0
        public void Close()
        {
            DSC19ClientStatus status = (DSC19ClientStatus)GW21API.AB_GW_Status(NodeID);

            if (status == DSC19ClientStatus.Connecting)
            {
                int iReturn;
                iReturn = GW21API.AB_GW_Close(NodeID);
                if (iReturn > 0)
                {
                    ClientStatus = DSC19ClientStatus.Closed;
                }
            }
        }
Ejemplo n.º 2
0
        public void Open()
        {
            try
            {
                DSC19ClientStatus status = (DSC19ClientStatus)GW21API.AB_GW_Status(NodeID);

                if (status != DSC19ClientStatus.Connecting)
                {
                    ClientStatus = (DSC19ClientStatus)GW21API.AB_GW_Open(NodeID);
                    System.Threading.Thread.Sleep(200);
                    status = (DSC19ClientStatus)GW21API.AB_GW_Status(NodeID);
                }
                ClientStatus = status;
            }
            catch (Exception ex)
            {
                if (OnError != null)
                {
                    OnError(this, new CommandEventArgs(ex.Message));
                }
            }
        }
Ejemplo n.º 3
0
        public DSC19Client(string ip, int port)
        {
            try
            {
                client_status = DSC19ClientStatus.Closed;                       // Added by Icyer 2006/12/04

                /*
                 * if(OnSendData == null)
                 * {
                 *      OnSendData += new EventCommandHandler(DSC19Client_OnSendData);
                 * }
                 */
                client_ip   = ip;
                client_port = port;

                InitialClient();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }