更新时间:2024-05-07 08:47:30下载pdf
智能摄像机 (IPC) UI 业务包是基于 涂鸦 IPC SDK 开发的一系列摄像机功能相关的面板 SDK。主要包括以下功能:
参考 框架接入 完成接入 UI 业务包框架。
在模块 build.gradle 中配置 dependencies 依赖。
dependencies{
    api ("com.thingclips.smart:thingsmart-bizbundle-camera:2.0.0-cube.2"){
        exclude group: 'com.thingclips.smart', module: 'thingsmart-ipc-camera-sdk-api'
        exclude group: 'com.thingclips.smart', module: 'thingsmart-ipc-camera-base'
        exclude group: 'com.thingclips.smart', module: 'thingsmart-ipc-yuv-monitor'
        exclude group: 'com.thingclips.smart', module: 'thingsmart-p2p-sdk'
        exclude group: 'com.thingclips.smart', module: 'thingsmart-video-codec-sdk'
        exclude group: 'com.thingclips.smart', module: 'thingsmart-p2p-sdk-api'
    }
   api 'com.thingclips.smart:thingsmart-ipcsdk:2.0.0-cube.3'
    //... 其他配置
}
智能摄像机 (IPC) UI 业务包是涂鸦摄像机各面板的调用对外暴露的接口,包含多个面板的跳转及自定义实现。您可以参考 GitHub ui-bizbundle-sample 下 IPC 部分流程,配置成功摄像头,进行摄像头面板相关操作。
摄像机原生预览面板,包括视频实时预览、清晰度切换、声音开关控制、截图、录制、对讲、移动侦测、PTZ 方向控制、收藏点添加/删除、巡航控制等功能。
接口说明
面板通过路由进行跳转,路由地址为 camera_panel_2。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID,您可以通过家庭的设备列表查询设备 ID | 
示例代码
  Bundle bundle = new Bundle();
  bundle.putString("extra_camera_uuid", devId);
  UrlBuilder urlBuilder = new UrlBuilder(context, "camera_panel_2").putExtras(bundle);
  UrlRouter.execute(urlBuilder);
实现摄像机 RN(React Native)预览面板前,您需要先集成 设备控制 UI 业务包。
接口说明
通过服务化接口 AbsPanelCallerService.goPanelWithCheckAndTip() 可跳转到 RN 面板。
AbsPanelCallerService service = MicroContext.getServiceManager().findServiceByInterface(AbsPanelCallerService.class.getName());
 service.goPanelWithCheckAndTip(IPCPanelActivity.this, bean.getDevId());
