Min il y a 6 ans
Parent
commit
2db39f9618
5 fichiers modifiés avec 42 ajouts et 3 suppressions
  1. 2 1
      List.cpp
  2. 2 1
      ListNode.cpp
  3. 1 1
      tracker.cpp
  4. 20 0
      utils.c
  5. 17 0
      utils.h

+ 2 - 1
List.cpp

@@ -2,6 +2,7 @@
 #include "ListNode.h"
 #include <string>
 
+#define nullptr 0x00
 using namespace std;
 
 // constructor with 0 parameters
@@ -168,4 +169,4 @@ void * List::remove_from_back(void)
 ListNode * List::get_first(void)
 {
     return first_node;
-}
+}

+ 2 - 1
ListNode.cpp

@@ -1,4 +1,5 @@
 #include "ListNode.h"
+#define nullptr 0x00
 
 // constructor with 0 parameters
 ListNode::ListNode() :
@@ -43,4 +44,4 @@ void ListNode::set_next(ListNode * next)
 ListNode * ListNode::get_next(void)
 {
     return this->next;
-}
+}

+ 1 - 1
tracker.cpp

@@ -17,7 +17,7 @@ char pass[255] = {0};
 
 uint16_t ID = 1050;  // Device ID
 uint16_t port = 9000;
-IPAddress server(192,168,30,1);
+IPAddress server(192,168,0,10);
 WiFiClient wclient;
 
 uint8_t aes_key[16] = {

+ 20 - 0
utils.c

@@ -0,0 +1,20 @@
+
+int hex2bin( const char *s )
+{
+    int ret=0;
+    int i;
+    for( i=0; i<2; i++ )
+    {
+        char c = *s++;
+        int n=0;
+        if( '0'<=c && c<='9' )
+            n = c-'0';
+        else if( 'a'<=c && c<='f' )
+            n = 10 + c-'a';
+        else if( 'A'<=c && c<='F' )
+            n = 10 + c-'A';
+        ret = n + ret*16;
+    }
+    return ret;
+}
+

+ 17 - 0
utils.h

@@ -0,0 +1,17 @@
+
+#ifndef __ELEC0017_CRYPTO_H__
+#define __ELEC0017_CRYPTO_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+int hex2bin(const char *hex);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif