ProDevelopTeam#MasterRace / Mbed 2 deprecated ArtnetDMX

Dependencies:   mbed DMX TextLCD mbed-rtos

Revision:
28:4b327f1cb9cb
Parent:
27:1bd34c90e0a9
--- a/ArtNet.h	Thu Mar 17 17:11:18 2016 +0000
+++ b/ArtNet.h	Fri Mar 18 00:44:33 2016 +0000
@@ -34,6 +34,7 @@
     uint16_t I16_OPCode = 0x5000;
     uint16_t I16_ProtocolVersie = 14;
     uint16_t I16_Universe = 0;
+    uint32_t I32_Universes[2] = {0};
     uint8_t I8_Values[2][511];
 }
 
@@ -48,17 +49,31 @@
         int size = eth.receive();   
         if(size > 0) {
             eth.read(C_Buf, size);
-             if(C_Buf[34] == 0x19 and C_Buf[35] == 0x36 and C_Buf[36] == 0x19 and C_Buf[37] == 0x36)
+             if(C_Buf[34] == 0x19 and C_Buf[35] == 0x36 and C_Buf[36] == 0x19 and C_Buf[37] == 0x36)    //Poort checken (6465 = 0x1936 // deel van udp protocol
             {
                 char C_ID[7];
                 memcpy(C_ID, &C_Buf[42], 7);
-                if(ArtNet::I32_CheckHeader(C_ID) == 0)
+                if(ArtNet::I32_CheckHeader(C_ID) == 0)                                                  //Art-Net Header checken
                 {
-                    if(C_Buf[50] == 0x00 and C_Buf[51]== 0x50)
+                    if(C_Buf[50] == 0x00 and C_Buf[51]== 0x50)                                          //OPcode checken
                     {
-                        if(C_Buf[52] == 0x00 and C_Buf[53]== 0x0E)
+                        if(C_Buf[52] == 0x00 and C_Buf[53]== 0x0E)                                      //Protocol Versie (14) checken
                         {
+                            // 56/57 = universe
+                            I16_Universe = C_Buf[56];
+                            I16_Universe = I16_Universe << 8;
+                            I16_Universe = I16_Universe & 0xFF00;
+                            I16_Universe = I16_Universe + C_Buf[57];
                             
+                            if(I16_Universe == I32_Universes[0])
+                            {
+                            }
+                            else if(I16_Universe == I32_Universes[1])
+                            {
+                            }
+                            else if(I16_Universe == I32_Universes[2])
+                            {
+                            }
                         } 
                     }   
                 }