摄像机回放面板,展示的是保存在摄像机存储设备上的视频。包括视频回放、回放日期选择、视频随时间轴拖动播放、播放/暂停、声音控制、截图、录制等功能。
接口说明
面板通过路由进行跳转,路由地址为 camera_playback_panel。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID | 
| destroyCamera | 退出回放页面时,是否执行断开连接,默认为 false | 
示例代码
Bundle bundle = new Bundle();
bundle.putExtra("extra_camera_uuid", deviceId);
UrlBuilder urlBuilder = new UrlBuilder(context,"camera_playback_panel").putExtras(bundle);
UrlRouter.execute(urlBuilder);
摄像机云存储面板,展示开通云存储功能之后录制保存的云端视频。包括视频云存储播放、云存储日期选择、视频随时间轴拖动播放、播放/暂停、声音控制、截图、录制等功能,移动侦测数据列表展示。
接口说明
面板通过路由进行跳转,路由地址为 camera_cloud_panel。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID | 
| extra_position | 云存储最近一天的某条移动侦测片段数据的时间戳,单位为秒,该参数可不传 | 
示例代码
Bundle bundle = new Bundle();
bundle.putExtra("extra_camera_uuid", deviceId);
UrlBuilder urlBuilder = new UrlBuilder(context,"camera_cloud_panel").putExtras(bundle);
UrlRouter.execute(urlBuilder);
摄像机消息中心面板,包括摄像机录制过程中产生的各类消息。按日期,消息类型进行展示。消息类别支持图片、视频、纯音频等,可进行预览及单条删除,全部删除操作。
接口说明
面板通过路由进行跳转,路由地址为 camera_message_panel。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID | 
| extra_album_theme | 主题色 | 
示例代码
Bundle bundle = new Bundle();
bundle.putExtra("extra_camera_uuid", deviceId);
UrlBuilder urlBuilder = new UrlBuilder(context,"camera_message_panel").putExtras(bundle);
UrlRouter.execute(urlBuilder);
摄像机相册面板,展示的是根据设备 ID 所保存文件。这些文件是在摄像机预览、回放、云视频播放过程中生成的本地截图和录制视频。可进行预览、单条删除、全部删除等操作。
接口说明
面板通过路由进行跳转,路由地址为 ipc_album_panel。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID | 
示例代码
Bundle bundle = new Bundle();
bundle.putExtra("extra_camera_uuid", deviceId);
UrlBuilder urlBuilder = new UrlBuilder(context,"ipc_album_panel").putExtras(bundle);
UrlRouter.execute(urlBuilder);
摄像机门铃呼叫接听面板,显示推送过来的门铃消息界面。包括门铃基本信息、实时截图、接听和挂断功能。接听成功后会进入摄像机预览面板。
接口说明
面板通过路由进行跳转,路由地址为 camera_door_bell。
参数说明
| 参数 | 说明 | 
|---|---|
| devId | 设备 ID,一般通过推送过来的消息中提取 | 
示例代码
Bundle bundle = new Bundle();
bundle.putString("devId", deviceId);
UrlBuilder urlBuilder = new UrlBuilder(MicroContext.getApplication(), "camera_door_bell").putExtras(bundle);
UrlRouter.execute(urlBuilder);
摄像机视频流门铃接听面板,显示推送过来的实时视频流门铃消息界面。包括门铃状态信息、接听、挂断功能。门铃接听有时效性,停留时间小于 25 秒,接听成功后进行实时视频通话。
接口说明
面板通过路由进行跳转,路由地址为 camera_action_doorbell。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID,一般通过推送过来的消息中提取 | 
| doorbell_start_time | long 类型参数,表示按下门铃的开始时间,门铃接听面板从按下开始计时,停留时长为 25 秒,实际上会小于 25 秒 | 
示例代码
Bundle bundle = new Bundle();
bundle.putString("extra_camera_uuid", deviceId);
bundle.putLong("doorbell_start_time", startTime);
UrlBuilder urlBuilder = new UrlBuilder(MicroContext.getApplication(),  "camera_action_doorbell").putExtras(bundle);
UrlRouter.execute(urlBuilder);
摄像机设置面板,可通过 DP 配置展示,详情请参考 IPC SDK。主要包含:
接口说明
面板通过路由进行跳转,路由地址为 camera_panel_more。
参数说明
| 参数 | 说明 | 
|---|---|
| extra_camera_uuid | 设备 ID | 
示例代码
Bundle bundle = new Bundle();
bundle.putString("extra_camera_uuid", deviceId);
UrlBuilder urlBuilder = new UrlBuilder(context, panel).putExtras(bundle);
UrlRouter.execute(urlBuilder);
如果发现配置路由进不了设置页面,请联系您对应的涂鸦客户经理或者 提交工单,确认下是否是新设置面板。
主题包括黑色和白色两种,支持涂鸦智能摄像头的回放、云存储、消息中心、设置和本地相册。
接口说明
您可通过 CameraUIThemeUtils.setCurrentThemeId(@ThemeIDs int themeIDs) 方法来设置主题。
CameraUIThemeUtils.setCurrentThemeId(@ThemeIDs int themeIDs);
参数说明
| 参数 | 说明 | 
|---|---|
| themeId | 主题色 ID 
  | 
