device sharing command
xdtao February 18, 2008
 
Hello
In Xpring ,we use 'lock' command to lock the device and 'release' command to free the device, How to lock a device in Xpeak?

Thanks

Michel February 18, 2008
 
Hi

In Xpeak there is a Service called Mutex. It is not already available in the free version. Whith that Service, the application will manage the lock and unlock procedure.

Next free version will include that service.

Michel

xdtao February 19, 2008
 
Hi
In which xpeak version there is a Mutex services? Can I get it now and How can I get it? Thanks

Michel February 21, 2008
 
Hi

The Service System-Logical-Mutex is already available in the Free version. You can check it.

Bye

xdtao February 22, 2008
 
Hi
Thank you very much.
Is there any document mention of how to use the 'System Logical-Mutex' command and a java demo program using 'claim' command?

Jaime February 22, 2008
 
Not yet.

Here you are an example:

XClassServiceMutex MyMutex = ( XClassServiceMutex) Manager.getService( 'MyMutexService');

MyMutex.initialize( false);

boolean Claimed = false;

int ClaimedResult = MyMutex.claim( 'Name', 'Me', 10000).Result.getValue(); // Try during 10 seconds

if( Result == XPEAK_RESULT_CLAIMED)) { // Claimed by another Owner
if( waitForMutexClaimed( 'Name', 'Me').Result.getValue() == XPEAK_RESULT_CLAIMED) {
Claimed = true;
}
} else {
Claimed = (Result == XPEAK_RESULT_OK);
}

if( Claimed) {

// YOUR CLAIMED CODE HERE

MyMutex.release( 'Name', 'Me');
}

xdtao February 22, 2008
 
Hi
Thanks a lot.
int ClaimedResult = MyMutex.claim( 'Name', 'Me', 10000)
Could you pls explain the parameter 'Name' and 'Me'.I just know it name and owner.

Jaime February 22, 2008
 
The specifications explain them.

Name parameter is the name of your Mutex. For example, if you want to share a passbook printer, you can create a Mutex called 'Printer'. If you want to share it between Application1 and Application2, you just call claim( 'Printer', 'Application1') or claim( 'Printer', 'Application2').

You decide the values of both parameters.

Bye