Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void handle_cmd(volatile char* cmdLine)
- {
- int i = 0;
- volatile char* word[500] = {NULL, NULL, NULL};
- while((word[i] = parse_cmd_line(&cmdLine, ' ')) != NULL )
- {
- //printf("word[%i] = %sn", i, word[i]);
- i++;
- }
- //Analyse the 3 words :
- if(strcmp(word[0], "help") == 0)
- {
- print_usage();
- }
- else if(strcmp(word[0], "print") == 0)
- {
- printf("test print...n");
- }
- else if(strcmp(word[0], "temperature") == 0)
- {
- printf("temperature ");
- temperature_sensor();
- }
- else if(strcmp(word[0], "id") == 0)
- {
- serial_number();
- }
- /*else if(strcmp(word[0], "light") == 0)
- {
- light_sensor();
- }*/
- else if(strcmp(word[0], "search") == 0)
- {
- //search_key(arg[1]);
- }
- else if(strcmp(word[0], "send") == 0)
- {
- if(strlen(word[1]) == 4)
- {
- printf("sending %s to %x", word[2], strtoul(word[1], NULL, 16));
- send_packet(strtoul(word[1], NULL, 16), word[2]);
- }
- }
- else
- {
- printf("nCommand unknown !");
- }
- printf("command received : |%s|%s|%s|n", word[0], word[1], word[2]);
- }
Add Comment
Please, Sign In to add comment