Exemple #1
0
 public bool isBiosStart(CanPacket cp, byte sender, uint hwid)
 {
     bool returnval = false;
     uint id = cp.getId();
     if (HWID_INUSE) {
         byte[] data = cp.getData();
         if ((id&0x00FF0000) == (CAN_NMT_BIOS_START<<16) && data[4]==((hwid)&0xff) && data[5]==((hwid>>8)&0xff) && data[6]==((hwid>>16)&0xff) && data[7]==((hwid>>24)&0xff)) {
             returnval = true;
             string appinfo = "Application installed";
             if (data[2] == 0) {
                 appinfo = "No application installed";
             }
             if (data[3]!=0 && data[3]!=0xff) {
                appinfo += ", application can-id "+data[3];
             }
             Console.WriteLine("Bios started on node 0x" + String.Format("{0:x2}", sender) +
                                 ", bios version 0x" + String.Format("{0:x2}", data[1]) + String.Format("{0:x2}", data[0]) +
                                 ", " + appinfo
                                 );
         }
     } else {
         if ((id&0x00FF0000) == (CAN_NMT_BIOS_START<<16) && (id&0x0000FF00) == (sender<<8)) {
             returnval = true;
             byte[] data = cp.getData();
             string appinfo = "Application installed";
             if (data[2] == 0) {
                 appinfo = "No application installed";
             }
             Console.WriteLine("Bios started on node 0x" + String.Format("{0:x2}", sender) +
                                 ", bios version 0x" + String.Format("{0:x2}", data[1]) + String.Format("{0:x2}", data[0]) +
                                 ", " + appinfo
                                 );
         }
     }
     return returnval;
 }
Exemple #2
0
 public bool isBiosStart(CanPacket cp, byte sender, uint hwid)
 {
     bool returnval = false;
     uint id = cp.getId();
     if (HWID_INUSE) {
         byte[] data = cp.getData();
         if ((id&0x00FF0000) == (CAN_NMT_BIOS_START<<16) && data[4]==((hwid)&0xff) && data[5]==((hwid>>8)&0xff) && data[6]==((hwid>>16)&0xff) && data[7]==((hwid>>24)&0xff)) {
             returnval = true;
             string appinfo = "application installed";
             if (data[2] == 0) {
                 appinfo = "no application installed";
             }
             if (data[3]==0) {
                appinfo += ", device type unkown";
             }
             if (data[3]!=0) {
                 switch(data[3]){
                     case DEVICETYPE_AVR_ATmega8:
                         appinfo += ", device type ATmega8";
                         break;
                     case DEVICETYPE_AVR_ATmega48:
                         appinfo += ", device type ATmega48";
                         break;
                     case DEVICETYPE_AVR_ATmega88:
                         appinfo += ", device type ATmega88";
                         break;
                     case DEVICETYPE_AVR_ATmega168:
                         appinfo += ", device type ATmega168";
                         break;
                     case DEVICETYPE_AVR_ATmega328:
                         appinfo += ", device type ATmega328";
                         break;
                     default:
                         appinfo += ", device type unknown";
                         break;
                 }
             }
             Console.WriteLine("Bios started on node 0x" + String.Format("{0:x2}", sender) +
                                 ", bios version 0x" + String.Format("{0:x2}", data[1]) + String.Format("{0:x2}", data[0]) +
                                 ", " + appinfo
                                 );
         }
     } else {
         if ((id&0x00FF0000) == (CAN_NMT_BIOS_START<<16) && (id&0x0000FF00) == (sender<<8)) {
             returnval = true;
             byte[] data = cp.getData();
             string appinfo = "Application installed";
             if (data[2] == 0) {
                 appinfo = "No application installed";
             }
             Console.WriteLine("Bios started on node 0x" + String.Format("{0:x2}", sender) +
                                 ", bios version 0x" + String.Format("{0:x2}", data[1]) + String.Format("{0:x2}", data[0]) +
                                 ", " + appinfo
                                 );
         }
     }
     return returnval;
 }
Exemple #3
0
 public bool isBiosStart(CanPacket cp, byte sender)
 {
     bool returnval = false;
     uint id = cp.getId();
     if ((id&0x00FF0000) == (CAN_NMT_BIOS_START<<16) && (id&0x0000FF00) == (sender<<8)) {
         returnval = true;
         byte[] data = cp.getData();
         string appinfo = "Application installed";
         if (data[2] == 0) {
             appinfo = "No application installed";
         }
         Console.WriteLine("Bios started on node 0x" + String.Format("{0:x2}", sender) +
                             ", bios version 0x" + String.Format("{0:x2}", data[1]) + String.Format("{0:x2}", data[0]) +
                             ", " + appinfo
                             );
     }
     return returnval;
 }