예제 #1
0
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);
}
예제 #2
0
/*buxton_set_value callback and function for boolean*/
void bsb_cb(BuxtonResponse response, void *data)
{
	bool *ret = (bool*)data;
	if(buxton_response_status(response)){
		printf("Failed to set boolean.\n");
		return;
	}
	printf("Value has been set: %i(bool)\n", *ret);
	BuxtonKey k = buxton_response_key(response);
	printf("Key: %s, Group: %s, Layer: %s.\n", buxton_key_get_name(k), buxton_key_get_group(k),
		buxton_key_get_layer(k));
}
예제 #3
0
/*buxton_set_value callback and function for double*/
void bsd_cb(BuxtonResponse response, void *data)
{
	double *ret = (double*)data;
	if (buxton_response_status(response)){
		printf("Failed to set double.\n");
		return;
	}
	printf("Value has been set: %e(double)\n", *ret);
	BuxtonKey k = buxton_response_key(response);
	printf("Key: %s, Group: %s, Layer: %s.\n", buxton_key_get_name(k), buxton_key_get_group(k),
		buxton_key_get_layer(k));
}
예제 #4
0
/*buxton_set_value callback and function for uint64_t*/
void bsui64_cb(BuxtonResponse response, void *data)
{
	uint64_t *ret = (uint64_t*)data;
	if (buxton_response_status(response)){
		printf("Failed to set uint64_t.\n");
		return;
	}
	printf("Value has been set: ""%"PRIu64"(uint64_t)\n", *ret);
	BuxtonKey k = buxton_response_key(response);
	printf("Key: %s, Group: %s, Layer: %s.\n", buxton_key_get_name(k), buxton_key_get_group(k),
		buxton_key_get_layer(k));
}
예제 #5
0
/*buxton_set_value callback and function for string*/
void bss_cb(BuxtonResponse response, void *data)
{
	char **ret=(char**)data;
	if (buxton_response_status(response)){
		printf("Failed to set string.\n");
		return;
	}
	printf("Value has been set: %s(string)\n", *ret);
	BuxtonKey k = buxton_response_key(response);
	printf("Key: %s, Group: %s, Layer: %s.\n", buxton_key_get_name(k), buxton_key_get_group(k),
		buxton_key_get_layer(k));
}
예제 #6
0
파일: helloset.c 프로젝트: jobol/buxton
void set_cb(BuxtonResponse response, void *data)
{
	BuxtonKey key;
	char *name;

	if (buxton_response_status(response) != 0) {
		printf("Failed to set value\n");
		return;
	}

	key = buxton_response_key(response);
	name = buxton_key_get_name(key);
	printf("Set value for key %s\n", name);
	buxton_key_free(key);
	free(name);
}
예제 #7
0
/*buxton_set_value callback for all buxton data types*/
void bs_cb(BuxtonResponse response, void *data){
	struct vstatus *ret = (struct vstatus*)data;
	//struct vstatus set = *ret;
	char * type = "HOUSTON";
	ret->status = 0;
	/*check response before switch*/
	if (buxton_response_status(response)){
		printf("Failed to set value.\n");
		return;
	}
	ret->status =1;
	switch(ret->type){
		case STRING:
		{
			char * val = ret->sval;
			type = "string";
			break;
		}
		case INT32:
		{
			int32_t val = ret->i32val;
			type = "int32_t";
			/*GoToBuxtonResponseStatusCheck*/
			printf("Value to be set: %i(int32_t)\n", val);
			break;
		}
		case UINT32:
		{
			uint32_t val = ret->ui32val;
			type = "uint32_t";
			break;
		}
		case INT64:
		{
			int64_t val = ret->i64val;
			type = "int64_t";
			break;
		}
		case UINT64:
		{
			uint64_t val = ret->ui64val;
			type = "uint64_t";
			break;
		}
		case FLOAT:
		{
			float val = ret->fval;
			type = "float";
			break;
		}
		case DOUBLE:
		{
			double val = ret->dval;
			type = "double";
			break;
		}
		case BOOLEAN:
		{
			bool val = ret->bval;
			type = "bool";
			break;
		}
	}
	printf("Success: %s value has been set. ", type);
	BuxtonKey k = buxton_response_key(response);
	printf("Key: %s, Group: %s, Layer: %s.\n", buxton_key_get_name(k), buxton_key_get_group(k), buxton_key_get_layer(k));
	buxton_key_free(k);	

}