From 47308061554779c7c78007bc0a210ec826b7df17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?whalensun=28=E5=AD=99=E4=BC=9F=29?= <532125505@qq.com> Date: Thu, 9 Sep 2021 20:16:00 +0800 Subject: [PATCH 01/41] =?UTF-8?q?=E4=BF=9D=E6=8C=81master=E4=B8=8A?= =?UTF-8?q?=E7=9A=84p2p=E7=89=88=E6=9C=AC=E4=B8=BA2.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I731d90e88ddc2ebcf5e0ca623f522e085cd02baf --- sdk/video-link-android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/video-link-android/build.gradle b/sdk/video-link-android/build.gradle index 68db4455c..80253af5c 100644 --- a/sdk/video-link-android/build.gradle +++ b/sdk/video-link-android/build.gradle @@ -48,7 +48,7 @@ dependencies { // api('com.tencent.iot.thirdparty.android:xp2p-sdk:latest.integration') { // changing = true // } - api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.3.0' + api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.2.0' } configurations.all { From 811e80a901968d06b27ff1d64c543a9f64af1695 Mon Sep 17 00:00:00 2001 From: heyawei <379135467@qq.com> Date: Fri, 10 Sep 2021 16:20:26 +0800 Subject: [PATCH 02/41] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=89=80=E6=9C=89?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81=E4=B8=8D?= =?UTF-8?q?=E4=BC=A0=E5=85=A5=20family?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://tapd.oa.com/NEW_IOT/prong/stories/view/1020393192867671099?code=TOF4TeyJrZXkiOiJ1bjFRQnhqOHYzOVpwNkJlQUhSUTZ2WVhyaTVtN3ZtYiIsImlzcyI6IjEwLjI4LjgzLjE1MCIsImhrIjoiIiwiYXVkIjoidGVnX3RhcGRfYXV0aCIsImhhc2giOiI3RkE2NjhFREFCODI4RkE2MjdGQTIyQUZGOERBQzM2NzY2QjNEQUVGMDhCQzM0NEQ3REJFN0FFQjNENDc2NzA4IiwibmgiOiI0MEY3OTAwODRGQjEyMjZEQUYzMjkxRDQ5MEZGOUE2M0U0NzA4MjNCQzdGODQxRkY3MzZBREQ4MTlBQTVCMDQyIn0 Change-Id: I10b2d79576e59d9bd8ba4b8122996c31d522cf1e --- .../link/core/auth/consts/RequestCode.kt | 2 +- .../core/auth/entity/VirtualBindDevice.kt | 10 +++ .../core/auth/entity/VirtualBindDeviceList.kt | 7 ++ .../link/core/auth/impl/DeviceImpl.kt | 7 +- .../link/core/auth/service/DeviceService.kt | 12 ++++ sdkdemo/src/main/AndroidManifest.xml | 1 + .../core/activity/ShowAllDeviceActivity.kt | 66 +++++++++++++++++++ .../link/demo/core/fragment/DeviceFragment.kt | 5 ++ .../res/layout/activity_show_all_device.xml | 55 ++++++++++++++++ .../src/main/res/layout/fragment_device.xml | 12 ++++ sdkdemo/src/main/res/values/strings.xml | 3 +- 11 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDevice.kt create mode 100644 sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDeviceList.kt create mode 100644 sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/activity/ShowAllDeviceActivity.kt create mode 100644 sdkdemo/src/main/res/layout/activity_show_all_device.xml diff --git a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/consts/RequestCode.kt b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/consts/RequestCode.kt index de69df39e..c687bb0a3 100644 --- a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/consts/RequestCode.kt +++ b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/consts/RequestCode.kt @@ -68,7 +68,7 @@ object RequestCode { const val get_bind_device_token = 3012 const val check_device_bind_token_state = 3013 const val trtc_call_device = 3015 - + const val all_device = 3016 /*************设备接口结束**************/ /*************云端定时接口开始**************/ diff --git a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDevice.kt b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDevice.kt new file mode 100644 index 000000000..38e5ea78e --- /dev/null +++ b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDevice.kt @@ -0,0 +1,10 @@ +package com.tencent.iot.explorer.link.core.auth.entity + +class VirtualBindDevice { + + var userId = "" + var productId = "" + var deviceName = "" + var deviceId = "" + var platformId = "" +} \ No newline at end of file diff --git a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDeviceList.kt b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDeviceList.kt new file mode 100644 index 000000000..15adf23f0 --- /dev/null +++ b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/entity/VirtualBindDeviceList.kt @@ -0,0 +1,7 @@ +package com.tencent.iot.explorer.link.core.auth.entity + +class VirtualBindDeviceList { + var requestId = "" + var totalCount = 0 + var virtualBindDeviceList: MutableList = ArrayList() +} \ No newline at end of file diff --git a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/impl/DeviceImpl.kt b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/impl/DeviceImpl.kt index c168cade9..48881e87e 100644 --- a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/impl/DeviceImpl.kt +++ b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/impl/DeviceImpl.kt @@ -140,4 +140,9 @@ interface DeviceImpl { */ fun trtcCallDevice(deviceId: String, callback: MyCallback) -} \ No newline at end of file + /** + * 获取所有设备 + */ + fun allDevices(token: String, platformId: String, offset: Int, limit: Int, callback: MyCallback) + + } \ No newline at end of file diff --git a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/service/DeviceService.kt b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/service/DeviceService.kt index 424077322..44ae8c918 100644 --- a/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/service/DeviceService.kt +++ b/sdk/explorer-link-android/src/main/java/com/tencent/iot/explorer/link/core/auth/service/DeviceService.kt @@ -147,6 +147,18 @@ internal class DeviceService : BaseService(), DeviceImpl { }) } + /** + * 获取所有设备 + */ + override fun allDevices(token: String, platformId: String, offset: Int, limit: Int, callback: MyCallback) { + val param = tokenParams("AppGetVirtualBindDeviceList") + param["BindPlatformId"] = platformId + param["Offset"] = offset + param["Limit"] = limit + param["AccessToken"] = token + tokenPost(param, callback, RequestCode.all_device) + } + /** * 获取设备在线状态 */ diff --git a/sdkdemo/src/main/AndroidManifest.xml b/sdkdemo/src/main/AndroidManifest.xml index ef1620df1..35f0a5a05 100644 --- a/sdkdemo/src/main/AndroidManifest.xml +++ b/sdkdemo/src/main/AndroidManifest.xml @@ -51,6 +51,7 @@ + diff --git a/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/activity/ShowAllDeviceActivity.kt b/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/activity/ShowAllDeviceActivity.kt new file mode 100644 index 000000000..9ff9eca87 --- /dev/null +++ b/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/activity/ShowAllDeviceActivity.kt @@ -0,0 +1,66 @@ +package com.tencent.iot.explorer.link.demo.core.activity + +import android.text.TextUtils +import android.widget.Toast +import com.alibaba.fastjson.JSON +import com.tencent.iot.explorer.link.core.auth.IoTAuth +import com.tencent.iot.explorer.link.core.auth.callback.MyCallback +import com.tencent.iot.explorer.link.core.auth.entity.VirtualBindDeviceList +import com.tencent.iot.explorer.link.core.auth.response.BaseResponse +import com.tencent.iot.explorer.link.demo.BaseActivity +import com.tencent.iot.explorer.link.demo.R +import com.tencent.iot.explorer.link.demo.common.log.L +import kotlinx.android.synthetic.main.activity_show_all_device.* +import kotlinx.android.synthetic.main.menu_back_layout.* + +class ShowAllDeviceActivity : BaseActivity(), MyCallback { + override fun getContentView(): Int { + return R.layout.activity_show_all_device + } + + override fun initView() { + tv_title.text = getString(R.string.show_all_device) + } + + override fun setListener() { + iv_back.setOnClickListener { finish() } + btn_search.setOnClickListener { + tv_all_devices.text = "" + var token = IoTAuth.user.Token + var platformId = ev_platformId_2_search.text.toString() + if (!TextUtils.isEmpty(ev_token_2_search.text.toString())) { + token = ev_token_2_search.text.toString() + } + + IoTAuth.deviceImpl.allDevices(token, platformId, 0, 99, this) + } + } + + override fun fail(msg: String?, reqCode: Int) { + L.e(msg ?: "") + } + + override fun success(response: BaseResponse, reqCode: Int) { + + runOnUiThread { + if (response.code == 0) { + var virtualBindDeviceList = JSON.parseObject(response.data.toString(), VirtualBindDeviceList::class.java) + virtualBindDeviceList?.let { + if (it.totalCount <= 0) { + Toast.makeText(this@ShowAllDeviceActivity, R.string.no_devices, Toast.LENGTH_SHORT).show() + return@let + } + var content2Show = "" + + if (it.virtualBindDeviceList.size <= 0) return@let + for (item in it.virtualBindDeviceList) { + content2Show += item.deviceName + "\n" + } + tv_all_devices.text = content2Show + } + } else { + Toast.makeText(this@ShowAllDeviceActivity, response?.msg, Toast.LENGTH_SHORT).show() + } + } + } +} diff --git a/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/fragment/DeviceFragment.kt b/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/fragment/DeviceFragment.kt index cafc4fbb3..5803a180d 100644 --- a/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/fragment/DeviceFragment.kt +++ b/sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/core/fragment/DeviceFragment.kt @@ -1,5 +1,6 @@ package com.tencent.iot.explorer.link.demo.core.fragment +import android.content.Intent import android.util.Log import android.view.View import androidx.recyclerview.widget.LinearLayoutManager @@ -22,6 +23,7 @@ import com.tencent.iot.explorer.link.demo.core.activity.ControlPanelActivity import com.tencent.iot.explorer.link.demo.core.adapter.OnItemListener import com.tencent.iot.explorer.link.demo.core.holder.BaseHolder import com.tencent.iot.explorer.link.demo.common.customView.MyDivider +import com.tencent.iot.explorer.link.demo.core.activity.ShowAllDeviceActivity import kotlinx.android.synthetic.main.fragment_device.* class DeviceFragment : BaseFragment(), MyCallback { @@ -60,6 +62,9 @@ class DeviceFragment : BaseFragment(), MyCallback { } private fun setListener() { + tv_show_all_device.setOnClickListener { + jumpActivity(ShowAllDeviceActivity::class.java) + } tv_add_device.setOnClickListener { jumpActivity(AddDeviceActivity::class.java) } diff --git a/sdkdemo/src/main/res/layout/activity_show_all_device.xml b/sdkdemo/src/main/res/layout/activity_show_all_device.xml new file mode 100644 index 000000000..7f6114088 --- /dev/null +++ b/sdkdemo/src/main/res/layout/activity_show_all_device.xml @@ -0,0 +1,55 @@ + + + + + + + + + + +