当前位置: 首页>>代码示例>>Java>>正文


Java Device类代码示例

本文整理汇总了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);
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:40,代码来源:DevicesApi.java

示例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;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:35,代码来源:DevicesApi.java

示例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);
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:41,代码来源:DevicesApi.java

示例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;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:36,代码来源:DevicesApi.java

示例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
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:17,代码来源:DevicesApiTest.java

示例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();
        }
    });
}
 
开发者ID:artikcloud,项目名称:sample-android-ble,代码行数:12,代码来源:ArtikCloudDeviceActivity.java

示例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()));
        }
    }
}
 
开发者ID:artikcloud,项目名称:sample-android-ble,代码行数:13,代码来源:ArtikCloudDeviceManager.java

示例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;

    
    
    
    
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:18,代码来源:DevicesApi.java

示例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;

    
    
    
    
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:23,代码来源:DevicesApi.java

示例10: getData

import cloud.artik.model.Device; //导入依赖的package包/类
/**
 * Get data
 * @return data
**/
@ApiModelProperty(example = "null", required = true, value = "")
public Device getData() {
  return data;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:9,代码来源:DeviceEnvelope.java

示例11: setData

import cloud.artik.model.Device; //导入依赖的package包/类
public void setData(Device data) {
  this.data = data;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:4,代码来源:DeviceEnvelope.java

示例12: addDevicesItem

import cloud.artik.model.Device; //导入依赖的package包/类
public DeviceArray addDevicesItem(Device devicesItem) {
  this.devices.add(devicesItem);
  return this;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:5,代码来源:DeviceArray.java

示例13: getDevices

import cloud.artik.model.Device; //导入依赖的package包/类
/**
 * Get devices
 * @return devices
**/
@ApiModelProperty(example = "null", value = "")
public List<Device> getDevices() {
  return devices;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:9,代码来源:DeviceArray.java

示例14: setDevices

import cloud.artik.model.Device; //导入依赖的package包/类
public void setDevices(List<Device> devices) {
  this.devices = devices;
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:4,代码来源:DeviceArray.java

示例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
}
 
开发者ID:artikcloud,项目名称:artikcloud-java,代码行数:16,代码来源:DevicesApiTest.java


注:本文中的cloud.artik.model.Device类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。