|
@@ -1,53 +0,0 @@
|
|
|
-package com.fjhx.test;
|
|
|
-
|
|
|
-
|
|
|
-import com.fjhx.IoTDA.IoTDAConfig;
|
|
|
-import com.fjhx.IoTDA.IoTDAUtil;
|
|
|
-import com.huaweicloud.sdk.core.exception.ConnectionException;
|
|
|
-import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
|
|
|
-import com.huaweicloud.sdk.core.exception.ServiceResponseException;
|
|
|
-import com.huaweicloud.sdk.iotda.v5.IoTDAClient;
|
|
|
-import com.huaweicloud.sdk.iotda.v5.model.*;
|
|
|
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
-
|
|
|
-import java.util.Collections;
|
|
|
-
|
|
|
-public class ListDevicesSolution {
|
|
|
-
|
|
|
- private static final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(IoTDAConfig.class);
|
|
|
- private static final IoTDAClient client = applicationContext.getBean(IoTDAClient.class);
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
-
|
|
|
- try {
|
|
|
-
|
|
|
- ShowApplicationsRequest showApplicationsRequest = new ShowApplicationsRequest();
|
|
|
- System.out.println(client.showApplications(showApplicationsRequest));
|
|
|
- System.out.println("========================================================");
|
|
|
-
|
|
|
- ListProductsRequest listProductsRequest = new ListProductsRequest();
|
|
|
- listProductsRequest.setAppId("fa74090e9e534511b65545a456f4bf2f");
|
|
|
- System.out.println(client.listProducts(listProductsRequest));
|
|
|
- System.out.println("========================================================");
|
|
|
-
|
|
|
-
|
|
|
- ListDevicesRequest listDevicesRequest = new ListDevicesRequest();
|
|
|
- listDevicesRequest.setProductId("62d4ff516b9813541d51f893");
|
|
|
- ListDevicesResponse listDevicesResponse = client.listDevices(listDevicesRequest);
|
|
|
- System.out.println(listDevicesResponse);
|
|
|
- System.out.println("========================================================");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- } catch (ConnectionException | RequestTimeoutException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (ServiceResponseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- System.out.println(e.getHttpStatusCode());
|
|
|
- System.out.println(e.getErrorCode());
|
|
|
- System.out.println(e.getErrorMsg());
|
|
|
- }
|
|
|
- }
|
|
|
-}
|