Ejemplo n.º 1
0
int ManusCalibrate(GLOVE_HAND hand, bool gyro, bool accel, bool fingers)
{
	// Get the glove from the list
	Glove* elem;
	int ret = GetGlove(hand, &elem);
	if (ret != MANUS_SUCCESS)
		return ret;

	// Set the flags
	uint8_t flags = elem->GetFlags();
	if (gyro)
		flags |= GLOVE_FLAGS_CAL_GYRO;
	else
		flags &= ~GLOVE_FLAGS_CAL_GYRO;
	if (accel)
		flags |= GLOVE_FLAGS_CAL_ACCEL;
	else
		flags &= ~GLOVE_FLAGS_CAL_ACCEL;
	if (fingers)
		flags |= GLOVE_FLAGS_CAL_FINGERS;
	else
		flags &= ~GLOVE_FLAGS_CAL_FINGERS;
	elem->SetFlags(flags);

	return MANUS_SUCCESS;
}
Ejemplo n.º 2
0
int ManusSetVibration(GLOVE_HAND hand, float power){
	Glove* elem;
	int ret = GetGlove(hand, &elem);
	
	if (ret != MANUS_SUCCESS)
		return ret;

	elem->SetVibration(power);

	return MANUS_SUCCESS;
}
Ejemplo n.º 3
0
int ManusGetData(GLOVE_HAND hand, GLOVE_DATA* data, unsigned int timeout)
{
	// Get the glove from the list
	Glove* elem;
	int ret = GetGlove(hand, &elem);
	if (ret != MANUS_SUCCESS)
		return ret;

	if (!data)
		return MANUS_INVALID_ARGUMENT;

	return elem->GetData(data, timeout) ? MANUS_SUCCESS : MANUS_ERROR;
}
Ejemplo n.º 4
0
int ManusGetState(unsigned int glove, GLOVE_STATE* state, unsigned int blocking)
{
	// Get the glove from the list
	Glove* elem;
	int ret = GetGlove(glove, &elem);
	if (ret != MANUS_SUCCESS)
		return ret;

	if (!state)
		return MANUS_INVALID_ARGUMENT;

	return elem->GetState(state, blocking) ? MANUS_SUCCESS : MANUS_ERROR;
}
Ejemplo n.º 5
0
int ManusSetHandedness(GLOVE_HAND hand, bool right_hand)
{
	// Get the glove from the list
	Glove* elem;
	int ret = GetGlove(hand, &elem);
	if (ret != MANUS_SUCCESS)
		return ret;

	// Set the flags
	uint8_t flags = elem->GetFlags();
	if (right_hand)
		flags |= GLOVE_FLAGS_HANDEDNESS;
	else
		flags &= ~GLOVE_FLAGS_HANDEDNESS;
	elem->SetFlags(flags);

	return MANUS_SUCCESS;
}