接口 RetrofitIotService


  • public interface RetrofitIotService
    注意路径不要加前缀 /,
    另请参阅:
    Retrofit.Builder.baseUrl(HttpUrl)
    • 字段详细资料

      • log

        static final org.slf4j.Logger log
    • 方法详细资料

      • getProduct

        @GET("product")
        retrofit2.Call<Pagec<ProductDTO>> getProduct​(@Query("page")
                                                     int page,
                                                     @Query("size")
                                                     int size)
        获取产品列表

        获取产品列表

        参数:
        page - 当前页,从0开始
        size - 分页大小,最大100,最小1
        返回:
        分页产品
      • createDevice

        @POST("api/device/addDevice")
        retrofit2.Call<DeviceApiDTO> createDevice​(@Body
                                                  DeviceAddReq addReq)
        新增设备

        新增设备

        参数:
        addReq - 产品信息
        返回:
        添加的设备信息
      • getBatchDevices

        @GET("api/device/getBatchDevices/{pk}/{batchName}")
        retrofit2.Call<List<DeviceApiDTO>> getBatchDevices​(@Path("pk")
                                                           String pk,
                                                           @Path("batchName")
                                                           String batchName)
        获取批次下所有设备

        获取批次下所有设备

        参数:
        pk - 产品PK
        batchName - 批次名称
        返回:
        设备列表
      • updateName

        @PUT("api/device/updateName")
        retrofit2.Call<Void> updateName​(@Body
                                        DeviceUpdateNameReq req)
        更改设备名称

        更改设备名称

        参数:
        req - 设备信息(pk,devId,name)
        返回:
      • getDevice

        @GET("api/device/deviceInfo/{pk}/{devId}")
        retrofit2.Call<DeviceApiDTO> getDevice​(@Path("pk")
                                               String pk,
                                               @Path("devId")
                                               String devId)
        查询设备详情

        查询设备详情

        参数:
        pk - 产品PK
        devId - 设备ID
        返回:
        返回设备信息
      • getDeviceStatus

        @POST("api/device/getDeviceStatus")
        retrofit2.Call<List<DeviceStatusRes>> getDeviceStatus​(@Body
                                                              DevIdListReq req)
        批量查询状态

        批量查询状态

        参数:
        req - 设备信息(pk,devId,name)
        返回:
        设备信息列表
      • getLoginToken

        @GET("api/user/getLoginToken")
        retrofit2.Call<LoginRsp> getLoginToken()
        获取鉴权信息

        获取鉴权信息

        返回:
        鉴权信息
      • addDevice

        @POST("api/device/addDevice")
        retrofit2.Call<DeviceApiDTO> addDevice​(@Body
                                               DeviceAddReq reqDto)
        新增设备

        新增设备

        参数:
        reqDto - 设备信息(pk,devId,name)
        返回:
        设备信息
      • batchAddDevices

        @POST("api/device/batchAddDevices")
        retrofit2.Call<Map<String,​Object>> batchAddDevices​(@Body
                                                                 DevIdListReq devIdListReq)
        导入设备

        导入设备

        参数:
        devIdListReq - (产品PK和设备ID列表)
        返回:
        包含批次名称和添加数量
      • getDeviceList

        @GET("api/device/getDeviceList")
        retrofit2.Call<Pagec<DeviceApiDTO>> getDeviceList​(@Query("pk")
                                                          String pk,
                                                          @Query("keyword")
                                                          String keyword,
                                                          @Query("page")
                                                          int page,
                                                          @Query("deviceType")
                                                          DeviceType deviceType,
                                                          @Query("online")
                                                          Boolean online,
                                                          @Query("size")
                                                          int size)
        查询设备列表

        查询设备列表

        参数:
        pk - 产品PK
        keyword - 搜索关键词
        page - 当前页面,最大100,最小1
        deviceType - 节点类型(普通设备:GENERAL;中继设备:SWITCH;网关设备:GATEWAY;终端子设备:TERMINAL)
        online - 是否在线,true为在线
        size - 分页大小,默认10,
        返回:
        设备信息
      • deviceInfo

        @GET("api/device/deviceInfo/{pk}/{devId}")
        retrofit2.Call<DeviceApiDTO> deviceInfo​(@Path("pk")
                                                String pk,
                                                @Path("devId")
                                                String devId)
        查询设备详情

        查询设备详情

        参数:
        pk - 产品PK
        devId - 设备ID
        返回:
        设备信息
      • getDeviceSnapshot

        @GET("api/device/getSnapshot")
        retrofit2.Call<Snapshot> getDeviceSnapshot​(@Query("pk")
                                                   String pk,
                                                   @Query("devId")
                                                   String devId)
        查询设备影子

        查询设备影子

        参数:
        pk - 产品PK
        devId - 设备ID
        返回:
        设备影子
      • delDevice

        @DELETE("api/device/delDevice/{pk}/{devId}")
        retrofit2.Call<Void> delDevice​(@Path("pk")
                                       String pk,
                                       @Path("devId")
                                       String devId,
                                       @Query("delSnapshot")
                                       boolean delSnapshot)
        删除设备

        删除设备

        参数:
        pk - 产品PK
        devId - 设备ID
        delSnapshot - 是否删除设备影子
        返回:
      • getDeviceHistoryData

        @GET("api/device/getDeviceHistoryData/{pk}/{devId}")
        retrofit2.Call<List<DevicePacketResp>> getDeviceHistoryData​(@Path("pk")
                                                                    String pk,
                                                                    @Path("devId")
                                                                    String devId,
                                                                    @Query("startTime")
                                                                    Long startTime,
                                                                    @Query("endTime")
                                                                    Long endTime,
                                                                    @Query("action")
                                                                    String action,
                                                                    @Query("cmd")
                                                                    String cmd,
                                                                    @Query("page")
                                                                    int page,
                                                                    @Query("size")
                                                                    int size)
        查询历史上下行数

        查询历史上下行数

        参数:
        pk - 产品PK
        devId - 设备ID
        startTime - 开始事件
        endTime - 结束事件
        action - 事件
        page - 当前页 从0开始
        size - 分页大小,最大100,最小1
        返回:
        上下行数据信息
      • deviceCloudSend

        @POST("api/device/cloudSend/{pk}/{devId}")
        retrofit2.Call<KlinkResp> deviceCloudSend​(@Path("pk")
                                                  String pk,
                                                  @Path("devId")
                                                  String devId,
                                                  @Body
                                                  ModelData data)
        下发控制命令

        下发控制命令

        参数:
        pk - 产品PK
        devId - 设备ID
        data - (cmd 命令标识符 ,params 参数值)
        返回:
        指令信息
      • cloudSendMsgInfo

        @GET("api/device/cloudSendMsgInfo/{messageId}")
        retrofit2.Call<CloudSendMsgDTO> cloudSendMsgInfo​(@Path("messageId")
                                                         String messageId)
        查询命令状态

        查询命令状态

        参数:
        messageId - 所查询命令的ID
        返回:
        命令信息
      • cloudSendMsgList

        @GET("api/device/cloudSendMsgList")
        retrofit2.Call<Pagec<CloudSendMsgDTO>> cloudSendMsgList​(@Query("page")
                                                                Integer page,
                                                                @Query("size")
                                                                Integer size,
                                                                @Query("pk")
                                                                String pk,
                                                                @Query("devId")
                                                                String devId,
                                                                @Query("startTime")
                                                                Long startTime,
                                                                @Query("endTime")
                                                                Long endTime)
        查询历史控制命令

        查询历史控制命令

        参数:
        page - 当前页面,最小0
        size - 分页大小,最大100,最小0
        pk - 产品PK
        devId - 设备ID
        startTime - 查询开始时间
        endTime - 查询结束事件
        返回:
        命令信息
      • addTopo

        @PUT("api/device/addTopo/{pk}/{devId}")
        retrofit2.Call<AddTopoResp> addTopo​(@Path("pk")
                                            String pk,
                                            @Path("devId")
                                            String devId,
                                            @Body
                                            TopoSub sub)
        网关添加子设备

        网关添加子设备

        参数:
        pk - 产品PK
        devId - 设备ID
        sub - 子设备
        返回:
        添加的子设备信息
      • delTopo

        @PUT("api/device/delTopo/{pk}/{devId}")
        retrofit2.Call<DelTopoResp> delTopo​(@Path("pk")
                                            String pk,
                                            @Path("devId")
                                            String devId,
                                            @Body
                                            TopoSub sub)
        网关删除子设备
        参数:
        pk - 产品PK
        devId - 设备ID
        sub - 子设备
        返回:
        删除的子设备信息