Groep E3 - EMDEV

Dependencies:   EthernetInterface HTTPServer RemoteIR SDFileSystem mbed-rpc mbed-rtos mbed

Fork of SmartRemote by Sam Kirsch

Revision:
15:c8074f5f241a
Parent:
14:2b63c0f795cb
Child:
16:2d23297857bc
diff -r 2b63c0f795cb -r c8074f5f241a main.cpp
--- a/main.cpp	Tue Dec 03 16:21:52 2013 +0000
+++ b/main.cpp	Wed Dec 04 17:04:12 2013 +0000
@@ -97,6 +97,7 @@
     char tuple_bitlength[128];
     char tuple_format[128];
     char temp[20];
+    int n;
     //End DB init
 
 
@@ -165,6 +166,15 @@
         if ( Request != 0) {
             led2 = 1;
             db_find_tuple(Request, tuple_name, tuple_code, tuple_bitlength, tuple_format);
+
+            n = atoi(tuple_bitlength) / 8 + (((atoi(tuple_bitlength) % 8) != 0) ? 1 : 0);
+            memset(buf1, 0x00, sizeof(buf1));
+            for (int i = 0; i < n; i++) {
+                // printf("%02X", buf[i]);
+                // buf1[i] = (uint8_t)(atoi( tuple_code.substr(i, 2) ));
+                printf("%d", atoi( tuple_code.substr(i, 2) ));
+            }
+
             {
                 RemoteIR::Format f = static_cast<RemoteIR::Format>(atoi(tuple_format));
                 bitlength1 = transmit(f, (uint8_t *)atoi(tuple_code), atoi(tuple_bitlength));