src/libYARP_dev/esdcan/linux/yarp/YARPEsdCanDeviceDriver.cpp
int YARPEsdCanDeviceDriver::_writeWord16Ex (int msg, int axis, short s1, short s2)
{
	/// prepare Can message.
	EsdCanResources& r = RES(system_resources);

	ACE_ASSERT (axis >= 0 && axis <= (ESD_MAX_CARDS-1)*2);
	ACE_ASSERT ((axis % 2) == 0);	/// axis is even.

	if (!ENABLED(axis))
		return YARP_OK;

	_mutex.Wait();

	r.startPacket();
	r.addMessage (msg, axis);

	*((short *)(r._writeBuffer[0].data+1)) = s1;
	*((short *)(r._writeBuffer[0].data+3)) = s2;
	r._writeBuffer[0].len = 5;

	_writerequested = true;
	_noreply = true;
	
	_mutex.Post();

	/// syncing.
	_done.Wait();

	/// hopefully ok...
	return YARP_OK;
}
/// two shorts in a single Can message (both must belong to the same control card).
two shorts in a single Can message (both must belong to the same control card).
two shorts in a single Can message ( both must belong to the same control card ) .
int YARPEsdCanDeviceDriver::_writeWord16Ex (int msg, int axis, short s1, short s2)
{
	EsdCanResources& r = RES(system_resources);
	ACE_ASSERT (axis >= 0 && axis <= (ESD_MAX_CARDS-1)*2);
	ACE_ASSERT ((axis % 2) == 0);	
	if (!ENABLED(axis))
		return YARP_OK;
	_mutex.Wait();
	r.startPacket();
	r.addMessage (msg, axis);
	*((short *)(r._writeBuffer[0].data+1)) = s1;
	*((short *)(r._writeBuffer[0].data+3)) = s2;
	r._writeBuffer[0].len = 5;
	_writerequested = true;
	_noreply = true;
	_mutex.Post();
	_done.Wait();
	return YARP_OK;
}
int YARPEsdCanDeviceDriver :: _writeWord16Ex ( int msg , int axis , short s1 , short s2 ) { EsdCanResources & r = RES ( system_resources ) ; ACE_ASSERT ( axis >= 0 && axis <= ( ESD_MAX_CARDS - 1 ) * 2 ) ; ACE_ASSERT ( ( axis % 2 ) == 0 ) ; if ( ! ENABLED ( axis ) ) return YARP_OK ; _mutex . Wait ( ) ; r . startPacket ( ) ; r . addMessage ( msg , axis ) ; * ( ( short * ) ( r . _writeBuffer [ 0 ] . data + 1 ) ) = s1 ; * ( ( short * ) ( r . _writeBuffer [ 0 ] . data + 3 ) ) = s2 ; r . _writeBuffer [ 0 ] . len = 5 ; _writerequested = true ; _noreply = true ; _mutex . Post ( ) ; _done . Wait ( ) ; return YARP_OK ; }
two shorts in a single Can message (both must belong to the same control card).
two shorts in a single Can message ( both must belong to the same control card ) .
/// prepare Can message. /// axis is even. /// syncing. /// hopefully ok...