本文整理汇总了Java中cloud.artik.model.Device类的典型用法代码示例。如果您正苦于以下问题:Java Device类的具体用法?Java Device怎么用?Java Device使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Device类属于cloud.artik.model包,在下文中一共展示了Device类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDeviceCall
import cloud.artik.model.Device; //导入依赖的package包/类
private com.squareup.okhttp.Call addDeviceCall(Device device, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = device;
// create path and map variables
String localVarPath = "/devices".replaceAll("\\{format\\}","json");
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "artikcloud_oauth" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
示例2: addDeviceAsync
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Add Device (asynchronously)
* Create a device
* @param device Device to be added to the user (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call addDeviceAsync(Device device, final ApiCallback<DeviceEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = addDeviceValidateBeforeCall(device, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<DeviceEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
示例3: updateDeviceCall
import cloud.artik.model.Device; //导入依赖的package包/类
private com.squareup.okhttp.Call updateDeviceCall(String deviceId, Device device, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = device;
// create path and map variables
String localVarPath = "/devices/{deviceId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "deviceId" + "\\}", apiClient.escapeString(deviceId.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "artikcloud_oauth" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
示例4: updateDeviceAsync
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Update Device (asynchronously)
* Updates a device
* @param deviceId deviceId (required)
* @param device Device to be updated (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call updateDeviceAsync(String deviceId, Device device, final ApiCallback<DeviceEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = updateDeviceValidateBeforeCall(deviceId, device, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<DeviceEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
示例5: updateDeviceTest
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Update Device
*
* Updates a device
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updateDeviceTest() throws ApiException {
String deviceId = null;
Device device = null;
DeviceEnvelope response = api.updateDevice(deviceId, device);
// TODO: test validations
}
示例6: handleDeviceCreationSuccessOnUIThread
import cloud.artik.model.Device; //导入依赖的package包/类
private void handleDeviceCreationSuccessOnUIThread(final Device newDevice) {
this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "ARTIK Cloud device " + newDevice.getId() + "creation succeeded!", Toast.LENGTH_SHORT).show();
mDeviceManager.updateDevices(newDevice); // single device
ArtikCloudSession.getInstance().setDeviceId(newDevice.getId());
startBLEScanActivity();
}
});
}
示例7: updateDevices
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Loads the list of a user's devices
* @param deviceArray
*/
public void updateDevices(DeviceArray deviceArray){
clearCache();
if(deviceArray != null){
for (Device device : deviceArray.getDevices()){
userDevices.add(new ArtikCloudDeviceWrapper(device.getDtid(), device.getId(), device.getName()));
}
}
}
示例8: addDeviceValidateBeforeCall
import cloud.artik.model.Device; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call addDeviceValidateBeforeCall(Device device, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'device' is set
if (device == null) {
throw new ApiException("Missing the required parameter 'device' when calling addDevice(Async)");
}
com.squareup.okhttp.Call call = addDeviceCall(device, progressListener, progressRequestListener);
return call;
}
示例9: updateDeviceValidateBeforeCall
import cloud.artik.model.Device; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call updateDeviceValidateBeforeCall(String deviceId, Device device, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException("Missing the required parameter 'deviceId' when calling updateDevice(Async)");
}
// verify the required parameter 'device' is set
if (device == null) {
throw new ApiException("Missing the required parameter 'device' when calling updateDevice(Async)");
}
com.squareup.okhttp.Call call = updateDeviceCall(deviceId, device, progressListener, progressRequestListener);
return call;
}
示例10: getData
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Get data
* @return data
**/
@ApiModelProperty(example = "null", required = true, value = "")
public Device getData() {
return data;
}
示例11: setData
import cloud.artik.model.Device; //导入依赖的package包/类
public void setData(Device data) {
this.data = data;
}
示例12: addDevicesItem
import cloud.artik.model.Device; //导入依赖的package包/类
public DeviceArray addDevicesItem(Device devicesItem) {
this.devices.add(devicesItem);
return this;
}
示例13: getDevices
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Get devices
* @return devices
**/
@ApiModelProperty(example = "null", value = "")
public List<Device> getDevices() {
return devices;
}
示例14: setDevices
import cloud.artik.model.Device; //导入依赖的package包/类
public void setDevices(List<Device> devices) {
this.devices = devices;
}
示例15: addDeviceTest
import cloud.artik.model.Device; //导入依赖的package包/类
/**
* Add Device
*
* Create a device
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void addDeviceTest() throws ApiException {
Device device = null;
DeviceEnvelope response = api.addDevice(device);
// TODO: test validations
}