示例代码
CameraUIThemeUtils.setCurrentThemeId(Constants.BLACK_THEME_ID);
面板进入时调用,设置了影响全局。不支持预览面板。
智能摄像机 (IPC) UI 业务包支持自定义配置面板。如果您自行实现面板功能,可参考 IPC SDK。
UI 业务包已集成 SDK,参考 SDK 文档开发时,版本应与业务包对齐。
实现方式
进入 app 的 assets 文件夹,找到服务化配置文件 module_app.json,找到要拦截的路由地址进行删除,捕获已删除路由进行自定义跳转。例如,要自定义实现设置页面:
找到设置的路由地址 camera_panel_more,进行删除。
参考 框架接入,获取未实现路由地址跳转对应页面。
ThingWrapper.init(this, new RouteEventListener() {
        @Override
        public void onFaild(int errorCode, UrlBuilder urlBuilder) {
            // 路由原始地址 urlBuilder.originUrl
            ToastUtil.shortToast(ThingPanelSDK.getCurrentActivity(), urlBuilder.originUrl);
        }
    },new ServiceEventListener() {
            @Override
            public void onFaild(String serviceName) {
                Log.e("service not implement", serviceName);
            }
    });
路由 target | 
功能 | 
|---|---|
| camera_panel_2 | 黑色预览面板 | 
| camera_playback_panel | 回放面板 | 
| camera_cloud_panel | 云存储面板 | 
| camera_message_panel | 消息中心面板 | 
| camera_door_bell | 门铃来电接听面板 | 
| doorbell_camera_panel | 门铃预览面板 | 
| doorbell_camera_playback_panel | 门铃回放面板 | 
| camera_action_doorbell | 直供电门铃接听面板 | 
| camera_panel_more | 设置面板 | 
| dev_base_info | 设置 > 修改设备名称 | 
| camera_panel_info | 设置 > 设备信息功能 | 
| ipc_alarm_detected_feature_list | 设置 > 移动侦测设置 | 
| dev_share_edit | 设置 > 设备分享,暂不支持 | 
| not_share_support_help | 设置 > 共享帮助,暂不支持 | 
暂不支持分享。对于设备分享(dev_share_edit)和共享帮助(not_share_support_help),您可以拦截路由自行实现,或者参考设置页面配置将该功能移除。
接口说明
调用智能生活 App SDK 的 renameDevice() 接口进行设备名称的修改。
ThingHomeSdk.newDeviceInstance(deviceId).renameDevice(String deviceName, IResultCallback callback);
参数说明
| 参数 | 说明 | 
|---|---|
| deviceId | 设备 ID | 
| deviceName | 设备重命名的名称 | 
| callback | IResultCallback 接口,设备重命名成功或失败的回调 | 
示例代码
/**
* 修改设备名称
* @param context
* @param deviceId      设备 ID
* @param deviceName    设备重命名名称
*/
public void renameDevice(final Context context, String deviceId, String deviceName) {
    IThingDevice mDevice = ThingHomeSdk.newDeviceInstance(deviceId);
    mDevice.renameDevice(deviceName, new IResultCallback() {
        @Override
        public void onError(String code, String error) {
        }
        @Override
        public void onSuccess() {
        }
    });
}
接口说明
调用智能生活 App SDK 的 modifyDeviceImg() 接口进行设备图标的修改。
DeviceInfoRepository deviceInfoRepository = new DeviceInfoRepositoryImpl(context);
ModifyDevInfoInteractor mModifyDevInfoInteractor = new ModifyDevInfoInteractorImpl(deviceInfoRepository);
mModifyDevInfoInteractor.modifyDeviceImg( deviceId, deviceName, imageFile, callback);
参数说明
| 参数 | 说明 | 
|---|---|
| deviceId | 设备 ID | 
| imageFile | 文件类型,表示待上传的图片文件 | 
| deviceName | 设备名称,通过智能生活 App SDK 的 DeviceBean 查询 | 
| callback | ModifyDevInfoInteractor.ModifyDeviceImgCallback 接口的回调,上传的图片文件成功或失败的回调 | 
示例代码
/**
* 修改设备头像
*
* @param context
* @param deviceId     设备 ID
* @param iconFilePath 待上传的设备头像地址
*/
public void uploadIcon(final Context context, String deviceId, String iconFilePath) {
    DeviceBean deviceBean = ThingHomeSdk.getDataInstance().getDeviceBean(deviceId);
    String panelName = "";
    if (deviceBean != null) {
        panelName = deviceBean.getName();
    }
    DeviceInfoRepository deviceInfoRepository = new DeviceInfoRepositoryImpl(context);
    ModifyDevInfoInteractor mModifyDevInfoInteractor = new ModifyDevInfoInteractorImpl(deviceInfoRepository);
    mModifyDevInfoInteractor.modifyDeviceImg(deviceId, panelName, new File(iconFilePath),
            new ModifyDevInfoInteractor.ModifyDeviceImgCallback() {
                @Override
                public void onModifyDeviceImgSuccess(String url) {
                }
                @Override
                public void onModifyDeviceImgFailure() {
                }
            });
}
在 App 进程活跃的情况下,为提高推送消息的到达及时性和成功率,涂鸦智能摄像机开放了消息推送辅助协议。
您可以自行实现接入推送渠道,请参考 消息管理。
注册涂鸦推送消息监听,查询回调上来的推送消息,进行后续处理。
消息体格式定义示例
{
    "a": "view",
    "c": "action",
    "cc": "低功耗智能摄像机 ,someone is ringing the bell.",
    "ct": "fcm You have a visitor",
    "devId": "6cfaf335a8d6e752e0wrpy",
    "msgId": "4da4dcf61573555995",
    "p": {
    "media": 13
},
    "specialChannel": false,
    "ts": "1573555995000",
    "type": "doorbell"
}
注册和注销监听
在账号登录成功后注册,在账号退出时进行注销。
接口说明
涂鸦推送辅助协议需在账号登录成功后注册监听,在账号退出时进行注销。
//注册涂鸦推送消息监听
ThingHomeSdk.getCameraInstance().registerCameraPushListener(IThingGetBeanCallback<CameraPushDataBean> callback)
//注销涂鸦推送消息监听
ThingHomeSdk.getCameraInstance().unRegisterCameraPushListener(IThingGetBeanCallback<CameraPushDataBean> callback);
参数说明
| 参数 | 说明 | 
|---|---|
| callback | IThingGetBeanCallback 接口,监听回调推送消息,CameraPushDataBean 为推送消息封装 | 
CameraPushDataBean 数据模型
| 字段 | 类型 | 描述 | 
|---|---|---|
| devId | String | 设备 ID | 
| timestamp | Integer | 消息时间戳 | 
| etype | String | 消息类型 | 
| edata | String | 消息 ID | 
示例代码
private IThingHomeCamera homeCamera;
private static IThingGetBeanCallback<CameraPushDataBean> mThingGetBeanCallback = new IThingGetBeanCallback<CameraPushDataBean>() {
    @Override
    public void onResult(CameraPushDataBean o) {
        L.d(TAG, "onMqtt_43_Result on callback");
        L.d(TAG, "消息时间戳:timestamp=" + o.getTimestamp());
        L.d(TAG, "设备 ID:devid=" + o.getDevId());
        L.d(TAG, "消息 ID:msgid=" + o.getEdata());
        L.d(TAG, "消息类型:etype=" + o.getEtype());
    }
};
/**
* 在账号登录成功之后注册
*/
public void registerCameraPushListener() {
    homeCamera = ThingHomeSdk.getCameraInstance();
    if (homeCamera != null) {
        homeCamera.registerCameraPushListener(mThingGetBeanCallback);
    }
}
/**
* 在账号注销之后进行反注册
*/
public void unRegisterCameraPushListener() {
    if (homeCamera != null) {
        homeCamera.unRegisterCameraPushListener(mThingGetBeanCallback);
    }
}
支持自定义配置设置页面上每项功能的显示、隐藏、点击事件拦截。
接口说明
通过服务化接口 AbsCameraUiService.configCameraSettingCustomItem 传入配置。
public abstract void configCameraSettingCustomItem(List<ThingCameraSettingConfigBean> items);
示例代码
AbsCameraUiService service = MicroServiceManager.getInstance().findServiceByInterface(AbsCameraUiService.class.getName());
if (service != null) {
    List<ThingCameraSettingConfigBean> configs = new ArrayList<>();
    configs.add(new ThingCameraSettingConfigBean("cameraSetting_iconInfoItem", false));
    service.configCameraSettingCustomItem(configs);
}
ThingCameraSettingConfigBean 数据模型
| 参数 | 说明 | 
|---|---|
| visible | 是否显示 | 
| operateCallback | 点击事件拦截 | 
| tag | 设置页面每项功能都有一个唯一对应的名称 (name),见下表所示 | 
tag 列表
tag 名称 | 
功能 | 
|---|---|
| cameraSetting_iconInfoItem | 设备图标、名称等信息 | 
| cameraSetting_infoItem | 设备信息 | 
| cameraSetting_autoItem | 一键执行和自动化 | 
| cameraSetting_networkItem | 设备网络信息 | 
| cameraSetting_thirdPartyItem | 支持的第三方服务 | 
| cameraSetting_privateModeCfgItem | 隐私模式开关 | 
| cameraSetting_basicSectionHeaderCfgItem | 基础设置标题 | 
| cameraSetting_basicFuncCfgItem | 基础设置 | 
| cameraSetting_nightvisionCfgItem | 夜视模式 | 
| cameraSetting_irNightCfgItem | 红外夜视功能 | 
| cameraSetting_displaySettingCfgItem | 画面调节 | 
| cameraSetting_soundCfgItem | 声音调节 | 
| cameraSetting_workModeCfgItem | 工作模式 | 
| cameraSetting_advanceSectionHeaderCfgItem | 高级设置标题 | 
| cameraSetting_detectCfgItem | 侦测报警 | 
| cameraSetting_pirFuncCfgItem | PIR | 
| cameraSetting_powerCfgItem | 电源管理 | 
| cameraSetting_bellCfgItem | 铃铛设置 | 
| cameraSetting_sirenSettingCfgItem | 蜂鸣器调节 | 
| cameraSetting_videoLayoutCfgItem | 视频布局 | 
| cameraSetting_presentPointCfgItem | 预设点设置 | 
| cameraSetting_onvifCfgItem | Onvif 协议 | 
| cameraSetting_gatewaySectionHeaderCfgItem | 网关标题 | 
| cameraSetting_gatewayCfgItem | 网关 | 
| cameraSetting_storageSectionHeaderCfgItem | 存储设置标题 | 
| cameraSetting_storageCfgItem | 存储设置 | 
| cameraSetting_valueAddedSectionHeaderCfgItem | 增值服务标题 | 
| cameraSetting_valueAddedCfgItem | 增值服务 | 
| cameraSetting_offlineSectionHeaderCfgItem | 离线提醒标题 | 
| cameraSetting_offlineCfgItem | 离线提醒 | 
| cameraSetting_otherSectionHeaderCfgItem | 其他标题 | 
| cameraSetting_feedbackCfgItem | 常见问题与反馈 | 
| cameraSetting_addToHomeCfgItem | 添加到桌面 | 
| cameraSetting_firmwareCfgItem | 设备升级 | 
| cameraSetting_restartCfgItem | 重启设备 | 
| CameraSetting_removeCfgItem | 移除设备 | 
| CameraSetting_indicatorLightItem | 状态指示灯 | 
| CameraSetting_besharedItem | 设备来自 | 
| CameraSetting_soundDetectedItem | 声音检测 | 
| CameraSetting_apModeItem | 热点模式 | 
| CameraSetting_unlockItem | 远程解锁 | 
| CameraSetting_cloudDisk | 基站云盘页面 | 
| CameraSetting_privacyZone | 隐私区域设置 | 
| CameraSetting_recording_time | 单段录影时间设置 | 
| CameraSetting_parking_mode | 停车模式设置 | 
| CameraSetting_collision_alert | 碰撞报警 | 
| CameraSetting_antiDismantle | 防拆告警开关 | 
| CameraSetting_notification | 消息推送设置 | 
| cameraSetting_carInspection | 车型检测开关 | 
| cameraSetting_nonCarInspection | 非机动检测开关 | 
| cameraSetting_thirdPartyHeaderItem | 支持的第三方标题 | 
| cameraSetting_pirSetItem | PIR 设置 | 
| cameraSetting_stationDoorbellItem | 基站门铃设置 | 
| cameraSetting_stationDetectionItem | 基站侦测报警 | 
更多详情,请参考 多语言配置。
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