Skip to main content

2.7. Calling HR-RPC service with IBase

2.7. Calling HR-RPC service with IBase

IBase has basic functions which call HR-RPC services. The procedure to call HR-RPC service is as below. You have to know exact list of input and output parameter and service number.

 

p_base->InitParam( );                                     // get ready to insert input parameters

p_base->PutData( input param. 1 );

p_base->PutData( input param. 2 );

HRESULT hr = p_base->DoProcSysc( service number );  // call the service (blocked)

if(FAILED(hr) {                                                           // failure

             // error handling..

             return;

}

p_base->GetData( output param. 1 );               // extract output parameters

p_base->GetData( output param. 2 );

 

For error handling, you have to check the returned HRESULT value. HResMsg.cpp of sample source code contains some helper functions to do this. If hr==BASE_E_SERVICE, it means the Hi5/Hi5a robot controller has returned some service error code. You can check the code using IBase:: GetSvcErrCode() function. For some service error, you can make use of IBase::errcode2msg(), and the complete list of service errors are in ErrCodeRef.h