Devices
Defined in dfx/api/DeviceAPI.hpp
Used to manage the DeepAffex Devices endpoint.
CloudConfig config;
auto status = dfx::api::loadCloudConfig(config);
if ( status.OK() ) {
std::shared_ptr<CloudAPI> cloud;
status = CloudAPI::createInstance(config, cloud);
if ( status.OK() ) {
auto service = cloud->device(config);
// List out all devices accessible to your user token
std::vector<Device> devices;
uint16_t totalCount;
status = service->list(config, {}, 0, devices, totalCount);
if ( status.OK() ) {
for (const auto& device : devices) {
std::cout << device.id << std::endl;
}
}
}
}
Create
-
virtual CloudStatus dfx::api::DeviceAPI::create(const CloudConfig &config, const std::string &name, DeviceType type, const std::string &identifier, const std::string &version, Device &device)
Creates a new device reference to associate with measurements. Each device is mapped to a device type ID.
- Parameters
config – provides all the cloud configuration settings
name – a descriptive name to associate with the device
type – the device type
identifier – a UUID identifier for the device
version – version of the device
device – the created device details
- Returns
status of operation, CLOUD_OK on SUCCESS
Retrieve
-
virtual CloudStatus dfx::api::DeviceAPI::list(const CloudConfig &config, const std::unordered_map<DeviceFilter, std::string> &filters, uint16_t offset, std::vector<Device> &devices, int16_t &totalCount)
Retrieves a list of existing devices in an organization.
- Parameters
config – provides all the cloud configuration settings
filters –
offset – to start the retrieval of records up to config.listLimit
devices – list of devices being returned
totalCount – the total number of records on the server
- Returns
status of operation, CLOUD_OK on SUCCESS
-
virtual CloudStatus dfx::api::DeviceAPI::retrieve(const CloudConfig &config, const std::string &deviceID, Device &device)
Retrieves details for a single device based on deviceID.
- Parameters
config – provides all the cloud configuration settings
deviceID – the device ID to retrieve
device – the retrieved device information
- Returns
status of operation, CLOUD_OK on SUCCESS
-
virtual CloudStatus dfx::api::DeviceAPI::retrieveMultiple(const CloudConfig &config, const std::vector<std::string> &deviceIDs, std::vector<Device> &devices)
Retrieves details for multiple devices based on list of device IDs.
- Parameters
config – provides all the cloud configuration settings
deviceIDs – list of device IDs to obtain details for
devices – details for the requested device IDs
- Returns
status of operation, CLOUD_OK on SUCCESS
Update
-
virtual CloudStatus dfx::api::DeviceAPI::update(const CloudConfig &config, const Device &device)
Updates a device details.
- Parameters
config – provides all the cloud configuration settings
device – details to update for the device ID
- Returns
status of operation, CLOUD_OK on SUCCESS
Delete
-
virtual CloudStatus dfx::api::DeviceAPI::remove(const CloudConfig &config, const std::string &deviceID)
Removes a device from the server.
- Parameters
config – provides all the cloud configuration settings
deviceID – the device ID to remove
- Returns
status of operation, CLOUD_OK on SUCCESS