|
|
|
@ -1,13 +1,18 @@
|
|
|
|
|
package com.yinuo.safetywatcher.watcher.net
|
|
|
|
|
package com.yinuo.safetywatcher.watcher.net.api
|
|
|
|
|
|
|
|
|
|
import com.common.commonlib.net.BaseObserve
|
|
|
|
|
import com.common.commonlib.net.bean.BaseResponse
|
|
|
|
|
import com.common.commonlib.net.callback.RequestNoResultCallBack
|
|
|
|
|
import com.common.commonlib.net.callback.RequestResultCallBack
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.bean.GetRtspUrlResponse
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.bean.GasReqBean
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.bean.TrafficReqInfo
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.net.GasRequest
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.net.GetRtspUrlResponse
|
|
|
|
|
import io.reactivex.rxjava3.core.Observable
|
|
|
|
|
import retrofit2.http.Body
|
|
|
|
|
import retrofit2.http.GET
|
|
|
|
|
import retrofit2.http.Headers
|
|
|
|
|
import retrofit2.http.POST
|
|
|
|
|
import retrofit2.http.Query
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -29,6 +34,16 @@ class DevicesApi : BaseObserve<DevicesApi.Api>(Api::class.java) {
|
|
|
|
|
observe(api.getPushUrl(sn), callBack)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun updateTrafficInfo() {
|
|
|
|
|
val trafficReqInfo = TrafficReqInfo()
|
|
|
|
|
observe(api.updateTrafficInfo(trafficReqInfo), null)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun uploadGasData(gasList: List<GasReqBean> = emptyList()) {
|
|
|
|
|
val gasReq = GasRequest(detections = gasList)
|
|
|
|
|
observe(api.uploadGasData(gasReq), null)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Api {
|
|
|
|
|
@Headers("baseurl:host")
|
|
|
|
@ -39,5 +54,13 @@ class DevicesApi : BaseObserve<DevicesApi.Api>(Api::class.java) {
|
|
|
|
|
@Headers("baseurl:host")
|
|
|
|
|
@GET("/api/device/getRtspUrl")
|
|
|
|
|
fun getPushUrl(@Query("deviceSn") sn: String): Observable<GetRtspUrlResponse>
|
|
|
|
|
|
|
|
|
|
@Headers("baseurl:host")
|
|
|
|
|
@POST("/api/device/pushFlow")
|
|
|
|
|
fun updateTrafficInfo(@Body body: TrafficReqInfo): Observable<BaseResponse>
|
|
|
|
|
|
|
|
|
|
@Headers("baseurl:host")
|
|
|
|
|
@POST("/api/device/addDetection")
|
|
|
|
|
fun uploadGasData(@Body body: GasRequest): Observable<BaseResponse>
|
|
|
|
|
}
|
|
|
|
|
}
|