コード例 #1
0
        //Handle any valid data retrieved here
        void xbeePacketHandler_ValidDataGet(object sender, WATR_ValidDataGetArgs e)
        {
            //Log information
            db.LogReceivePacket(e.Data.RawData);

            //Figure out what type of packet it is and raise the proper event
            if (e.Data.GetFrameType() is WATR_XBeeRemoteATCommandResponseFrameData)
            {
                WATR_RemoteATCmdResponseGetArgs remoteATcmdResp = new WATR_RemoteATCmdResponseGetArgs(e.Data.GetFrameType());
                if (remoteATcmdResp != null)
                    ReceivedRemoteATCommandResponse(this, remoteATcmdResp);
            }
            else if (e.Data.GetFrameType() is WATR_XBeeATCommandFrameData)
            {
                WATR_ATCmdResponseGetArgs atCmdResp = new WATR_ATCmdResponseGetArgs(e.Data.GetFrameType());
                if (atCmdResp != null)
                    ReceivedATCmdResponse(this, atCmdResp);
            }
            else if (e.Data.GetFrameType() is WATR_XBeeReceivePacketFrameData)
            {
                WATR_RxPacketGetArgs rxFrameData = new WATR_RxPacketGetArgs(e.Data.GetFrameType());
                if (rxFrameData != null)
                    ReceivedRxPacket(this, rxFrameData);
            }
            else
            {
                WATR_TransmitStatusGetArgs transmitStatusGet = new WATR_TransmitStatusGetArgs(e.Data.GetFrameType());
                if (transmitStatusGet != null)
                    ReceivedTransmitStatus(this, transmitStatusGet);
            }
        }
コード例 #2
0
ファイル: WATR_BackEndSS.cs プロジェクト: JCritchfield/WATR
        void packetHandler_ReceivedRxPacket(object sender, WATR_RxPacketGetArgs e)
        {
            //To Do:
            //Implement a Custom Packet Handler for our custom data from the xbees.
            //This method will call it and send it to there. From there, the custom packet
            //Will determine what kind of information you are getting, pass it back here
            //And the backend will update the proper device =D

            //My solution!
            //Also; do not process -ANY- of this while we are looking for devices... this is causing a bit of problems as well
            //I'm assuming it has something to do with a feedback buffer. No matter.
            if (!deviceLocateTimeout.Enabled)
            {
                customPacker.ParseReceiveFrameData(e.FrameData);
            }
        }