Beispiel #1
0
        public override COMMUNICATERESULT SetData(CommandClass SetInfo)
        {
            int BytestoRec = 8;

            byte[]            RecBytes;
            byte[]            SendCommand;
            COMMUNICATERESULT ret;

            SendCommand = SetInfo.Command;
            if (!USBWrapper.USBConnectState())
            {
                if (USBWrapper.connect() == COMMUNICATERESULT.OK)
                {
                    ret = USBWrapper.SendAndReceive(SendCommand, BytestoRec, out RecBytes);
                }
                else
                {
                    return(COMMUNICATERESULT.PortOpenFail);
                }
            }
            else
            {
                ret = USBWrapper.SendAndReceive(SendCommand, BytestoRec, out RecBytes);
            }
            if (ret == COMMUNICATERESULT.OK)
            {
                ret = CheckData(RecBytes, SendCommand);
            }

            return(ret);
        }
Beispiel #2
0
 public override bool Connect()
 {
     if (USBWrapper.connect() == COMMUNICATERESULT.OK)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }