IOS

设置摄像机参数

版本/作者/日期修改内容
1.0/Sandy/2015-09-24初版

14.设置摄像机参数

条件:摄像机连接成功
语法:
1)函数
-(int)setParams:(NSDictionary*)dic;//设置参数
参数:(NSDictionary*)dic:需要设置的参数
2)消息通知

FOUNDATION_EXPORT NSString* const IPCamera_SetParam_Result;

3) 设置成功后的消息回调

-(void)IPCamera_response_function:(NSNotification*)note;

IPCamera.h宏定义了两种注册消息的方法
#define ADD_IPCAMERA_RESPONSE_WITHOUT_ARG(notice_name) \
    [[NSNotificationCenter defaultCenter] addObserver: self selector:               @selector(IPCamera_response_function:) name: notice_name object: nil]

#define ADD_IPCAMERA_RESPONSE_WITH_ARG(notice_name,camera_object) \
    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(IPCamera_response_function:) name: notice_name object: camera_object]
示列: 设置cam频率 60HZ: int frequency_ = 0 50HZ: int frequency_ = 1 室外: int frequency_ = 2
1)注册消息通知

ADD_IPCAMERA_RESPONSE_WITH_ARG( IPCamera_SetParam_Result, cam_)

2)设置参数
     NSDictionary* dic = [ NSDictionary dictionaryWithObjectsAndKeys:
                         [NSString stringWithFormat:@"%d",frequency_ ],           @"powerfreq",@"1",@"save",@"1",@"reinit_camera", nil];
    [cam_ setParams:dic ];
3)参数设置成功后的消息回调
-(void)IPCamera_response_function:(NSNotification*)note
{    

    NSDictionary* dic = note.userInfo;

    if( [note.name isEqualToString: IPCamera_SetParam_Result ])
    {
        NSLog(@"设置参数成功!");}
}
版权所有:深圳新瑞彩网络科技有限公司

信产部备案号:粤ICP备09050685号