daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Nov 16th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uint8_t macaddr[5][6] =
  2. {
  3. {0x01, 0x01, 0x01, 0x01, 0x01, 0x01}//1
  4. ,{0x02, 0x02, 0x02, 0x02, 0x02, 0x02}//2
  5. ,{0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa}//3
  6. ,{0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb}//4
  7. ,{0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc}//5
  8. };
  9.    
  10. struct alarminfo
  11. {
  12.      uint8_t bssid[6];
  13.      //
  14.      //.....
  15. };
  16.    
  17. alarminfo alarm_preset[5];
  18.    
  19. struct alarminfo *dst = alarm_preset;
  20. for (uint8_t (*src)[6] = macaddr, (*src_end)[6] = src + 5; src != src_end;
  21.        ++src, ++dst)
  22.   memcpy(dst->bssid, src, sizeof *src);
  23.    
  24. for (unsigned i = 0; i < 5; ++i)
  25.   memcpy(alarm_preset[i].bssid, macaddr[i], sizeof macaddr[i]);
  26.    
  27. struct alarminfo {
  28.      uint8_t bssid[6];
  29.      //...
  30. };
  31.  
  32. struct alarminfo alarm_preset[5] = {
  33.       {{0x01, 0x01, 0x01, 0x01, 0x01, 0x01}},  //1
  34.       {{0x02, 0x02, 0x02, 0x02, 0x02, 0x02}},  //2
  35.       {{0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa}},  //3
  36.       {{0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb}},  //4
  37.       {{0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc}}   //5
  38.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top