DAVID4 SDK  1.8.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
david::ClientJsonRpc Class Reference

Implementation of IModules and client using Json RPC 2.0. More...

#include <ClientJsonRpc.h>

Inheritance diagram for david::ClientJsonRpc:
david::IModules

Public Member Functions

 ClientJsonRpc ()
 Constructor.
 
virtual ~ClientJsonRpc ()
 Destructor.
 
ServerInfo Connect (const std::string &address="127.0.0.1", uint16_t port=DAVID_SDK_DefaultPort)
 Connect to a running 'DAVID Enterprise Server' instance. More...
 
virtual void Disconnect (bool stopServer)
 Disconnect from server. More...
 
virtual IStructuredLightScannersls ()
 Returns an interface to the 'Structured Light Scanning' module. More...
 
virtual IShapeFusionfusion ()
 Returns an interface to the 'Shape Fusion' module. More...
 
virtual ITurntableturntable ()
 Returns an interface to the 'Turntable' module. More...
 
virtual IMeasuremeasure ()
 Returns an interface to the 'Measurement' module. More...
 
virtual IMainWindowmainWindow ()
 Returns an interface to the 'Main Window' module. More...
 
void ExecuteRpc (Json::Value &response, const Json::Value &rpc)
 Execute a remote procedure call all via RPC channel. More...
 
void PrepareRpc (Json::Value &rpc, const std::string method)
 Prepare a remote procedure call. More...
 
void ReadBinaryData (void *buffer, size_t bufferSize)
 Read binary data from binary channel into buffer. More...
 
template<class T >
ExtractJsonParam (const Json::Value &jsonParams, const std::string &paramName)
 Extract a parameter value from Json value. More...
 
template<class T >
void ExtractJsonParam (Optional< T > &optionalValue, const Json::Value &jsonParams, const std::string &paramName)
 Extract a parameter value from Json value. More...
 
- Public Member Functions inherited from david::IModules
virtual ~IModules ()
 Destructor.
 

Detailed Description

Implementation of IModules and client using Json RPC 2.0.

The client connects to a running DAVID Enterprise Server.

Examples:
SimpleMeshComparison.cpp, SimpleShapeFusion.cpp, SimpleStructuredLightScanner.cpp, SimpleTurntable.cpp, and TimedScans.cpp.

Definition at line 47 of file ClientJsonRpc.h.

Member Function Documentation

ServerInfo david::ClientJsonRpc::Connect ( const std::string &  address = "127.0.0.1",
uint16_t  port = DAVID_SDK_DefaultPort 
)

Connect to a running 'DAVID Enterprise Server' instance.

Parameters
[in]addressIP address of the running server. Use 127.0.0.1 for local host.
[in]portPort of server connection.
Returns
Some information about the server.
Exceptions
david::Error_RpcClientVersion(david::FunctionException) Client version not compatible.
Examples:
SimpleMeshComparison.cpp, SimpleShapeFusion.cpp, SimpleStructuredLightScanner.cpp, SimpleTurntable.cpp, and TimedScans.cpp.
virtual void david::ClientJsonRpc::Disconnect ( bool  stopServer)
virtual

Disconnect from server.

Parameters
[in]stopServerStop remote server?
void david::ClientJsonRpc::ExecuteRpc ( Json::Value &  response,
const Json::Value &  rpc 
)

Execute a remote procedure call all via RPC channel.

Parameters
[out]responseResponse from server.
[in]rpcRemote procedure call.
template<class T >
T david::ClientJsonRpc::ExtractJsonParam ( const Json::Value &  jsonParams,
const std::string &  paramName 
)
inline

Extract a parameter value from Json value.

Parameters
[in]jsonParamsSubtree of Json values.
[in]paramNameName of parameter to be extracted.
Returns
Value of parameter.
Exceptions
david::Error_RpcInvalidParamsParameter not available or of wrong type.

Definition at line 111 of file ClientJsonRpc.h.

template<class T >
void david::ClientJsonRpc::ExtractJsonParam ( Optional< T > &  optionalValue,
const Json::Value &  jsonParams,
const std::string &  paramName 
)
inline

Extract a parameter value from Json value.

Parameters
[out]optionalValueGets the value, if one is available.
[in]jsonParamsSubtree of Json values.
[in]paramNameName of parameter to be extracted.
Exceptions
david::Error_RpcInvalidParamsParameter is of wrong type.

Definition at line 139 of file ClientJsonRpc.h.

virtual IShapeFusion& david::ClientJsonRpc::fusion ( )
virtual

Returns an interface to the 'Shape Fusion' module.

Returns
Interface class for 'Shape Fusion' functions.

Implements david::IModules.

Examples:
SimpleMeshComparison.cpp, SimpleShapeFusion.cpp, SimpleTurntable.cpp, and TimedScans.cpp.
virtual IMainWindow& david::ClientJsonRpc::mainWindow ( )
virtual

Returns an interface to the 'Main Window' module.

Returns
Interface class for 'Main Window' functions.

Implements david::IModules.

virtual IMeasure& david::ClientJsonRpc::measure ( )
virtual

Returns an interface to the 'Measurement' module.

Returns
Interface class for 'Measurement' functions.

Implements david::IModules.

Examples:
SimpleMeshComparison.cpp.
void david::ClientJsonRpc::PrepareRpc ( Json::Value &  rpc,
const std::string  method 
)

Prepare a remote procedure call.

This following variables are set:

rpc["jsonrpc"] = "2.0";
rpc["method"] = method;
rpc["id"] = newID;
Parameters
[in,out]rpcRemote procedure call.
[in]methodName of the method.
void david::ClientJsonRpc::ReadBinaryData ( void *  buffer,
size_t  bufferSize 
)

Read binary data from binary channel into buffer.

Parameters
[out]bufferDestination buffer for binary data.
[in]bufferSizeSize of buffer in bytes.
virtual IStructuredLightScanner& david::ClientJsonRpc::sls ( )
virtual

Returns an interface to the 'Structured Light Scanning' module.

Returns
Interface class for 'Structured Light Scanning' functions.

Implements david::IModules.

Examples:
SimpleMeshComparison.cpp, SimpleStructuredLightScanner.cpp, SimpleTurntable.cpp, and TimedScans.cpp.
virtual ITurntable& david::ClientJsonRpc::turntable ( )
virtual

Returns an interface to the 'Turntable' module.

Returns
Interface class for 'Turntable' functions.

Implements david::IModules.

Examples:
SimpleTurntable.cpp.

The documentation for this class was generated from the following file: