Пример #1
0
/**
 * Decodes the JSON object @c js to create a new value.
 *
 * @eg{
 *   {
 *     "id" : -1,
 *     "name" : ""
 *   }
 * }
 */
VuoAudioOutputDevice VuoAudioOutputDevice_makeFromJson(json_object *js)
{
	VuoAudioOutputDevice value = {-1,"",0};
	json_object *o = NULL;

	if (json_object_object_get_ex(js, "id", &o))
		value.id = VuoInteger_makeFromJson(o);

	if (json_object_object_get_ex(js, "name", &o))
		value.name = VuoText_makeFromJson(o);
	else
		value.name = VuoText_make("");

	if (json_object_object_get_ex(js, "channelCount", &o))
		value.channelCount = VuoInteger_makeFromJson(o);

	return value;
}
Пример #2
0
/**
 * Decodes the JSON object @c js to create a new value.
 *
 * @eg{
 *   {
 *     "id" : -1,
 *     "name" : ""
 *   }
 * }
 */
VuoMidiInputDevice VuoMidiInputDevice_makeFromJson(json_object * js)
{
	VuoMidiInputDevice md = {-1,""};
	json_object *o = NULL;

	if (json_object_object_get_ex(js, "id", &o))
		md.id = VuoInteger_makeFromJson(o);

	if (json_object_object_get_ex(js, "name", &o))
		md.name = VuoText_makeFromJson(o);
	else
		md.name = VuoText_make("");

	return md;
}
Пример #3
0
/**
 * @ingroup VuoLeapHand
 * Decodes the JSON object @c js to create a new value.
 *
 * @eg{
 *	/// @todo write VuoLeapHand json example
 *	}
 */
VuoLeapHand VuoLeapHand_makeFromJson(json_object * js)
{
	VuoLeapHand hand = VuoLeapHand_make(
					0,									// id
					(VuoPoint4d){0,0,0,0},				// rotation
					(VuoPoint3d){0,0,0},				// palmPosition
					(VuoPoint3d){0,0,0},				// palmVelocity
					0.,									// sphereRadius
					(VuoPoint3d){0,0,0},				// sphereCenter
					0., 								// palmWidth
					(VuoPoint3d){0,0,0},				// wristPosition
					0.,		 							// pinchAmount
					0.,		 							// grabAmount
					0.,		 							// timeVisible
					false, 		 						// isLeftHand
					0.,		 							// confidence
					VuoListCreate_VuoLeapPointable()	// fingers
				);

	json_object *o = NULL;

	if (json_object_object_get_ex(js, "id", &o))
		hand.id = VuoInteger_makeFromJson(o);

	if (json_object_object_get_ex(js, "rotation", &o))
		hand.rotation = VuoPoint4d_makeFromJson(o);

	if (json_object_object_get_ex(js, "palmPosition", &o))
		hand.palmPosition = VuoPoint3d_makeFromJson(o);

	if (json_object_object_get_ex(js, "palmVelocity", &o))
		hand.palmVelocity = VuoPoint3d_makeFromJson(o);

	if (json_object_object_get_ex(js, "sphereRadius", &o))
		hand.sphereRadius = VuoReal_makeFromJson(o);

	if (json_object_object_get_ex(js, "sphereCenter", &o))
		hand.sphereCenter = VuoPoint3d_makeFromJson(o);

	if (json_object_object_get_ex(js, "palmWidth", &o))
		hand.palmWidth = VuoReal_makeFromJson(o);

	if (json_object_object_get_ex(js, "wristPosition", &o))
		hand.wristPosition = VuoPoint3d_makeFromJson(o);

	if (json_object_object_get_ex(js, "pinchAmount", &o))
		hand.pinchAmount = VuoReal_makeFromJson(o);

	if (json_object_object_get_ex(js, "grabAmount", &o))
		hand.grabAmount = VuoReal_makeFromJson(o);

	if (json_object_object_get_ex(js, "timeVisible", &o))
		hand.timeVisible = VuoReal_makeFromJson(o);

	if (json_object_object_get_ex(js, "isLeftHand", &o))
		hand.isLeftHand = VuoBoolean_makeFromJson(o);

	if (json_object_object_get_ex(js, "confidence", &o))
		hand.confidence = VuoReal_makeFromJson(o);

	if (json_object_object_get_ex(js, "fingers", &o))
		hand.fingers = VuoList_VuoLeapPointable_makeFromJson(o);

	return hand;
}