Ejemplo n.º 1
0
        private void HandleCompletePacket(Byte Uid)
        {
            Packet Pkt;
            /*Handle The Packet.......*/
            Pkt = Que.GetLockedPacket(Uid);
            if (Pkt == null)
            {
                return;
            }

            /*Get The Type*/
            switch (Pkt.ParameterId)
            {
                case Types.ParamID.Get_Node_ID:
                    UpdateNode((Byte)Pkt.PacketGetRxU8(0));
                    ParamUpdatedCallback(Pkt);
                    break;
                case Types.ParamID.Get_App_Variosn:
                    /*App Version Is In Data*/
                    UpdateNode_AppVersion(Pkt.NodeId,Pkt.PacketGetRxU32(0));
                    ParamUpdatedCallback(Pkt);
                    break;
                case Types.ParamID.Get_Device_Type:
                    UpdateNode_DeviceType(Pkt.NodeId, (uint)Pkt.PacketGetRxU32(0));
                    ParamUpdatedCallback(Pkt);
                    break;
                case Types.ParamID.Get_Checkpoint_Count:
                    UpdateNode_CheckpointCount(Pkt.NodeId, Pkt.PacketGetRxU32(0));
                    ParamUpdatedCallback(Pkt);
                    this.CheckPointCount = Pkt.PacketGetRxU32(0);
                    break;
                case Types.ParamID.Get_App_Name:
                    UpdateNode_AppName(Pkt.NodeId, Pkt.PacketGetRxString());
                    ParamUpdatedCallback(Pkt);
                    break;
                case Types.ParamID.Get_SerialNum:
                    UpdateNode_SerialNum(Pkt.NodeId, Pkt.PacketGetRxU32(0));
                    ParamUpdatedCallback(Pkt);
                    break;
                case Types.ParamID.Get_Checksum:
                    UpdateNode_AppCRC(Pkt.NodeId, Pkt.PacketGetRxU32(0));
                    ParamUpdatedCallback(Pkt);
                    break;
                case Types.ParamID.Get_Checkpoint_Object:

                    CheckPoint Chk = new CheckPoint(Pkt.RxData, Pkt.NodeId);
                    CheckPointsList.AddCheckpoint(Chk);
                    this.CheckpointUpdatedCallback(Chk);

                    break;
                case Types.ParamID.Get_Checkpoint_Value:

                    CheckPoint Cpt = CheckPointsList.GetCheckpointBYId(Pkt.PacketGetTxU32(0));
                    Cpt.UpdateCheckpointValue(Pkt.RxData, 0, Pkt.RxDataLength);

                    break;
                default:
                    break;
            }

            /*Remove From The Que*/
            Que.RemovePacketFromQue(Pkt);
            Que.ReleasePacket(Pkt);
        }
Ejemplo n.º 2
0
        void AddCheckpointToTable(CheckPoint Chk)
        {
            /*Find If Exixsts*/
            foreach (DataGridViewRow Row in dgCheckpoints.Rows)
            {
                if (Row.Cells["CheckpointId"].Value.ToString() == Chk.Id.ToString())
                {
                    /*Exists*/
                    return;
                }
            }

               int NewRowId  =  dgCheckpoints.Rows.Add();

               dgCheckpoints.Rows[NewRowId].Cells["CheckpointId"].Value = Chk.Id.ToString();
               dgCheckpoints.Rows[NewRowId].Cells["CheckpointName"].Value = Chk.Label.ToString();
               ((DataGridViewComboBoxCell)(dgCheckpoints.Rows[NewRowId].Cells["CheckpointType"])).Value = "Dec";
        }
Ejemplo n.º 3
0
 public void Request_CheckpointValue(CheckPoint Chk)
 {
     Packet Pkt = new Packet(Chk.NodeId, Types.PacketReqType.Get_Parrameter, Types.ParamID.Get_Checkpoint_Value,Chk.Id);
     EnquePacket(Pkt);
 }