激光扫地机器人 Demo

更新时间:2021-12-07 03:11:17下载pdf

为了方便您进行扫地机面板的开发,涂鸦提供了一套较为完整的激光扫地机器人面板的 Demo,您可参考此 Demo 进行开发或二次开发。详情请访问 tuya-panel-demo GitHub 仓库。

Demo 相关目录说明如下:

├── api
│   ├── index.tsx       // 模板中需要调用的的一些云端接口
│   └── laserUIApi.ts  // 这里面封装了跟 App 进行交互的地图通讯接口
├── components  // 以下为基础业务 UI 组件
│   ├── buttonComponent.tsx
│   ├── circleLoadingView.tsx
│   ├── home
│   │   ├── bottomItemView.tsx
│   │   ├── controllerBar.tsx
│   │   ├── homeBottomView.tsx
│   │   ├── homeMapContral.tsx
│   │   ├── homeMapView.tsx
│   │   ├── homeTopView.tsx
│   │   └── mapView
│   │       ├── components
│   │       │   └── mapLoading.tsx  // 地图加载中 UI 组件
│   │       ├── config
│   │       │   ├── autoTask
│   │       │   │   ├── historyMap.ts   // 获取历史地图
│   │       │   │   ├── index.ts
│   │       │   │   ├── multiFloor.ts    // 获取多楼层地图
│   │       │   │   ├── realTimeArea.ts   // 获取实时区域信息
│   │       │   │   ├── realTimeFirstMap.ts  // 获取首张地图
│   │       │   │   ├── realTimeFirstPath.ts   // 获取首次清扫路径
│   │       │   │   ├── realTimeFullPath.ts  // 获取全量清扫路径
│   │       │   │   ├── realTimeMap.ts  // 获取实时地图
│   │       │   │   ├── realTimePath.ts  // 获取实时清扫路径
│   │       │   │   ├── realTimePlanPath.ts  // 获取导航路径
│   │       │   │   ├── requestMap.ts   // 轮询实时地图
│   │       │   │   ├── requestPath.ts  // 轮询实时路径
│   │       │   │   └── updateAuthentication.ts   // 进行授权
│   │       │   ├── elementConfigs.ts
│   │       │   ├── elementEvents   // 这里主要定义了和 App 进行交互的一些函数通信
│   │       │   │   ├── index.ts
│   │       │   │   ├── onClickRoom.ts
│   │       │   │   ├── onClickSplitArea.ts
│   │       │   │   ├── onLaserMapPoints.ts
│   │       │   │   ├── onLongPressInAreaView.ts
│   │       │   │   └── onMapId.ts
│   │       │   ├── elementPropsSchema   // 以下目录中主要针对发送给 App 的数据进行整合处理
│   │       │   │   ├── areaInfoList
│   │       │   │   │   └── index.ts
│   │       │   │   ├── factorInfo
│   │       │   │   │   └── index.ts
│   │       │   │   ├── hasTypeMap
│   │       │   │   │   └── index.ts
│   │       │   │   ├── index.ts
│   │       │   │   ├── isRotate.ts
│   │       │   │   ├── mapData
│   │       │   │   │   ├── index.ts
│   │       │   │   │   └── roomInfoUtils.ts
│   │       │   │   ├── minAreaWidth.ts
│   │       │   │   ├── pathData
│   │       │   │   │   └── index.ts
│   │       │   │   ├── pathWidth.ts
│   │       │   │   ├── pileIcon.ts
│   │       │   │   ├── pilePosition
│   │       │   │   │   └── index.ts
│   │       │   │   ├── planPathColor.ts
│   │       │   │   ├── planPathData
│   │       │   │   │   └── index.ts
│   │       │   │   └── splitColor.ts
│   │       │   ├── index.ts
│   │       │   ├── interface.ts
│   │       │   └── store.ts
│   │       ├── index.tsx
│   │       └── resourceManager  // 机器人专用工具类,用于处理数据相关的获取和通信
│   │           ├── api
│   │           │   ├── dpAPI.ts
│   │           │   ├── index.ts
│   │           │   ├── nativeApi.ts
│   │           │   ├── ossApi.ts
│   │           │   └── ossEvent.ts
│   │           ├── config.ts
│   │           ├── elements.ts
│   │           ├── events.ts
│   │           ├── index.ts
│   │           ├── interface.ts
│   │           ├── manager.ts
│   │           ├── store.ts
│   │           ├── task.ts
│   │           ├── utils
│   │           │   └── tool.ts
│   │           └── watch.ts
│   ├── index.tsx
│   ├── laserSweepHistory   // 此目录下主要针对不同的清扫记录协议进行封装和展示
│   │   ├── index.tsx
│   │   ├── recordDataCollection
│   │   │   ├── index.ts
│   │   │   ├── laser
│   │   │   │   ├── index.ts
│   │   │   │   ├── laserLeidong.ts
│   │   │   │   └── ossRecordCollection.ts
│   │   │   ├── readme.md
│   │   │   └── recordInstance.ts
│   │   ├── records
│   │   │   ├── components
│   │   │   │   ├── index.tsx
│   │   │   │   └── itemCell.tsx
│   │   │   ├── hoc
│   │   │   │   └── hocSwipeoutCell.tsx
│   │   │   ├── index.ts
│   │   │   ├── portal.ts
│   │   │   └── recordsScene.tsx
│   ├── listModalView.tsx
│   ├── manualModal.tsx
│   ├── map.tsx
│   ├── mapFuncComponent.tsx
│   ├── multiFaultDetail.tsx
│   ├── rctLaserMap.tsx
│   ├── renameModal.tsx
│   ├── rowComponent.tsx
│   ├── settingsSectionList.tsx
│   ├── sweepManualView
│   │   ├── index.tsx
│   ├── toastModal
│   │   ├── index.tsx
│   │   └── simpleToast.tsx
│   └── voiceRowComponent.tsx
├── composeLayout.tsx
├── config
│   ├── default
│   │   ├── dpCodes.tsx   // 设备功能 DP
│   │   ├── index.tsx
│   │   ├── panelConfig.json // 一些面板配置项
│   │   ├── theme.ts  // 主题配置项
│   │   └── timerFunConfig.ts // 定时配置项
│   ├── index.tsx
│   ├── interface.ts
│   └── router.ts
├── i18n     // 面板多语言
│   ├── index.ts
│   └── strings.ts
├── main.tsx
├── pages    //  主要封装了一些基础 Demo 的交互 UI 页面
│   ├── consumablesPage.tsx
│   ├── customEditPage.tsx
│   ├── deviceInfoPage.tsx
│   ├── dustCollectionPage.tsx
│   ├── editMapPage.tsx
│   ├── homePage.tsx
│   ├── mapHistoryPage.tsx
│   ├── mapManagePage.tsx
│   ├── roomEditPage.tsx
│   ├── settingsPage.tsx
│   └── volumePage.tsx
├── protocol   // 主要是对于协议的解析
│   ├── area   // 区域信息解析
│   │   └── index.ts
│   ├── constant  // 协议解析的限定工具
│   │   └── index.ts
│   ├── index.ts
│   ├── map   // 地图协议解析
│   │   └── index.ts
│   ├── path   // 路径数据解析
│   │   └── index.ts
│   └── utils     // 一些公用方法封装。也可参考 tuya-panel-sdk 中 robot
│       ├── binary  // 数据转换工具
│       │   └── index.ts
│       ├── customErrorUtil  // 自定义错误处理工具
│       │   └── index.ts
│       ├── functionUtil    // 扫地机器人函数工具
│       │   ├── index.ts
│       │   └── readme.md
│       ├── index.ts
│       ├── loggerUtil  // 日志工具
│       │   └── index.ts
│       ├── lz4Util    // 地图的解压缩工具
│       │   ├── binding.ts
│       │   └── index.ts
│       ├── pressCoordinateUtil  // 坐标转换工具
│       │   ├── circleIntersectRect.ts
│       │   ├── index.ts
│       │   └── readme.md
│       ├── robotUtil   // 扫地机常用的一些方法工具
│       │   └── index.ts
│       ├── rxUtil    // RxJS 工具
│       │   └── index.ts
│       └── stringsUtil  // 字符串转换工具
│           └── index.ts
├── store    // 这里主要是处理一些全局的状态数据
│   ├── customConfig.ts
│   ├── devInfo.ts
│   ├── dpState.ts
│   ├── index.ts
│   ├── mapData.ts
│   ├── panelConfig.ts
│   └── theme.tsx
└── utils  // 和扫地机器人业务逻辑相关的工具
    ├── index.tsx
    ├── mapStateUtils.ts
    └── robotStatus.ts