设备报警(Device alarm)
可根据要求设置报警,如 :
The alarm can be set according to requirements, such as:
是否开启报警声音(Whether to turn on the alarm sound)
、自定义报警铃声(Custom alarm ringtone)
、报警时间间隔设置(Alarm interval setting)
设置是否接收报警推送(Set whether to receive alarm push)
、设置报警邮箱(set alarm mailbox)
人脸检测(Face Detection)
、人形检测(Human Shape Detection)
、声音检测(Sound Detection)
、移动检测 (Motion Detection)
以及 设置移动侦测的灵敏度(Set Motion Detection Sensitivity)
。
创建 KHJDeviceManager 对象(Create KHJDeviceManager object)
KHJDeviceManager *manager = [[KHJDeviceManager alloc] init];
[manager createKHJCameraBase:Uid];
设置报警地址(Set alarm address)
// 在设备连接成功后,给设备设置一次报警地址,当设备触发报警时,可推送到该地址( After the equipment is successfully connected, set an alarm address for the equipment. When the equipment triggers an alarm, it can be pushed to this address )
if (manager) {
[manager setphpserver:@"报警地址url" returnBlock:^(BOOL success){
}];
}
是否开启报警声音(Whether to turn on the alarm sound)
if (manager) {
[manager getDeviceAlarmVolume:^(BOOL isOpen) {
// isOpen = YES 开启(open)
// isOpen = NO 未开启(close)
}];
}
设置报警声音开关(Set alarm sound switch)
// set 方法,打开/关闭 设备的报警声音( Set method to turn on / off the alarm sound of the device )
if (manager) {
[manager setDeviceAlarmVolume:isOpen returnBlock:^(BOOL isOpen){
}];
}
自定义报警铃声(Custom alarm ringtone)
- 获取自定义铃声列表(Get a list of custom ringtones)
if (manager) {
[manager getRecordAudioListWithReturnBlock:^(NSMutableArray *soundNameArr,
NSMutableArray *soundAliasArr,
int tag) {
// soundNameArr - 铃声名称(Ringtone name)
// soundAliasArr - 铃声别名(Ringtone alias)
// tag - 下标(Index)
}];
}
- 上传自定义铃声(Upload custom ringtones)
if (manager) {
// path - 铃声文件路径(Ringtone file path)
// name - 铃声文件名称,可不传,使用别名区分即可。(The name of the ringtone file can be omitted, and the alias can be used to distinguish it.)
// alias - 铃声文件别名(Ringtone file alias)
[manager uploadAudioFile:path name:@"" alias:resultString
returnBlock:^(uint8_t success, uint32_t totalSize, uint32_t hadSendSize) {
// success = 0 指令成功,开始上传铃声文件(The command is successful, and the ringtone file upload begins)
// totalSize - 铃声文件总大小(Total ringtone file size)
// hadSendSize - 已上传大小(Uploaded size)
}];
}
- 设置默认铃声(Set default ringtone)
if (manager) {
// 设置 alias 为默认铃声(Set alias as the default ringtone)
[manager setDefaultAudioFileWithFileName:@"" aliasName:alias returnBloc:^(BOOL success) {
}];
}
- 播放铃声(Play ringtone)
if (manager) {
// 播放 alias 铃声(Play alias ringtones)
[manager playAudioFileWithFileName:@"" aliasName:alias returnBloc:^(BOOL success) {
}];
}
- 删除铃声(Delete ringtone)
if (manager) {
// 删除 alias 铃声(Delete alias ringtone)
[manager deleteAudioFileWithFileName:@"" aliasName:alias returnBloc:^(BOOL success) {
}];
}
报警时间间隔(Alarm interval)
if (manager) {
// interval 可选值为: [1,3,10,30],以分钟为单位。(Optional values for interval are: [1,3,10,30], in minutes.)
[dDevice.mDeviceManager setAlarmInterval:interval returnBlock:^(BOOL success) {
}];
}
是否接送报警推送(Whether to pick up the alarm)
/**
type = 13 报警推送(Alarm push)
dataJson = @"{\"data\":0}" Json字符串,关闭报警推送(Json string, turn off alarm push)
dataJson = @"{\"data\":1}" Json字符串,打开报警推送(Json string, open the alarm push)
*/
if (manager) {
[manager sendCommomCMDWithType:13 WithData:dataJson returnBlock:^(BOOL success, int sType, NSString *fString) {
}];
}
设置报警邮箱(Set alarm mailbox)
- 获取报警邮箱信息(Get alarm mailbox information)
if (manager) {
[manager getEmail:^(NSString *userStr,
NSString *userPwd,
NSString *serverStr,
NSString *sendTo,
int mPort) {
// userStr - 邮箱用户(Mailbox user)
// userPwd - 邮箱密码(email Password)
// serverStr - 邮箱服务器(Mailbox server)
// sendTo - 接收邮箱(Receive mailbox)
// mPort - 邮箱服务器端口(Mailbox server port)
}];
}
- 获取邮箱报警是否开启(Get the mailbox alarm is turned on)
if (manager) {
[manager getEmailAlarm:^(BOOL isOpen) {
// isOpen YES 开启邮箱报警推送(Open the mailbox alarm push)
// isOpen NO 未开启邮箱报警推送(Alarm push for mailbox not enabled)
}];
}
- 开启/关闭邮箱报警(Open/close mailbox alarm)
if (manager) {
// isOpen YES 开启邮箱报警推送(Open the mailbox alarm push)
// isOpen NO 关闭邮箱报警推送(Close mailbox alarm push)
[manager setEmailAlarm:isOpen returnBlock:^(BOOL success) {
}];
}
- 设置报警邮箱(Set alarm mailbox)
if (manager) {
[manager setEmail:fourTF.text /* 发件人邮箱(Sender mailbox) */
andPwd:fiveTF.text /* smtp授权码 或 发件人密码(smtp authorization code or sender password) */
andServer:sixTF.text /* smtp地址(smtp address) */
andSendto:threeTF.text /* 收件人邮箱(Recipient's mailbox) */
andPort:[sevenTF.text intValue] /* 端口(port) */
returnBlock:^(BOOL success) {
}];
}
获取人脸检测(Get face detection)
if (manager) {
[manager getPersonFaceAlarmWithBlock:^(BOOL status) {
// status = YES 开启人脸检测(Turn on face detection)
// status = NO 未开启人脸检测(Face detection is not enabled)
}];
}
设置人脸报警(Set face alarm)
if (manager) {
// isOn YES 开启人脸报警(Turn on face alarm)
// isOn NO 关闭人脸报警(Turn off face alarm)
[manager setPersonFaceAlarmWith:isOn returnBlock:^(BOOL success){
}];
}
获取人形检测(Get human detection)
if (manager) {
[manager getPersonShapeAlarmWithBlock:^(BOOL status) {
// status = YES 开启人形检测(Turn on humanoid detection)
// status = NO 未开启人形检测(Humanoid detection is not enabled)
}];
}
设置人形报警(Set up humanoid alarm)
if (manager) {
// isOn YES 开启人形报警(Turn on the humanoid alarm)
// isOn NO 关闭人形报警(Turn off the humanoid alarm)
[manager setPersonShapeAlarmWithBlock:isOn returnBlock:^(BOOL success){
}];
}
声音检测(Sound detection)
if (manager) {
[manager getSoundAlarm:^(BOOL isStart) {
// status = YES 开启声音检测(Turn on sound detection)
// status = NO 未开启声音检测(Sound detection is not enabled)
}];
}
获取移动检测(Get movement detection)
if (manager) {
[manager getAlarmSwitch:^(BOOL success) {
// status = YES 开启移动检测(Turn on motion detection)
// status = NO 未开启移动检测(Motion detection is not turned on)
}];
}
设置移动侦测(Set up motion detection)
// isOn YES 开启移动侦测报警(Turn on motion detection alarm)
// isOn NO 关闭移动侦测报警(Turn off motion detection alarm)
[manager setAlarmSwitch:isOn returnBlock:^(BOOL success){
}];
获取移动检测灵敏度(Get motion detection sensitivity)
if (manager) {
[manager getMotionDetect:^(int level) {
// 开启移动侦测后,查询灵敏度级别(After enabling motion detection, query the sensitivity level)
// 灵敏度范围:[1,2,3,4,5]
}];
}
设置移动检测灵敏度(Set the motion detection sensitivity)
if (manager) {
// level 灵敏度范围:[1,2,3,4,5](Sensitivity range: [1,2,3,4,5])
[manager setMotionDetect:level returnBlock:^(BOOL success){
}];
}