CPP Device Virtualization API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E92477-09
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
iotdcl::DirectlyConnectedDevice Class Reference
+ Inheritance diagram for iotdcl::DirectlyConnectedDevice:

Public Member Functions

 DirectlyConnectedDevice (const std::string &filePath, const std::string &password) throw (GeneralException, std::invalid_argument)
 Constructs a new DirectlyConnectedDevice instance that will load the device configuration from the given file path and password. More...
 
virtual ~DirectlyConnectedDevice ()
 Destructor.
 
const std::string & getEndpointId () const
 Return the endpoint identifier of this directly-connected device. More...
 
bool isActivated ()
 Returns whether the device has been activated. More...
 
void activate (const std::initializer_list< std::string > &deviceModelUrls) throw (GeneralException, CanNotAuthorizeException, std::invalid_argument)
 Activate the device. More...
 
DeviceModelgetDeviceModel (const std::string &deviceModelUrl) throw (GeneralException, CanNotAuthorizeException, std::invalid_argument)
 Get the DeviceModel for the device model urn. More...
 
StorageObjectcreateStorageObject (const std::string &name, const std::string &contentType) throw (GeneralException, CanNotAuthorizeException)
 Create a new iotdcl::StorageObject with the given object name and mime–type. More...
 
StorageObjectcreateStorageObject (const std::string &uri) throw (GeneralException, CanNotAuthorizeException)
 Create a new iotdcl::StorageObject from the URI for a named object in storage. More...
 
VirtualDevicecreateVirtualDevice (const std::string &endpointId, DeviceModel &model) throw (GeneralException, CanNotAuthorizeException, std::invalid_argument)
 Create a iotcs::AbstractVirtualDevice instance with the given device model for the given device identifier. More...
 

Constructor & Destructor Documentation

iotdcl::DirectlyConnectedDevice::DirectlyConnectedDevice ( const std::string &  filePath,
const std::string &  password 
)
throw (GeneralException,
std::invalid_argument
)

Constructs a new DirectlyConnectedDevice instance that will load the device configuration from the given file path and password.

Parameters
filePaththe path of the configuration file
passwordthe configuration file password
Exceptions
std::invalid_argumentif filePath or password is NULL.
GeneralExceptionotherwise.

Member Function Documentation

void iotdcl::DirectlyConnectedDevice::activate ( const std::initializer_list< std::string > &  deviceModelUrls)
throw (GeneralException,
CanNotAuthorizeException,
std::invalid_argument
)

Activate the device.

The device will be activated on the server if necessary. When the device is activated on the server, the server assigns an endpoint identifier to the device.

The user should call the isActivated() method prior to calling activate.

Parameters
deviceModelUrlsshould contain the device model type URNs of this directly connected device. The device is activated with the given device models.
See Also
isActivated()
Exceptions
std::invalid_argumentif device_models is NULL.
CanNotAuthorizeExceptionif there are problems with authorization.
GeneralExceptionotherwise.
StorageObject& iotdcl::DirectlyConnectedDevice::createStorageObject ( const std::string &  name,
const std::string &  contentType 
)
throw (GeneralException,
CanNotAuthorizeException
)

Create a new iotdcl::StorageObject with the given object name and mime–type.

If contentType is NULL, the mime–type defaults to "application/octet&ndash;stream".

Parameters
namethe unique name to be used to reference the content in storage
contentTypeThe mime-type of the content
Returns
a StorageObject
Exceptions
iotdcl::GeneralExceptionif there is an error raised by the runtime, or an abnormal response from the storage cloud
iotdcl::CanNotAuthorizeExceptionif there is an exception establishing a secure connection to the storage cloud
StorageObject& iotdcl::DirectlyConnectedDevice::createStorageObject ( const std::string &  uri)
throw (GeneralException,
CanNotAuthorizeException
)

Create a new iotdcl::StorageObject from the URI for a named object in storage.

Parameters
urithe URI of the object in the storage cloud
Returns
a reference to StorageObject for the object in storage
Exceptions
iotdcl::GeneralExceptionif there is an error raised by the runtime, or an abnormal response from the storage cloud
iotdcl::CanNotAuthorizeExceptionif there is an exception establishing a secure connection to the storage cloud
VirtualDevice& iotdcl::DirectlyConnectedDevice::createVirtualDevice ( const std::string &  endpointId,
DeviceModel model 
)
throw (GeneralException,
CanNotAuthorizeException,
std::invalid_argument
)

Create a iotcs::AbstractVirtualDevice instance with the given device model for the given device identifier.

This method creates a new

VirtualDevice

instance for the given parameters. The client library does not cache previously created VirtualDevice objects.

Parameters
endpointIdThe device identifier of the device being modeled
modelThe device model URN that this device implements
Returns
a new AbstractVirtualDevice
Exceptions
std::invalid_argumentif device_models is NULL or endpointId is invalid.
CanNotAuthorizeExceptionif there are problems with authorization.
GeneralExceptionotherwise.
DeviceModel& iotdcl::DirectlyConnectedDevice::getDeviceModel ( const std::string &  deviceModelUrl)
throw (GeneralException,
CanNotAuthorizeException,
std::invalid_argument
)

Get the DeviceModel for the device model urn.

Parameters
deviceModelUrlthe URN of the device model
Returns
A representation of the device model
Exceptions
std::invalid_argumentif device_models is NULL.
CanNotAuthorizeExceptionif there are problems with authorization.
GeneralExceptionotherwise.
std::invalid_argumentif device_models is NULL.
CanNotAuthorizeExceptionif there are problems with authorization.
GeneralExceptionotherwise.
const std::string& iotdcl::DirectlyConnectedDevice::getEndpointId ( ) const

Return the endpoint identifier of this directly-connected device.

The endpoint identifier is assigned by the server as part of the activation process.

Returns
the endpoint identifier of this directly-connected device.
See Also
activate()
bool iotdcl::DirectlyConnectedDevice::isActivated ( )

Returns whether the device has been activated.

Returns
whether the device has been activated.

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