- for (int index =0; index < strlen(id); ++index) {
-
- // Get value from number string.
- if ( id[index] == '*' ) val = 10;
- if ( id[index] == '#') val = 11;
- if ( id[index] >= 0x30 && id[index] <= 0x39 )
- val = id[index] - 0x30;
-
- *sitecode += val;
-
- // last digit is only added, not multipled.
- if ( index < strlen(id)-1 )
- *sitecode *= 12;
+ bool hex = false, errors = false;
+ uint8_t cmdp = 0;
+ char id[11];
+ int stringlen = 0;
+ memset(id, 0x00, sizeof(id));
+
+ while(param_getchar(Cmd, cmdp) != 0x00) {
+ switch(param_getchar(Cmd, cmdp)) {
+ case 'h':
+ return -1;
+ case 'H':
+ hex = true;
+ //get hex
+ *fullcode = param_get32ex(Cmd, cmdp+1, 0, 10);
+ cmdp+=2;
+ break;
+ case 'P':
+ case 'p':
+ //param get string int param_getstr(const char *line, int paramnum, char * str)
+ stringlen = param_getstr(Cmd, cmdp+1, id);
+ if (stringlen < 2) return -1;
+ cmdp+=2;
+ break;
+ case 'Q':
+ case 'q':
+ *Q5 = true;
+ cmdp++;
+ break;
+ default:
+ PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
+ errors = 1;
+ break;
+ }
+ if(errors) break;