1 package iotruntime.brillo;
4 import com.google.api.client.json.jackson2.JacksonFactory;
5 import com.google.api.services.clouddevices.CloudDevices;
6 import com.google.api.services.clouddevices.model.Device;
8 import java.rmi.Remote;
9 import java.rmi.RemoteException;
11 /** Abstract class IoTBrilloWeave that is the base of all
12 * Brillo/Weave-communication-based class
14 * @author Rahmadi Trimananda <rtrimana @ uci.edu>
18 public abstract class IoTBrilloWeave implements Remote {
21 * Class IoTBrilloWeave properties
23 protected IoTBrilloWeaveCloudConnection iotCloudConnection;
24 protected CloudDevices apiClient;
25 protected Device device;
28 * Class IoTBrilloWeave constants
30 protected final JacksonFactory jsonFactory = new JacksonFactory();
33 * Class IoTBrilloWeave constructor
35 protected IoTBrilloWeave(String _clientId, String _clientSecret, String _apiKey, String _deviceId) {
37 iotCloudConnection = new IoTBrilloWeaveCloudConnection(_clientId, _clientSecret, _apiKey);
38 iotCloudConnection.connectionSetup(_deviceId);
39 apiClient = iotCloudConnection.getApiClientObject();
40 device = iotCloudConnection.getDeviceObject();
44 * setAuthScope() method to set authentication scope
48 protected void setAuthScope(String _authScopeAddress) {
49 iotCloudConnection.setAuthScope(_authScopeAddress);