终端管理类接口主要实现:entity的创建、更新、删除、查询。例如:添加一辆车、删除一辆车、更新车辆的属性信息(如:车辆所属运营区)等。
添加终端
/// person_name, person_phone, car_brand, car_number, car_color/// 上述key必须是已在鹰眼轨迹管理台创建过的属性字段AddEntityOption addEntityOption = AddEntityOption(tag: 1, // 请求标识 必填serviceId: serviceID, // 鹰眼服务ID 必填entityName: ‘Modi', // entity名称,作为终端实体的唯一标识,必填entityDesc: ‘鹰眼测试_iOS', // entity的可读性描述,选填。customColumns: { // 开发者自定义字段,选填'person_name': 'bob','person_phone': '13166668888','car_brand': '奥迪','car_number': '京A888888','car_color': 'black'});/// 发起添加entitybool flag = await TraceController.shareInstance.addEntity(addEntityOption: addEntityOption,entityCallBack: EntityCallBack(onAddEntityCallBack: (AddEntityResult result) {print('-- 添加entity回调 result = ${result?.toMap()}');}));print('-- 添加entity flag = $flag');
删除终端
/// entityName终端唯一标识DeleteEntityOption deleteEntityOption = DeleteEntityOption(tag: 1, serviceId: serviceID, entityName: entityName_test);/// 发起删除entitybool flag = await TraceController.shareInstance.deleteEntity(deleteEntityOption: deleteEntityOption,entityCallBack: EntityCallBack(onDeleteEntityCallBack: (DeleteEntityResult result) {print('-- 删除entity回调 result = ${result?.toMap()}');}));print('-- 删除entity flag = $flag');
更新终端
/// entityName终端唯一标识UpdateEntityOption updateEntityOption = UpdateEntityOption(tag: 1, // 请求标识 必填serviceId: serviceID, // 鹰眼服务ID 必填entityName: entityName_test, // entity名称,作为终端实体的唯一标识,必填entityDesc: ‘鹰眼测试_iOS', // entity的可读性描述,选填。customColumns: { // 开发者自定义字段,选填'person_name': 'Trump','person_phone': '13166668888','car_brand': '奥迪','car_number': '京A666666','car_color': 'black'});/// 发起更新entitybool flag = await TraceController.shareInstance.updateEntity(updateEntityOption: updateEntityOption,entityCallBack: EntityCallBack(onUpdateEntityCallBack: (UpdateEntityResult result) {print('-- 更新entity回调 result = ${result?.toMap()}');}));print('-- 更新entity flag = $flag');
查询终端
/// 查询EntityList请求参数EntityListSearchOption entityListSearchOption =EntityListSearchOption(tag: 1, /// 请求标识 必填serviceId: 221825, /// 鹰眼服务ID 必填searchFilterCondition: SearchFilterCondition( /// 过滤条件entityNames: [entityName_test], /// entityName列表activeTime: 123, /// 活跃时间, 注:不能与inActiveTime同时使用// inActiveTime: 321, /// 不活跃时间, 注:不能与activeTime同时使用),sortBy: SortBy( /// 排序规则fieldName: 'entityName', sortType: SortType.asc));/// 查询方法bool flag = await TraceController.shareInstance.queryEntityList(entityListSearchOption: entityListSearchOption,entityCallBack: EntityCallBack(onEntitySearchListCallBack:(EntityListSearchResult result) { /// 查询结果回调print('-- 查询entity list回调 result = ${result?.toMap()}');}));
KeyWordSearchEntityOption keyWordSearchEntityOption =KeyWordSearchEntityOption(tag: 1,serviceId: 221825,keyword: entityName_test,sortBy: SortBy(fieldName: 'entity_name', sortType: SortType.asc));bool flag = await TraceController.shareInstance.keyWordSearchEntity(keyWordSearchEntityOption: keyWordSearchEntityOption,entityCallBack: EntityCallBack(onKeyWordSearchEntityCallBack:(KeyWordSearchEntityResult result) {print('-- 关键字查询entity回调 result = ${result?.toMap()}');}));print('-- 关键字查询entity flag = $flag');
AroundSearchEntityOption aroundSearchEntityOption =AroundSearchEntityOption(center: LatLng(38.0, 116.0),radius: 3000,serviceId: serviceID,tag: 1,searchFilterCondition:SearchFilterCondition(entityNames: [entityName_test]),sortBy: SortBy(fieldName: 'entity_name', sortType: SortType.asc));bool flag = await TraceController.shareInstance.aroundSearchEntity(aroundSearchEntityOption: aroundSearchEntityOption,entityCallBack: EntityCallBack(onAroundSearchEntityCallBack:(AroundSearchEntityResult result) {print('-- Around查询entity回调 result = ${result?.toMap()}');}));print('-- Around查询entity flag = $flag');
BoundSearchEntityOption boundSearchEntityOption =BoundSearchEntityOption(tag: 1,serviceId: serviceID,lowerLeft: LatLng(38.0, 116.0),upperRight: LatLng(39.0, 118.0),sortBy: SortBy(fieldName: 'entityName', sortType: SortType.asc));bool flag = await TraceController.shareInstance.boundSearchEntity(boundSearchEntityOption: boundSearchEntityOption,entityCallBack: EntityCallBack(onBoundSearchEntityCallBack:(BoundSearchEntityResult result) {print('-- Bounds查询entity回调 result = ${result?.toMap()}');}));print('-- Bounds查询entity flag = $flag');
DistrictSearchEntityOption districtSearchEntityOption =DistrictSearchEntityOption(tag: 1,serviceId: serviceID,keyword: '北京市海淀区',sortBy: SortBy(fieldName: 'entity_name', sortType: SortType.asc));bool flag = await TraceController.shareInstance.districtSearchEntity(districtSearchEntityOption: districtSearchEntityOption,entityCallBack: EntityCallBack(onDistrictSearchEntityCallBack:(DistrictSearchEntityResult result) {print('-- District查询entity回调 result = ${result?.toMap()}');}));print('-- District查询entity flag = $flag');
上一篇
下一篇
本篇文章对您是否有帮助?