Beispiel #1
0
        public bool Save()
        {
            if (bActive)
            {
                setLocked(false);
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                NewRequest        = new cTexNET.cMessage();
                NewRequest.Msg    = new byte[1];
                NewRequest.Msg[0] = cMTDOpcodes.OPC_SAVE;
                NewRequest.Opcode = cMTDOpcodes.OPC_SAVE;
                NewRequest.Length = (byte)NewRequest.Msg.Length;
                RequestStatus     = eRequestStatus.eNEW_REQUEST;
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                setLocked(true);
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                if (RequestStatus == eRequestStatus.eSUCCESS)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        public bool getI2CAddress(out byte Address)
        {
            if (bActive)
            {
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }
                NewRequest     = new cTexNET.cMessage();
                NewRequest.Msg = new byte[1];

                NewRequest.Opcode = cMTDOpcodes.OPC_GET_I2C_ADDRESS;
                NewRequest.Length = (byte)NewRequest.Msg.Length;
                RequestStatus     = eRequestStatus.eNEW_REQUEST;

                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                if (RequestStatus != eRequestStatus.eSUCCESS)
                {
                    Address = 0;
                    return(false);
                }

                Address = (byte)NewRequest.Msg[0];
                return(true);
            }

            Address = 0;
            return(false);
        }
Beispiel #3
0
        public bool getVersion(out string version)
        {
            if (bActive)
            {
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }
                NewRequest     = new cTexNET.cMessage();
                NewRequest.Msg = new byte[1];

                NewRequest.Opcode = cMTDOpcodes.OPC_GET_VERSION;
                NewRequest.Length = (byte)NewRequest.Msg.Length;
                RequestStatus     = eRequestStatus.eNEW_REQUEST;

                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                if (RequestStatus != eRequestStatus.eSUCCESS)
                {
                    version = "";
                    return(false);
                }

                version = Encoding.ASCII.GetString(NewRequest.Msg, 0, 10);

                return(true);
            }

            version = "";
            return(false);
        }
Beispiel #4
0
        public bool getSerialNumber(out string SerialNumber)
        {
            if (bActive)
            {
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }
                NewRequest     = new cTexNET.cMessage();
                NewRequest.Msg = new byte[1];

                NewRequest.Opcode = cMTDOpcodes.OPC_GET_SERIAL_NUMBER;
                NewRequest.Length = (byte)NewRequest.Msg.Length;
                RequestStatus     = eRequestStatus.eNEW_REQUEST;

                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                if (RequestStatus != eRequestStatus.eSUCCESS)
                {
                    SerialNumber = "";
                    return(false);
                }

                SerialNumber = Encoding.ASCII.GetString(NewRequest.Msg, 0, 10);

                return(true);
            }

            SerialNumber = "";
            return(false);
        }
Beispiel #5
0
        public bool setLocked(bool Locked)
        {
            if (bActive)
            {
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                NewRequest = new cTexNET.cMessage();


                byte[] lockMsg;
                int    len;

                if (Locked)
                {
                    lockMsg = Encoding.Default.GetBytes("FlowTEXLOCK");
                    len     = 11;
                }
                else
                {
                    lockMsg = Encoding.Default.GetBytes("FlowTEXUNLOCK");
                    len     = 13;
                }

                NewRequest.Msg = new byte[len];
                Buffer.BlockCopy(lockMsg, 0, NewRequest.Msg, 0, len);

                if (Locked)
                {
                    NewRequest.Opcode = cMTDOpcodes.OPC_LOCK;
                }
                else
                {
                    NewRequest.Opcode = cMTDOpcodes.OPC_UNLOCK;
                }

                NewRequest.Length = (byte)len;
                RequestStatus     = eRequestStatus.eNEW_REQUEST;

                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                if (RequestStatus == eRequestStatus.eSUCCESS)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #6
0
        public bool getStatus(out UInt32 FwChks, out UInt32 FwCalcChks)
        {
            if (bActive)
            {
                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }
                NewRequest     = new cTexNET.cMessage();
                NewRequest.Msg = new byte[1];

                NewRequest.Opcode = cMTDOpcodes.OPC_STATUS;
                NewRequest.Length = (byte)NewRequest.Msg.Length;
                RequestStatus     = eRequestStatus.eNEW_REQUEST;

                while ((RequestStatus == eRequestStatus.eNEW_REQUEST) || (RequestStatus == eRequestStatus.eWAITTING))
                {
                    Thread.Sleep(10);
                }

                if (RequestStatus != eRequestStatus.eSUCCESS)
                {
                    FwChks     = 0;
                    FwCalcChks = 0;
                }
                else
                {
                    FwChks     = BitConverter.ToUInt32(NewRequest.Msg, 0);
                    FwCalcChks = BitConverter.ToUInt32(NewRequest.Msg, 4);
                }

                return(true);
            }

            FwChks     = 0;
            FwCalcChks = 0;
            return(false);
        }