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
DirectlyConnectedDevice.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This software is dual-licensed to you under the MIT License (MIT) and
5  * the Universal Permissive License (UPL). See the LICENSE file in the root
6  * directory for license terms. You may choose either license, or both.
7  */
8 
9 #pragma once
10 
11 #include <string>
12 #include <initializer_list>
13 #include <vector>
14 #include <stdexcept>
15 #include <DeviceModel.hpp>
16 #include <VirtualDevice.hpp>
17 #include <StorageObject.hpp>
18 #include <Exception.hpp>
19 
29 namespace iotdcl {
31  public:
32 
41  DirectlyConnectedDevice(const std::string &filePath, const std::string &password) throw (GeneralException, std::invalid_argument);
42 
46  virtual ~DirectlyConnectedDevice();
47 
56  const std::string& getEndpointId() const;
57 
63  bool isActivated();
64 
79  void activate(const std::initializer_list<std::string> &deviceModelUrls) throw (GeneralException, CanNotAuthorizeException, std::invalid_argument);
80 
92  DeviceModel& getDeviceModel(const std::string &deviceModelUrl) throw (GeneralException, CanNotAuthorizeException, std::invalid_argument);
93 
104  StorageObject& createStorageObject(const std::string &name, const std::string &contentType) throw (GeneralException, CanNotAuthorizeException);
105 
115 
128  VirtualDevice& createVirtualDevice(const std::string &endpointId, DeviceModel &model) throw (GeneralException, CanNotAuthorizeException, std::invalid_argument);
129  private:
130  std::string endpointId;
131  std::vector<DeviceModel*> dm_list;
132  std::vector<VirtualDevice*> vd_list;
133  std::vector<StorageObject*> eo_list;
134  DirectlyConnectedDevice(const DirectlyConnectedDevice&); // no implementation
135  DirectlyConnectedDevice& operator=(const DirectlyConnectedDevice&); // no implementation
136  };
137 };
bool isActivated()
Returns whether the device has been activated.
virtual ~DirectlyConnectedDevice()
Destructor.
DeviceModel & getDeviceModel(const std::string &deviceModelUrl)
Get the DeviceModel for the device model urn.
Definition: DirectlyConnectedDevice.hpp:30
VirtualDevice for a device-client adds methods to handle write-only and executable actions...
const std::string & getEndpointId() const
Return the endpoint identifier of this directly-connected device.
Common exception.
Definition: Exception.hpp:34
void activate(const std::initializer_list< std::string > &deviceModelUrls)
Activate the device.
VirtualDevice & createVirtualDevice(const std::string &endpointId, DeviceModel &model)
Create a iotcs::AbstractVirtualDevice instance with the given device model for the given device ident...
Detailed information on a device model.
Definition: DeviceModel.hpp:19
Definition: VirtualDevice.hpp:38
Thrown on problems with authorization.
Definition: Exception.hpp:25
DirectlyConnectedDevice(const std::string &filePath, const std::string &password)
Constructs a new DirectlyConnectedDevice instance that will load the device configuration from the gi...
iotdcl::StorageObject provides information about content in the cloud storage.
StorageObject & createStorageObject(const std::string &name, const std::string &contentType)
Create a new iotdcl::StorageObject with the given object name and mime–type.
Definition: StorageObject.hpp:158