uint8_t arr[] = {10, 239, 156, 187, 43, 431};
char* kk = "5ibcdef0123456789s23456";
String he = "98CDAC23EC98";
String heq = "98";
uint8_t u8 ;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//Serial.println( arr[1]);
// in_mac(arr, arr, kk) ;
// Serial.println( arr[1]);
Serial.println("-------------");
//de_mac(arr, arr, kk) ;
String stringOne = "1230-987-6-[12,[323],34]";
// substring(index) looks for the substring from the index position to the end:
int for_n_device = stringOne.substring(0, 4).toInt();
int case_n = stringOne.substring(5, 8).toInt();
int enqreption = stringOne.substring(9, 10).toInt();
Serial.println(for_n_device );
Serial.println(case_n);
Serial.println(enqreption);
stringOne.remove(0, 11);
Serial.println( stringOne);
}
template <typename T>
boolean in_mac(const T& input, uint8_t* Output, char* key) {
//char aa[7] ;
//key.toCharArray(aa, 7);
for (int o = 0; o < 6; o++) {
Output[o] = input[o] + (int)key[o];
}
return true;
}
template <typename T>
boolean de_mac(const T& input, uint8_t* Output, char* key) {
//char aa[7] ;
//key.toCharArray(aa, 7);
for (int o = 0; o < 6; o++) {
Output[o] = input[o] - (int)key[o];
}
return true;
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}