void notify_cb(BuxtonResponse response, void *data) { bool *status = (bool *)data; BuxtonKey key; int32_t *value; char *name; if (buxton_response_status(response) != 0) { *status = false; return; } key = buxton_response_key(response); name = buxton_key_get_name(key); value = (int32_t*)buxton_response_value(response); if (value) { printf("key %s updated with new value %d\n", name, *value); } else { printf("key %s was removed\n", name); } buxton_key_free(key); free(value); free(name); }
/*buxton_get_value callback and function for boolean*/ void bgb_cb(BuxtonResponse response, void *data) { struct vstatus *ret = (struct vstatus*)data; ret->status=0; if (buxton_response_status(response)){ printf("Failed to get boolean.\n"); return; } ret->status = 1; ret->bval = *(bool*)buxton_response_value(response); }
/*buxton_get_value callback and function for double*/ void bgd_cb(BuxtonResponse response, void *data) { struct vstatus *ret = (struct vstatus*)data; ret->status=0; if (buxton_response_status(response)){ printf("Failed to get double.\n"); return; } ret->status = 1; ret->dval = *(double*)buxton_response_value(response); }
/*buxton_get_value callback and function for float*/ void bgf_cb(BuxtonResponse response, void *data) { struct vstatus *ret = (struct vstatus*)data; ret->status=0; if (buxton_response_status(response)){ printf("Failed to get float.\n"); return; } ret->status = 1; ret->fval = *(float*)buxton_response_value(response); }
/*buxton_get_value callback and function for uint64_t*/ void bgui64_cb(BuxtonResponse response, void *data) { struct vstatus *ret = (struct vstatus*)data; ret->status=0; if (buxton_response_status(response)){ printf("Failed to get uint64_t.\n"); return; } ret->status = 1; ret->ui64val = *(uint64_t*)buxton_response_value(response); }
/*buxton_get_value callback and function for string*/ void bgs_cb(BuxtonResponse response, void *data) { struct vstatus *ret = (struct vstatus*)data; ret->status=0; if (buxton_response_status(response)){ printf("Failed to get string.\n"); return; } ret->status=1; ret->sval = *(char**)buxton_response_value(response); }
void get_cb(BuxtonResponse response, void *data) { int32_t* ret = (int32_t*)data; if (buxton_response_status(response) != 0) { printf("Failed to get value\n"); return; } *ret = *(int32_t*)buxton_response_value(response); }
void gv_cb(BuxtonResponse response, void * data) { struct response_info* ret=(struct response_info*)data; ret->status=0; if (buxton_response_status(response)){ printf("Failed to get value\n"); return; } ret->status=1; ret->value=*(uint32_t*)buxton_response_value(response); }
void get_cb(BuxtonResponse response, void *data) { int32_t* ret = (int32_t*)data; void *vret = NULL; if (buxton_response_status(response) != 0) { printf("Failed to get value\n"); return; } vret = buxton_response_value(response); *ret = *(int32_t*)vret; free(vret); }
void bg_cb(BuxtonResponse response, void *data) { struct vstatus *ret= (struct vstatus *)data; struct vstatus get = *ret; char *type = "Houston"; switch (get.type){ case STRING: { ret->sval = *(char**)buxton_response_value(response); type = "string"; break; } case INT32: { ret->i32val = *(int32_t*)buxton_response_value(response); type = "int32_t"; break; } case UINT32: { ret->ui32val = *(uint32_t*)buxton_response_value(response); type = "uint32_t"; break; } case INT64: { ret->i64val = *(int64_t*)buxton_response_value(response); type = "int64_t"; break; } case UINT64: { ret->ui64val = *(uint64_t*)buxton_response_value(response); type = "uint64_t"; break; } case FLOAT: { ret->fval = *(float*)buxton_response_value(response); type = "float"; break; } case DOUBLE: { ret->dval = *(double*)buxton_response_value(response); type = "double"; break; } case BOOLEAN: { ret->bval = *(bool*)buxton_response_value(response); type = "bool"; break; } } ret->status = 0; if (buxton_response_status(response)){ printf("Failed to get %s. \n", type); return; } ret->status = 1; }