将Java SDK加入本地的maven仓库
sdk
└── lib
├── ag-sdk-biz-74152.tar.gz-20211108.111327-SNAPSHOT.jar
├── ag-sdk-biz-74152.tar.gz-20211108.111327-SNAPSHOT.pom.xml
├── ctg-ag-sdk-core-2.5.0-20211018.013334-41.jar
└── ctg-ag-sdk-core-2.5.0-20211018.013334-41.pom.xml
ag-sdk
依赖于ctg-ag-sdk-core
,所以要先安装ctg-ag-sdk
mvn install:install-file -Dfile=ctg-ag-sdk-core-2.5.0-20211018.013334-41.jar -DpomFile=ctg-ag-sdk-core-2.5.0-20211018.013334-41.pom.xml
mvn org.apache.maven.plugins:maven-install-plugin:2.5.1:install-file -Dfile=ag-sdk-biz-74152.tar.gz-20211108.111327-SNAPSHOT.jar -DpomFile=ag-sdk-biz-ag-sdk-biz-74152.tar.gz-20211108.111327-SNAPSHOT.pom.xml
在工程中引用包
在pom文件中加入
<groupId>com.ctg.ag</groupId>
<artifactId>ctg-ag-sdk-core</artifactId>
<version>2.5.0-SNAPSHOT</version>
<groupId>com.ctg.ag</groupId>
<artifactId>ag-sdk-biz-44137.tar.gz</artifactId>
<version>20201027.162343-SNAPSHOT</version>
注:以上坐标供参考,具体以“lib”目录下的两个pom文件为准。
测试SDK
参考demo目录下的java调用示例
以数据签名为例,appKey即您的App Key,appSecret为对应的App Secret,Appkey和AppSecret的获取请查看相关应用的详情界面。对于具体的请求参数,可以参考doc目录下的md文件。
public void testApiWithSignature() throws Exception {
AepDeviceCommandClient client = AepDeviceCommandClient.newClient().appKey("Your app key here").appSecret("Your app secret here").build();
{
QueryCommandListRequest request = new QueryCommandListRequest();
// request.setParam.. // set your request params here
request.setParamMasterKey("MasterKey");
request.setParamProductId("ProductId");
request.setParamDeviceId("DeviceId");
System.out.println(client.QueryCommandList(request));
}
client.shutdown();
}