Esempio n. 1
0
        void packetHandler_ReceivedRemoteATCommandResponse(object sender, WATR_RemoteATCmdResponseGetArgs e)
        {
            //Let's face it - I am seriously only using this as a way to find all of the devices in our network.
            //if I needed to populate information on a device itself, I'd need to disable this event
            //And add a custom one in that only interprets packets from a specific serial number.
            bool matchFound = false;

            foreach (ulong serial in deviceList.Keys)
            {
                if (e.FrameData.SourceAddress == serial)
                    matchFound = true;
            }

            if (!matchFound)
            {
                //Make sure that the device ID is NOT 0; I've been having MAJOR issues with this for some reason
                //This usually occurs when a packet is "valid" but still misread - meaning, there is something wrong
                //With either the way the packet received the information, or the way I transmitted it.
                if (e.FrameData.SourceAddress > 0)
                {
                    //Create the device
                    WATR_XBeeDevice temp = new WATR_XBeeDevice(e.FrameData.SourceAddress, e.FrameData.CommandData);

                    //Add the proper event handler to it
                    temp.RefreshRequest += xbee_RefreshRequest;
                    temp.LogbookRequest += temp_LogbookRequest;

                    //Force refresh - OUTDATED; moved so that this doesn't screw up
                    //temp.ForceRefresh();

                    //Add it to the list
                    deviceList.Add(e.FrameData.SourceAddress, temp);
                }
            }
        }
 public WATR_LogbookRequestArgs(WATR_XBeeDevice requestor)
 {
     Requestor = requestor;
 }