服务开放
概述
Beaver IoT 平台为集成开发者提供了一系列通用的服务接口,支持设备、模板、蓝图、凭据、MQTT等多种业务场景。
DeviceServiceProvider 接口文档
DeviceServiceProvider 提供常用的设备操作方法。
save
保存设备(包括设备下的实体)
void save(Device device);
deleteById
根据设备ID删除设备
void deleteById(Long id);
findById
根据设备ID查找设备
Device findById(Long id);
findByKey
根据设备Key查找设备
Device findByKey(String deviceKey);
findByKeys
根据设备Key集合查找设备
List<Device> findByKeys(List<String> deviceKey);
findByIdentifier
根据设备标识和集成ID查找设备
Device findByIdentifier(String identifier, String integrationId);
findByIdentifiers
根据设备标识集合和集成ID查找设备
List<Device> findByIdentifiers(List<String> identifier, String integrationId);
findAll
根据集成ID查找所有设备
List<Device> findAll(String integrationId);
countByDeviceTemplateKey
根据设备模板Key统计设备数量
long countByDeviceTemplateKey(String deviceTemplateKey);
deleteByDeviceTemplateKey
根据设备模板Key删除设备
void deleteByDeviceTemplateKey(String deviceTemplateKey);
clearTemplate
清空指定设备模板Key下的模板内容
void clearTemplate(String deviceTemplateKey);
DeviceStatusServiceProvider 接口文档
DeviceStatusServiceProvider 提供设备在线/离线状态管理。
register
注册集成到设备状态管理器
void register(String integrationId, DeviceStatusConfig config);
online
将设备状态更新为“在线”
void online(Device device);
offline
将设备状态更新为“离线”
void offline(Device device);
status
获取设备当前状态
DeviceStatus status(Device device);
DeviceTemplateServiceProvider 接口文档
DeviceTemplateServiceProvider 提供设备模板的管理操作。
save
保存设备模板
void save(DeviceTemplate deviceTemplate);
deleteById
根据ID删除设备模板
void deleteById(Long id);
deleteByKey
根据Key删除设备模板
void deleteByKey(String key);
findById
根据ID查找设备模板
DeviceTemplate findById(Long id);
findByIds
根据ID集合查找设备模板
List<DeviceTemplate> findByIds(List<Long> ids);
findByKey
根据Key查找设备模板
DeviceTemplate findByKey(String deviceTemplateKey);
findByKeys
根据Key集合查找设备模板
List<DeviceTemplate> findByKeys(List<String> deviceTemplateKey);
findByIdentifier
根据标识和集成ID查找设备模板
DeviceTemplate findByIdentifier(String identifier, String integrationId);
findByIdentifiers
根据标识集合和集成ID查找设备模板
List<DeviceTemplate> findByIdentifiers(List<String> identifier, String integrationId);
findAll
根据集成ID查找所有设备模板
List<DeviceTemplate> findAll(String integrationId);
findAllCustom
根据集成ID查找所有自定义设备模板
List<DeviceTemplate> findAllCustom(String integrationId);
batchDelete
批量删除设备模板
void batchDelete(List<Long> ids);
search
分页搜索设备模板
Page<DeviceTemplateResponseData> search(SearchDeviceTemplateRequest searchDeviceTemplateRequest);
DeviceTemplateParserProvider 接口文档
DeviceTemplateParserProvider 提供设备模板内容解析与校验。
validate
校验模板内容格式
boolean validate(String deviceTemplateContent);
defaultContent
获取默认模板内容
String defaultContent();
parse
解析模板内容
DeviceTemplateModel parse(String deviceTemplateContent);