dh_flutter_plugin 0.0.6
dh_flutter_plugin: ^0.0.6 copied to clipboard
大华摄像头操作插件
dh_flutter_plugin #
大华摄像头 flutter 插件, 暂时只支持安卓
Getting Started #
添加仓库地址下载依赖
allprojects {
repositories {
...
maven {
url = "http://198.23.137.134:8081/repository/maven-releases/"
allowInsecureProtocol = true
}
}
}
使用前初始化,!!!必要的 #
DhFlutterPlugin().init();
不需要时释放资源 #
DhFlutterPlugin().clean();
管理员登录 #
Future<void> login() async {
final result = await DhFlutterPlugin().login(const LoginParam(
ip: '192.168.1.108', port: 80, username: 'admin', password: '123456'));
}
管理员退出登录 #
Future<bool> logout(int id) async {
return DhFlutterPluginPlatform.instance.logout(id);
}
监听人流量 #
参数1: 通道id
参数2: 登录句柄,传登录函数返回的那个ID,如果是0表示登录失败,监听会没有效果
value: 返回的人流量数据
DhFlutterPlugin().addListen(0, loginId, (CountResult value) {
Logger().i(value.toJson());
});
返回结果示例
I/flutter (30715): │ 💡 {
I/flutter (30715): │ 💡 "counts": "Counts(inHour: 11, inToday: 11, inTotal: 16, outHour: 0, outToday: 0, outTotal: 3)",
I/flutter (30715): │ 💡 "handleId": 524523147232
I/flutter (30715): │ 💡 }
移除监听 #
参数1: 上面value返回模型中handleId
DhFlutterPlugin().removeListen(524523147232);