Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Created November 17, 2015 10:44
Show Gist options
  • Save changtimwu/d2785ffd3a49e87f3335 to your computer and use it in GitHub Desktop.
Save changtimwu/d2785ffd3a49e87f3335 to your computer and use it in GitHub Desktop.
correct format
{
"jsonrpc": "2.0",
"id": "f3363ed525852bea94200c5eeae",
"result": {
"deviceId": "e8:de:d6:00:11:22",
"mapping": {
"1": "4",
"2": "3",
"3": "2",
"4": "1"
}
}
}
@changtimwu
Copy link
Author

#include <stdio.h>
#include <string.h>
#define DEVICEID "mydev"
#define MAC "00:22:33:44:55:66"
int main( int argc, char *argv[])
{
    char inbuf[100];
    sprintf( inbuf,"{\"jsonrpc\":\"2.0\",\"id\":\"%s\",\"result\":{\"deviceId\":\"%s\", \"mapping\":{\"1\"}}}",DEVICEID,MAC);
    printf("inbuf=%s\n", inbuf);
    return 0;
}
{
    "jsonrpc": "2.0",
    "id": "mydev",
    "result": {
        "deviceId": "00:22:33:44:55:66",
        "mapping": {
            "1"
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment