hikvision_service 0.0.2
hikvision_service: ^0.0.2 copied to clipboard
A Dart library to interact with Hikvision devices via ISAPI protocol and register them to cloud services.
example/example.dart
import 'package:hikvision_service/hikvision_service.dart';
void main() async {
final service = HikvisionService();
// Replace with actual device credentials
final ip = '192.168.1.64';
final user = 'admin';
final password = 'password';
try {
print("Fetching device info...");
final info = await service.getDeviceInfo(ip, user, password);
print("Device Info Fetched:");
print("MAC Address: ${info.macAddress}");
print("Full Serial: ${info.fullSerialNumber}");
print("Short Serial: ${info.shortSerialNumber}");
// Uncomment to test registration
/*
print("Registering device...");
await service.createDeviceApi(
identifier: info.shortSerialNumber,
vendorId: info.fullSerialNumber,
macAddress: info.macAddress,
hikSecurityCode: password,
timezoneOffsetMinutes: 360,
);
print("Device registered successfully.");
*/
/*
print("Fetching device list...");
final deviceList = await service.fetchDeviceList();
print("Devices: $deviceList");
*/
} catch (e) {
print("An error occurred: $e");
}
}