Smart Camera Products
The Smart Camera module belongs to the Business layer, which mainly provides support for intelligent IPC Camera series products, Smart Doorbell series products, Station series products, Sub-device series products, EX series products, etc.
Overview of Smart Camera
The Smart Camera module belongs to the Business layer, and mainly provides support for intelligent IPC Camera series products, Smart Doorbell series products, Station series products, Sub-device series products, EX series products, etc.
Device Initialization
The device on this module is an object of BosmaCamera.h
, and all its work is done through member properties of class BosmaCamera.h
. First we need to create an object of BosmaCamera.h
, and then use it to complete the relevant settings of the device.
If your device does not need to be bound to Home Station (Pro), use the following method to initialize the device. For example: X1 series, XC series, CC series, Sentry, EX series, etc.
//If the device is independently bound, not bound under the Station, you need to use this method to initialize the device
BosmaCamera *camera = [[BosmaCamera alloc] initWithUID:@"Your device uid"
password:@"Your device password"
securityCode:@"Your device security code"
deviceModeCode:@"Your device mode code"
deviceVersion:@"Your device version"];
If your device is Home Station (Pro), or the device is bound to Home Station (Pro), use the following methods to initialize the device. For example: Home Station (Pro),EverView, etc.If it is Station, The station and the device are the same, otherwise the station and the device are different.
//If the device is Station or bound to the Station, you need to use this method to initialize the device
BosmaCamera *camera = [[BosmaCamera alloc] initWithStationUID:@"Your station uid"
stationPassword:@"Your station password"
stationModeCode:@"Your station modeCode"
stationVersion:@"Your station version"
securityCode:@"Your device security code"
deviceModeCode:@"Your device mode code"
deviceVersion:@"Your device version"
deviceMAC:@"Your device MAC"];
Device connection management
We use the object related methods of BosmaCamera.h
to complete the connection, disconnection, and reconnection of the device.BosmaCamera.h
provides the following methods:
/**
Connected devices
*/
- (void)connect;
/**
Disconnect device
*/
- (void)disconnect;
/**
Reconnect device
*/
-(void)reConnect;
The connection state of the device needs to implement the BosmaCameraDelegate agent, as follows
/**
When the device connection state changes, the following delegate method will be called
@param camera The object of device
@param status The state of the device connection
@param code The code of the device connection
@param session The session of the device connection
@param channel The channel of the device connection
*/
- (void)camera:(BosmaCamera *)camera didChangeChannelStatus:(BOSMA_APP_CAMERA_CONNECTION_STATUS)status code:(NSInteger) code session:(NSInteger)session channel:(NSInteger)channel;
Function realization of the device
Device control, parameter settings, etc., need to be implemented using the methods provided by the member properties inBosmaCamera.h
, see theBosmaCamera.h
class for details. The implementation steps are as follows:
-
Establish a connection to the device, then get the connection object
-
Get the member properties of the connection object, for example: video live and playback is done using the property
cameraVideo
inBosmaCamera.h
. -
The implementation class of the delegate agent that declares the member properties
-
Implement the delegate agent in this implementation class
-
Call the API method of the member property to implement the corresponding function
See sample code BosmaDemo
, The flow chart of the function realization is as follows:
Live and Playback
Using the property cameraVideo
in BosmaCamera.h
, you can perform live of video, playback of video, APP recording, data reception statistics, etc., see CameraVideo.h
. After the SDK processes the video data, it will return the data of CVPixelBufferRef
through the delegate method of CameraVideoDelegate
, which needs to be used to complete the rendering with BSVideoRenderView.h
. And BSVideoRenderView.h
can realize APP screenshot function.
Sample code (Live as an example):
Declare the implementation object of CameraVideoDelegate
, define a UI control of BSVideoRenderView
, and then layout this UI on the App‘s view.
@interface CameraLiveViewController: UIViewController ()<CameraVideoDelegate>
@property (weak, nonatomic) IBOutlet BSVideoRenderView *videoView;
@end
Get the property cameraVideo
object in BosmaCamera.h
camera.cameraVideo.delegate = self;
[camera.cameraVideo startLiveView];
Implement the delegate method of CameraVideoDelegate
- (void)cameraVideo:(CameraVideo *) cameraVideo cameraUID:(NSString * _Nullable)cameraUID pixelBuffer:(nonnull CVPixelBufferRef)pixelBuffer timestamp:(int)timestamp videoType:(ENUM_BOSMA_APP_CAMERA_VIDEO_TYPE)videoType reslution:(ENUM_STREAMQUALITY_LEVEL)reslution timezone:(int)timezone{
[self.videoView displayPixelBuffer:pixelBuffer];
}
Note: If you need to implement other functions, please refer to the API method of CameraVideo.h
, the API method of BSVideoRenderView.h
, and implement the corresponding delegate method, as follows:
Live of video: use API method in CameraVideo.h
/// Start live video
- (void)startLiveView;
/// Stop live video
-(void)stopLiveView;
Playback of video: Using the API method in CameraVideo.h
, you can playback the video stored in the device SD card, but not the video stored in the cloud
/// Start playback, the local video of the event.The video stored on the device.
/// @param startPlaytime startPlaytime The start timestamp of the event
/// @param type The event type of the event, see the event type definition of the server for details. Example: 10 is Motion, 20 is Sound
/// @param dutation The duration time of the event
/// @param offsetTime The time offset of playback.If it is played from the beginning, it is 0, and if it is played by dragging, it is greater than 0
/// @param isPlayAudio Whether to play sound, YES: play sound, NO: mute.Note: The delegate method ‘- (void)cameraVideo:(CameraVideo *) cameraVideo cameraUID:(NSString * __nullable)cameraUID status:(ENUM_BOSMA_APP_CAMERA_VIDEO_STATUS)status shouldPlayAudio:(BOOL)shouldPlayAudio’ needs to be implemented. If ‘shouldPlayAudio’ is YES,you need to call the 'startPlaybackAudioData' method in 'CameraAudio.h' to play the sound
- (void)startPlayback:(int) startPlaytime recordType:(uint8_t)type dutation:(unsigned int)dutation offsetTime:(unsigned int)offsetTime isPlayAudio:(BOOL)isPlayAudio;
/// Stop playback
-(void)stopPlayback;
/// Pause playback
- (void)pausePlayback;
App recording of video: Using the API method in CameraVideo.h
, the recorded video is saved in the mobile phone album
/// start record
/// @param path water pic path
/// @param isRecordAudio is record audio when audio is play
/// @param recordFrameBlock record audio or video frame call back
- (void)startRecordWithWaterPicPath:(nullable NSString *)path isRecordAudio:(BOOL)isRecordAudio recordFrameBlock:(void(^)(NSInteger pts, BOOL isSuccess))recordFrameBlock;
/// stop record
/// @param progressBlock export record video proress call back
/// @param completion completion
- (void)stopRecordWithProgressBlock:(void(^__nullable)(CGFloat progress))progressBlock completion:(void(^)(BOOL isSuccess, NSString *waterPicVideoPath))completion;
/// cancel record
/// @param completion completion
- (void)cancelRecordWithCompletion:(void(^)(void))completion;
Data reception statistics: Use the API method in CameraVideo.h
to count the data reception status of each second, and you can know whether the video is smooth or not
/// start media speed monitor
- (void)startMediaSpeedMonitorWithCallback:(void(^)(NSInteger speed))callback;
/// stop media speed monitor
- (void)stopMediaSpeedMonitor;
Rendering of video data: use the API method in BSVideoRenderView.h
/// Video rendering
/// @param pixelBuffer The video pixel buffer
- (void)displayPixelBuffer:(CVPixelBufferRef)pixelBuffer;
App screenshot of video: using the API method in BSVideoRenderView.h
, the image is saved in the mobile phone album
/// Take a screenshot on the video rendering layer
/// @param pixelBuffer The video pixel buffer
- (UIImage *)snapshotWithPixelBuffer:(CVPixelBufferRef)pixelBuffer;
Download video
Using the property localDownload
in BosmaCamera.h
, you can download the video record of the device's SD card. Unsupported devices: X1 series, XC series, CC series,EX-AA; if other devices support SD card storage, this function is supported. See CameraLocalDownload.h
Declare the implementation class of CameraLocalDownloadDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface PlaybackViewController: UIViewController ()<CameraLocalDownloadDelegate>
@end
camera.localDownload.delegate = self;
First, call the API method to download the video record of the device's SD card. The specific API method is as follows:
/// Start downloading video records
/// @param startTime start time
/// @param duration duration
/// @param recordType record type code
- (void)downloadEventRecordWithStartTime:(int)startTime duration:(int)duration recordType:(int8_t)recordType;
/// Cancel download video record
- (void)cancelDownloadEventRecord;
Then, implement the proxy method of CameraLocalDownloadDelegate
to implement download management, such as: download progress statistics, etc.
/// The delegate method,it will be called when send a command to download video record
/// @param cameraLocalDownload cameraLocalDownload
/// @param path Cache path for video download
/// @param isBusy Is it being processed, YES, is being processed, please try again later, NO, idle, you can continue
/// @param result Video download result
- (void)cameraLocalDownload:(CameraLocalDownload *)cameraLocalDownload dataPath:(nullable NSString *)path isBusy:(BOOL)isBusy result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when you receive the video record download size,it will be called multiple times
/// @param cameraLocalDownload cameraLocalDownload
/// @param totalSize Total data size of video files
/// @param downloadSize Downloaded data size of video files
- (void)cameraLocalDownload:(CameraLocalDownload *)cameraLocalDownload totalSize:(CGFloat)totalSize downloadSize:(CGFloat)downloadSize;
Cloud video
Only devices that have joined the cloud service can have cloud video. If we need to playback these cloud-stored videos, first of all, we need to obtain the URL of the cloud video resource (that is, the URL of the remote playback, get the downloaded cloud video and save it locally), Then use the video player to play the URL of the cloud video to complete the playback of the video.
First, we need to get the URL of the cloud video resource, we can complete it through the API method provided by CameraCloudPlayback.h
, as follows:
1、Declare the implementation object of CameraCloudPlaybackDelegate
@interface CameraPlaybackViewController: UIViewController ()<CameraCloudPlaybackDelegate>
@end
2、Call the API method to complete the remote playback URL of cloud video, download cloud video, cancel resource acquisition, clear resources, etc. It is recommended to download cloud video first and then play it. It is not recommended to directly obtain the remote playback URL of cloud video for playback. as follows
/// Objects must be created using singletons, or devices cannot be added normally
+ (CameraCloudPlayback *)sharedInstance;
/// Get cloud video streaming URL
/// @param streamRegion Server region for cloud storage
/// @param fullStreamName The file name of the cloud video
/// @param occurTime The occurt time of event
/// @param expectTime The expect time of event
/// @param durtTime The duration time of event
/// @param cloudDays Validity time of cloud storage
- (void)queryVideoURLWithStreamRegion:(NSString *)streamRegion fullStreamName:(NSString *)fullStreamName occurTime:(long)occurTime expectTime:(long)expectTime durtTime:(long)durtTime cloudDays:(int)cloudDays;
/// Download cloud videos and cache them in the app's temporary cache
/// @param streamRegion Server region for cloud storage
/// @param fullStreamName The file name of the cloud video
/// @param occurTime The occurt time of event
/// @param expectTime The expect time of event
/// @param durtTime The duration time of event
/// @param cloudDays Validity time of cloud storage
- (void)downloadVideoWithStreamRegion:(NSString *)streamRegion fullStreamName:(NSString *)fullStreamName occurTime:(long)occurTime expectTime:(long)expectTime durtTime:(long)durtTime cloudDays:(int)cloudDays;
/// Cancel the loading of resources. When stopping or pausing playback, you need to use isLoadingResource to determine whether the resource is being loaded. If it is loading, you need to cancel the loading of the resource.
- (void)cancelLoadingResource;
/// Clear the cache, you need to call this method to clear the cache when you exit the APP
- (void)cleanResource;
3、Implement the delegate method of CameraCloudPlaybackDelegate
to receive cloud video resources
/// The delegate method,it will be called when get cloud video streaming URL
/// @param cameraCloudPlayback The object of cloud video resources
/// @param videoHLSURL Streaming URL for cloud video
/// @param result 0 successful, others fail,refer BosmaErrorCodeDefine.h
/// @param error Error message, can be nil
- (void)cameraCloudPlayback:(CameraCloudPlayback *)cameraCloudPlayback getVideoURL:(NSString *__nullable)videoHLSURL result:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
/// The delegate method,it will be called when download cloud videos and cache them in the app's temporary cache
/// @param cameraCloudPlayback The object of cloud video resources
/// @param videoLocalPath Download and cache cloud video to local file path
/// @param result 0 successful, others fail,refer BosmaErrorCodeDefine.h
/// @param error Error message, can be nil
- (void)cameraCloudPlayback:(CameraCloudPlayback *)cameraCloudPlayback downloadVideo:(NSString *__nullable)videoLocalPath result:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
Second, after obtaining the URL of the cloud video resource, you can use the video player to play it. You can play with your own player, if so, you'll need to do the playback controls yourself. You can also use the player BSPlayerController.h
we provide in the BosmaKit
module for playback. If you are using the player provided by us, please follow the process below.
1、Import the BosmaKit
module
#import <BosmaKit/BosmaKit.h>
2、Initialize the player, monitor the state of the player, and refresh the UI when the state changed.
- (void)setupPlayer{
__weak typeof(self) weakSelf = self;
BSIJKPlayerManager *playerManager = [[BSIJKPlayerManager alloc] init];
playerManager.shouldAutoPlay = NO;
self.player = [BSPlayerController playerWithPlayerManager:playerManager containerView:self.containnerView];
self.player.pauseWhenAppResignActive = NO;
self.player.orientationObserver.isUseLandscapeWindow = NO;
self.player.disableGestureTypes = BSPlayerDisableGestureTypesAll;
self.player.playerLoadStateChanged = ^(id<BSPlayerMediaPlayback> _Nonnull asset, BSPlayerLoadState loadState) {
// Loading state changed
[weakSelf playerPlayStateChanged];
};
self.player.playerPlayStateChanged = ^(id<BSPlayerMediaPlayback> _Nonnull asset, BSPlayerPlaybackState playState) {
// Playback state has changed
[weakSelf playerPlayStateChanged];
};
self.player.playerPlayTimeChanged = ^(id<BSPlayerMediaPlayback> _Nonnull asset, NSTimeInterval currentTime, NSTimeInterval duration) {
// Playback progress changes
[weakSelf playerPlayTimeChanged:currentTime totalTime:duration];
};
self.player.playerDidToEnd = ^(id<BSPlayerMediaPlayback> _Nonnull asset) {
// Playback state ends
[weakSelf playerDidToEnd];
};
self.player.playerPlayFailed = ^(id<BSPlayerMediaPlayback> _Nonnull asset, id _Nonnull error) {
// Playback status failed
[weakSelf playerPlayFailed];
};
}
- (void)playerPlayStateChanged{
/// The playback state.
BSPlayerPlaybackState playState = self.player.currentPlayerManager.playState;
/// The player load state.
BSPlayerLoadState loadState = self.player.currentPlayerManager.loadState;
if (loadState == BSPlayerLoadStatePlayable || loadState == BSPlayerLoadStatePlaythroughOK) {
if (playState == BSPlayerPlayStatePlaying) {
NSLog(@"Cloud video playback state is playing loadState= %ld,playState= %ld",loadState,playState);
[self hideLoadingView];
} else if (playState == BSPlayerPlayStatePaused) {
NSLog(@"Cloud video playback state is pause loadState= %ld,playState= %ld",loadState,playState);
} else if (playState == BSPlayerPlayStatePlayFailed) {
NSLog(@"Cloud video playback state is failed loadState= %ld,playState= %ld",loadState,playState);
[self showStopPlayView];
} else if (playState == BSPlayerPlayStatePlayStopped) {
NSLog(@"Cloud video playback state is stop, loadState= %ld,playState= %ld",loadState,playState);
[self showStopPlayView];
} else {
NSLog(@"Cloud video playback state is unknown, loadState= %ld,playState= %ld",loadState,playState);
[self showStopPlayView];
}
} else if (loadState == BSPlayerLoadStatePrepare || loadState == BSPlayerLoadStateStalled){
if (playState == BSPlayerPlayStatePlaying) {
NSLog(@"Cloud video playback state is loading loadState= %ld,playState= %ld",loadState,playState);
} else {
NSLog(@"Cloud video playback state is ready to load loadState= %ld,playState= %ld",loadState,playState);
}
} else {
NSLog(@"Cloud video playback state is unknown,loadState= %ld,playState= %ld",loadState,playState);
}
}
- (void)playerPlayTimeChanged:(NSTimeInterval)currentTime totalTime: (NSTimeInterval)totalTime {
// Update playback progress
}
- (void)playerDidToEnd {
NSLog(@"Cloud video playback state is end");
[self.player stop];
}
- (void)playerPlayFailed {
NSLog(@"Cloud video playback state is failed");
}
- (void) showLoadingView {
// Show loading view
}
- (void) hideLoadingView {
// Hide loading view
}
- (void) showStopPlayView {
// Show stop view
}
3、Play control, it can complete playback (continue playback), pause, stop, screenshots ,progress control, etc.
// Play
- (void)play {
// Set the cloud video resources's URL
self.player.assetURL = self.cloudVideoResourcesURL ;
[self.player.currentPlayerManager play];
}
// Pause
- (void)pause {
// If it is loading, unload the cloud video resources; if it is playing, pause the playback
if ([CameraCloudPlayback sharedInstance].isLoadingResource == YES) {
// Unload cloud video resources
[[CameraCloudPlayback sharedInstance] cancelLoadingResource];
} else if (self.player.currentPlayerManager.isPlaying == YES) {
// Pause play
[self.player.currentPlayerManager pause];
}
}
// Stop
- (void)stop {
// If it is loading, unload the cloud video resources; if it is playing, stop the playback
if ([CameraCloudPlayback sharedInstance].isLoadingResource == YES) {
// Unload cloud video resources
[[CameraCloudPlayback sharedInstance] cancelLoadingResource];
// restore UI
[self showStopPlayView];
} else if (self.player.currentPlayerManager.isPlaying == YES) {
// Stop play
[self.player stop];
}
}
// Set mute/unmuted playback
- (void)setMutePlay {
// Query the status of silent playback
BOOL isMetedPlay = self.player.currentPlayerManager.isMuted;
if (isMetedPlay == YES) {
// Set unmuted playback
[self.player.currentPlayerManager setMuted:NO];
} else {
// Set mute playback
[self.player.currentPlayerManager setMuted:YES];
}
}
// Screenshot
- (UIImage *)screenshot {
// Screenshot
UIImage *image = [self.player.currentPlayerManager thumbnailImageAtCurrentTime];
return image;
}
// Seek to play,progress is 0~1
- (void)seekToPlay:(CGFloat)progress {
CGFloat progressTime = self.player.totalTime * progress;
CGFloat seekTime = progressTime > 0 ? progressTime : 0.1;
[self.player seekToTime:seekTime completionHandler:^(BOOL finished) {
if (finished) {
NSLog(@"seekToProgress finished");
} else {
NSLog(@"seekToProgress error");
}
}];
}
Note: It is recommended to download the cloud video directly, and then play it. It is not recommended to directly obtain the remote playback URL of the cloud video for playback;
Audio
Using the property cameraAudio
in BosmaCamera.h
, you can turn on or off the audio of the video and monitor the ambient sound of the device. See CameraAudio.h
Declare the implementation object of CameraAudioDelegate
@interface CameraLiveViewController: UIViewController ()<CameraAudioDelegate>
@end
Get the property cameraAudio
object in BosmaCamera.h
.And set the proxy object, and then call the method to turn on or off the audio of the video. E.g:
camera.cameraAudio.delegate = self;
[camera.cameraAudio sendReceiveAudioDataCommand];
//[camera.cameraAudio sendStopReceiveAudioDataCommand];
获取BosmaCamera.h
中的属性cameraAudio
对象,And set the proxy object, and then call the method to turn on or off the audio of the video. E.g:
camera.cameraAudio.delegate = self;
If it is Live, call the following method to turn the audio on or off
// Start the environment sound listening
- (void)sendReceiveAudioDataCommand;
//Stop the environment sound listening
- (void)sendStopReceiveAudioDataCommand;
If it is Playback, call the following method to turn the audio on or off
// Start to receive audio data (playback)
- (void)startPlaybackAudioData;
// Stop to receive audio data (playback)
- (void)stopPlaybackAudioData;
Implement the delegate method of CameraAudioDelegate
- (void)cameraAudio:(CameraAudio *) cameraAudio status:(BOSMA_APP_CAMERA_AUDIO_STATUS)status{
if (status == BOSMA_APP_CAMERA_AUDIO_STATUS_START) {
NSLog(@"Start Listen");
} else if (status == BOSMA_APP_CAMERA_AUDIO_STATUS_START) {
NSLog(@"Stop Listen");
} else{
NSLog(@"Error");
}
}
Talk and Speak
Using the property cameraSpeakerAudio
in BosmaCamera.h
, you can implement device's talk and speak. One device only supports one of them. We need to implement the functions supported by the device according to different devices. See CameraSpeakerAudio.h
Talk:Audio full-duplex, supporting sending and receiving audio at the same time;
Speak:Audio half-duplex, when sending audio, device cannot receive audio, and when receiving audio, it cannot send audio.
We can use the API method of BosmaDeviceUtils.h
to determine whether a device supports full duplex. The sample code is as follows
/// Does is support two way talk
/// @param modelCode modelCode
+ (BOOL)isSupportTwoWayTalkWithModelCode:(NSString *)modelCode;
Declare the implementation object of CameraSpeakerAudioDelegate
@interface CameraLiveViewController: UIViewController ()<CameraSpeakerAudioDelegate>
@end
To start a talk or speak, you need to turn off the audio monitoring (if the audio monitoring is being turned on), and then call the method of the property cameraSpeakerAudio
in BosmaCamera.h
to complete the work of starting the talk or speak.
Note: If the device supports full-duplex, the parameter is passed into AUDIO_TYPE_SPEAKER_AUDIO; if the device supports half-duplex, the parameter is passed into AUDIO_TYPE_SPEAKER. as follows
camera.cameraSpeakerAudio.delegate = self;
[camera.cameraSpeakerAudio startSpeakerWithAudoType:AUDIO_TYPE_SPEAKER_AUDIO];
//[camera.cameraSpeakerAudio startSpeakerWithAudoType:AUDIO_TYPE_SPEAKER];
To stop talk or speak, you need to call the method of the property cameraSpeakerAudio
in BosmaCamera.h
.
Recommendation: In order to ensure a good user experience, if the device is half-duplex, it is recommended to start the audio monitoring immediately when the speak is stopped, so that the user can hear the ambient sound of the device;If the device is full-duplex, it is recommended to cache the state of the audio monitoring when you starting the talk. When the talk is stopped, restore the state of the audio monitoring; as follows
[camera.cameraSpeakerAudio stopSpeakerAudio];
Implement the proxy method of CameraSpeakerAudioDelegate
, and complete different business process according to the returned data results. For example: when closing the talk, restore the audio monitoring state before the talk, maintain the user's usage habits, etc.
- (void)cameraSpeakerAudio:(CameraSpeakerAudio *) cameraSpeakerAudio result:(BOSMA_APP_CAMERA_INTERCOM_CONTROL_RESULT)result{
NSLog(@"SpeakerAudio result = %lu",(unsigned long)result);
}
PTZ control
If your device supports PTZ control, that is, the App can remotely movement the device, and you can use the property cameraPTZ
in BosmaCamera.h
to control the movement of the device, so that you can look around the device, such as: pan left, pan right, tilt down, tilt up, etc., see CameraPTZ.h
. Note: Before implementing this function, you need to determine whether the device supports PTZ control, and which directions it supports.
Declare the implementation object of CameraPTZDelegate
@interface CameraLiveViewController: UIViewController ()<CameraPTZDelegate>
@end
Get the property cameraPTZ
object in BosmaCamera.h
and call the API method to rotate the device. Parameter suggestion: For the parameter of stepping number, unless you have special requirements, pass the parameters as follows. If it is panning left or right, pass into kLeftRightStepNumPTZ
; if it is tilting up or down, pass into kUpDownStepNumPTZ
;
camera.cameraPTZ.delegate = self;
[camera.cameraPTZ sendCommand:BOSMA_APP_PTZ_CMD_LEFT stepNum:kLeftRightStepNumPTZ];
Implement the delegate method of CameraPTZDelegate
to handle the state of device rotation. For example: whether the device has reached the maximum rotation angle.
/**
The delegate method,it will be called when device send the status of PTZ control to app
@param cameraPTZ The object of PTZ control manager
@param commandControl PTZ control command
@param status Request the results
*/
- (void)cameraPTZ:(CameraPTZ *) cameraPTZ commandControl:(BOSMA_APP_PTZ_CMD)commandControl status:(ENUM_BOSMA_APP_PTZ_STATUS) status result:(ENUM_BOSMA_APP_RESULT)result {
NSLog(@"CameraPTZ commandControl = %lu ,status = %d",(unsigned long)commandControl,status);
}
Siren
Using the property cameraSiren
in BosmaCamera.h
, you can manage the siren of the device, see CameraSiren.h
First, we need to call the API method of BosmaDeviceUtils.h
to determine whether a device supports the siren setting. Only the device that supports the siren setting can use the siren setting function, otherwise only the control function of the siren (sound siren, stop Siren, query siren status)
/// Does the device support Siren Setting
/// @param modelCode The model code of the device
+ (BOOL)isSupportSirenSettingWithModelCode:(NSString *)modelCode;
Declare the implementation object of CameraSirenDelegate
@interface CameraLiveViewController: UIViewController ()<CameraSirenDelegate>
@end
The control of the siren, such as: sounding the siren, stopping the siren, querying the status of the siren, etc., are supported by all devices
/// Gets the status of siren
-(void)getCameraSirenStatus;
/// Play the siren
-(void)playCameraSiren;
/// Stop the siren
-(void)stopCameraSiren;
Implement the delegate method of CameraSirenDelegate
, and complete different business process according to the returned data results.
/// The delegate method,it will be called when play the siren
/// @param cameraSiren The object of siren manager
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren playResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when stop the siren
/// @param cameraSiren The object of siren manager
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren stopResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when gets the status of siren
/// @param cameraSiren The object of siren manager
/// @param status The status of siren
- (void)cameraSiren:(CameraSiren *) cameraSiren playStatus:(ENUM_PLAY_VOICE_STATUS)status;
If your device supports the siren setting function, you can also call the following API methods to set the linkage events of the siren. When these events occur, the siren will be sounded automatically.
/// The delegate method, this method will be called when getting the event parameters of the siren
/// @param cameraSiren The object of siren manager
/// @param sirenParams The event parameters of the siren
/// @param enable The event switch of the siren, NO: off ,YES: on
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren getCameraSirenEventParams:(NSArray <CameraSirenParamModel *> * __nullable) sirenParams enable:(BOOL)enable result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method, this method will be called when setting the event parameters of the siren
/// @param cameraSiren The object of siren manager
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren setCameraSirenEventParamsResult:(ENUM_BOSMA_APP_RESULT)result;
Implement the delegate method of CameraSirenDelegate
, and complete different business process according to the returned data results.
/// The delegate method, this method will be called when getting the event parameters of the siren
/// @param cameraSiren The object of siren manager
/// @param sirenParams The event parameters of the siren
/// @param enable The event switch of the siren, NO: off ,YES: on
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren getCameraSirenEventParams:(NSArray <CameraSirenParamModel *> * __nullable) sirenParams enable:(BOOL)enable result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method, this method will be called when setting the event parameters of the siren
/// @param cameraSiren The object of siren manager
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren setCameraSirenEventParamsResult:(ENUM_BOSMA_APP_RESULT)result;
If your device supports the siren setting function, you can also call the following API methods to set the siren parameters of the siren, such as the volume of the siren and the duration of the siren.
/// Sets the sound param of siren
/// @param type The type of siren
/// @param duration The duration of siren,The unit is seconds,rang 10-180
/// @param volume The volume of siren,1~100 1: is the lowest, 100: the highest
-(void)setCameraSirenSoundParams:(ENUM_SIREN_TYPE) type duration:(int)duration volume:(int)volume ;
/// Gets the sound param of siren
-(void)getCameraSirenSoundParams;
Implement the delegate method of CameraSirenDelegate
, and complete different business process according to the returned data results.
///The delegate method, this method will be called when getting the sound parameters of the siren
/// @param cameraSiren The object of siren manager
/// @param type The type of siren
/// @param duration The duration of siren,The unit is seconds,rang 10-180
/// @param volume The volume of siren,1~100 1: is the lowest, 100: the highest
/// @param status The status of siren
/// @param surplusduration The surplusduration of siren
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren getCameraSirenSoundParams:(ENUM_SIREN_TYPE) type duration:(int)duration volume:(int)volume status:(ENUM_PLAY_VOICE_STATUS)status surplusduration:(int)surplusduration result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method, this method will be called when setting the sound parameters of the siren
/// @param cameraSiren The object of siren manager
/// @param result equest the results
- (void)cameraSiren:(CameraSiren *) cameraSiren setCameraSirenSoundParamsResult:(ENUM_BOSMA_APP_RESULT)result;
Spotlight
Using the property cameraSpotlight
in BosmaCamera.h
, you can manage the spotlight device of the device, such as: setting the lighting parameters (brightness, lighting duration), setting which events are triggered to automatically turn on the light, manually turning on or off the light, see CameraSpotlight. h
; Note: Currently only EX series products and EverView products support this function
First, we need to determine whether a device supports spotlight by calling the API method of BosmaDeviceUtils.h
, as follows
/// Does the device support Spotlight
/// @param modelCode The model code of the device
+ (BOOL)isSupportSpotlightWithModelCode:(NSString *)modelCode;
Declare the implementation object of CameraSpotlightDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraLiveViewController: UIViewController ()<CameraSpotlightDelegate>
@end
camera.cameraSpotlight.delegate = self;
If it is the management of the spotlight lighting state, first obtain the property cameraSpotlight
object in BosmaCamera.h
, and call the member method of this property, as follows
/// Gets the status of spotlight
-(void)getCameraSpotlightStatus;
/// Switch the status of spotlight
/// @param status The status of spotlight
/// @param luminance The luminance of spotlight ,rang 1~10 ,1: is the lowest, 10: the highest
-(void)switchCameraSpotlight:(ENUM_SPOTLIGHT_OPRATION) status luminance:(int)luminance
Then, implement the delegate method of CameraSpotlightDelegate
/// The delegate method,it will be called when switch the spotlight
/// @param cameraSpotlight The object of spotlight manager
/// @param result equest the results
- (void)cameraSpotlight:(CameraSpotlight *) cameraSpotlight switchSpotlightStatusResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when gets the status of spotlight
/// @param cameraSpotlight The object of spotlight manager
/// @param status The status of spotlight
/// @param luminance The luminance of spotlight
- (void)cameraSpotlight:(CameraSpotlight *) cameraSpotlight getSpotlightStatus:(ENUM_SPOTLIGHT_OPRATION)status luminance:(int) luminance;
If it is spotlight lighting parameter management, first get the property cameraSpotlight
object in BosmaCamera.h
, and call the member method of this property, as follows
/// Set the lamp parameters of the spotlight
/// @param duration The duration of spotlight,The unit is seconds,rang 10-180,10: is the lowest, 180: the highest
/// @param luminance The luminance of spotlight ,rang 1~10 ,1: is the lowest, 10: the highest
-(void)setCameraSpotlightLampParams:(int) duration luminance:(int)luminance;
/// Get the lamp parameters of the spotlight
-(void)getCameraSpotlightLampParams;
Then, implement the delegate method of CameraSpotlightDelegate
/// The delegate method, this method will be called when getting the lamp parameters of the spotlight
/// @param cameraSpotlight The object of spotlight manager
/// @param duration The duration of spotlight, The unit is seconds,rang 10-180,10: is the lowest, 180: the highest
/// @param luminance The luminance of spotlight ,rang 1~10 ,1: is the lowest, 10: the highest
/// @param state false: off, true: on
/// @param surplusduration the light off surplusduration seconds
/// @param result equest the results
- (void)cameraSpotlight:(CameraSpotlight *) cameraSpotlight getCameraSpotlightLampParams:(int) duration luminance:(int)luminance state:(BOOL)state surplusduration:(int)surplusduration result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method, this method will be called when setting the lamp parameters of the spotlight
/// @param cameraSpotlight The object of spotlight manager
/// @param result equest the results
- (void)cameraSpotlight:(CameraSpotlight *) cameraSpotlight setCameraSpotlightLampParamsResult:(ENUM_BOSMA_APP_RESULT)result;
If it is a trigger event for the spotlight to automatically turn on, first get the property cameraSpotlight
object in BosmaCamera.h
, and call the member method of this property, as follows
/// Set the event parameters of the spotlight
/// @param spotlightParams The spotlight linkage event
/// @param enable The event switch of the spotlight, NO: off ,YES: on
-(void) setCameraSpotlightEventParam:(NSArray <CameraSpotlightParamModel *> *) spotlightParams enable:(BOOL) enable;
/// Get the event parameters of the spotlight
-(void) getCameraSpotlightEventParam;
Then, implement the delegate method of CameraSpotlightDelegate
/// The delegate method, this method will be called when getting the event parameters of the spotlight
/// @param cameraSpotlight The object of spotlight manager
/// @param spotlightParams The event parameters of the spotlight
/// @param enable The event switch of the spotlight, NO: off ,YES: on
/// @param result equest the results
- (void)cameraSpotlight:(CameraSpotlight *) cameraSpotlight getCameraSpotlightEventParams:(NSArray <CameraSpotlightParamModel *> * __nullable) spotlightParams enable:(BOOL) enable result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method, this method will be called when setting the event parameters of the spotlight
/// @param cameraSpotlight The object of spotlight manager
/// @param result equest the results
- (void)cameraSpotlight:(CameraSpotlight *) cameraSpotlight setCameraSpotlightEventParamsResult:(ENUM_BOSMA_APP_RESULT)result;
Indicator light
Using the property cameraIndicatorLight
in BosmaCamera.h
, you can manage the indicator light of the device, turn it on/off, see CameraIndicatorLight.h
Declare the implementation class of CameraIndicatorLightDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraIndicatorLightDelegate>
@end
camera.cameraIndicatorLight.delegate = self;
First, call the API method to manage the indicator lights of the device, such as querying whether the lights are on, or turning the lights on/off, etc. The specific API methods are as follows:
/**
Sets device’s indicator light
@param turnON Whether to turn on indicator light
*/
-(void)setCameraIndicatorLight:(BOOL)turnON;
/**
Gets device’s indicator light
*/
-(void)getCameraIndicatorLight;
Then, implement the proxy method of CameraIndicatorLightDelegate
to manage the device indicator light.
/**
The delegate method,it will be called when gets device’s indicator light
@param cameraIndicatorLight The object of device’s indicator light manager
@param turnON Whether to turn on indicator light
@param result Request the results
*/
- (void)cameraIndicatorLight:(CameraIndicatorLight *) cameraIndicatorLight getCameraIndicatorLightTurnON:(BOOL)turnON result:(ENUM_BOSMA_APP_RESULT)result;
/**
The delegate method,it will be called when sets device’s indicator light
@param cameraIndicatorLight The object of device’s indicator light manager
@param result Request the results
*/
- (void)cameraIndicatorLight:(CameraIndicatorLight *) cameraIndicatorLight setCameraIndicatorLightResult:(ENUM_BOSMA_APP_RESULT)result;
Talk volume
Using the property cameraVolume
in BosmaCamera.h
, you can set the volume of the device, see CameraVolume.h
Declare the implementation object of CameraVolumeDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraVolumeDelegate>
@end
camera.cameraVolume.delegate = self;
First, call the API method to query and modify the volume of the device. The specific API method is as follows:
/// Sets the volume of the device
/// @param value The volume of the device,0-10
-(void)setCameraVolume:(int)value;
/// Gets the volume of the device
-(void)getCameraVolume;
Then, implement the proxy method of CameraVolumeDelegate
, and implement the volume management of the device according to business requirements. as follows:
/// The delegate method,it will be called when send the command to gets the volume of the device
/// @param volume The object of device volume manager
/// @param value The volume of the device
/// @param result Request the results
- (void)cameraVolume:(CameraVolume *)volume getCameraVolume:(int) value result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send the command to sets the volume of the device
/// @param volume The object of device volume manager
/// @param result Request the results
- (void)cameraVolume:(CameraVolume *) volume setCameraVolumeResult:(ENUM_BOSMA_APP_RESULT)result;
Voice message
Using the property voiceMessage
in BosmaCamera.h
, you can set the voice message of the device. When the device meets certain conditions, these voices will be played automatically. Such as: voice management (add, delete, modify, query), switch whether to automatically play voice, etc., see CameraVoiceMessage.h
Declare the implementation class of CameraVoiceMessageDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraVoiceMessageDelegate>
@end
camera.voiceMessage.delegate = self;
When certain events are detected, whether the voice is automatically played (for example: when receiving the visiting information, if the user does not process it in time or the device turns on the message mode, whether the voice is automatically played; when receiving the visiting information, if the user chooses to hang up , whether to automatically play the voice; when a stranger is detected, whether to automatically play the voice; when a family member is detected, whether to automatically play the voice), you can call the following API methods to implement, and then implement the proxy method:
/// Query autoplay settings for voice message
- (void)queryPlaySetting;
/// Update autoplay settings for voice message
/// @param replyType ENUM_VOICE_MESSAGE_TYPE
/// @param isOn BOOL
- (void)updatePlaySetting:(ENUM_VOICE_MESSAGE_TYPE)replyType isOn:(BOOL)isOn;
/// The delegate method,it will be called when you query autoplay settings for voice message
/// @param voiceMessage voiceMessage
/// @param unReplyMode When receiving the visiting information, if the user does not process it in time or the device turns on the message mode, whether to automatically play the voice. 1 on, 0 off
/// @param refuseMode When receiving the visiting information, if the user chooses to hang up, whether to automatically play the voice . 1 on , 0 off
/// @param strangerMode When a stranger is detected,whether to automatically play a voice. 1 on , 0 off
/// @param familyMode When a family is detected,whether to automatically play a voice. 1 on , 0 off
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage unReplyMode:(int)unReplyMode refuseMode:(int)refuseMode strangerMode:(int)strangerMode familyMode:(int)familyMode quryPlaySettingResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when you update autoplay settings for voice message
/// @param voiceMessage voiceMessage
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage updatePlaySettingResult:(ENUM_BOSMA_APP_RESULT)result;
The management of voice records, such as: adding, deleting, modifying, querying, downloading, etc., can be implemented by calling the following API methods, and then implementing the proxy method, as follows:
/// @param messageData aac encoded data
/// @param type message type ENUM_VOICE_MESSAGE_TYPE
/// @param name message name
/// @param duration duration duration
- (void)addVoiceMessage:(NSData *)messageData type:(ENUM_VOICE_MESSAGE_TYPE)type name:(NSString *)name duration:(int)duration;
/// Download the voice from device
/// @param replyId Voice ID
/// @param voiceLength File size of voice
- (void)downloadVoiceMessage:(uint8_t)replyId length:(int)voiceLength;
/// Cancel download the voice from device
- (void)cancelDownloadVoiceMessage;
/// Delete the voice from device
/// @param replyId Voice ID
- (void)deleteVoiceMessage:(uint8_t)replyId;
/// Update the voice for autoplay
/// @param replyId replyId
- (void)updateDefaultVoiceMessage:(uint8_t)replyId;
/// Query the list of voice
- (void)queryVoiceMessageList;
/// The delegate method,it will be called when send a command set doorbell message box params
/// @param voiceMessage messageBox
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage updateDefaultResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command doorbell message box add reply message
/// @param voiceMessage messageBox
/// @param errorType errorType
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage errorType:(VoiceMessageAddReplayError)errorType addResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command doorbell message box download reply message
/// @param voiceMessage messageBox
/// @param voiceData AAC voiceData
/// @param isBusy isBusy
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage download:(nullable NSData *)voiceData isBusy:(BOOL)isBusy result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command doorbell message box delete reply message
/// @param voiceMessage messageBox
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage deleteResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command get doorbell message reply list
/// @param voiceMessage messageBox
/// @param replyList messageList
/// @param result result
- (void)cameraVoiceMessage:(CameraVoiceMessage *)voiceMessage queryVoiceMessageList:(NSArray<MessageBoxReplyModel *> *)replyList result:(ENUM_BOSMA_APP_RESULT)result;
Note: When adding a voice, you need to call the official API to collect PCM audio first, then convert the PCM audio into AAC audio, and then transfer the AAC audio to the device for saving, as follows:
First, call the method of BosmaDeviceUtils.h
to get the audio encoding type, as follows:
/// Audio type of the device
/// @param modeCode The model code of the device
+ (AudioCodecType)audioTypeWithModeCode:(NSString *)modeCode;
Then, call the following method provided by BosmaAudioDataManager.h
in the BosmaMedia
component to convert the collected PCM audio into AAC audio, and then call the API method of the new voice.
/// Convert the collected PCM audio data to AAC audio data
- (void)encodeAudioPCMDataWithCodecType:(AudioCodecType)codecType completion:(void (^)(NSData *encodedData))completion;
Starlight or Color night vision
Use the property cameraNightVision
in BosmaCamera.h
to turn on/off starlight and turn on/off color night vision, see CameraNightVision.h
.
Note: One device only supports one of these two modes. Currently, only EX series products support color night vision, and other products are starlight.
First, declare the implementation object of CameraNightVisionDelegate
@interface CameraSettingViewController: UIViewController ()<CameraNightVisionDelegate>
@end
If it is to implement starlight, get the property cameraNightVision
object in BosmaCamera.h
, and then call the API method
/**
Sets whether the device is in starlight mode,The supporting products are X1, Sentry, X1-C, XC-C
@param switchState Starlight mode on or off
*/
-(void)setCameraNightVision:(ENUM_BOSMA_APP_SWITCH_STATE) switchState;
/**
Gets whether the device is in starlight mode,The supporting products are X1, Sentry, X1-C, XC-C
*/
-(void)getCameraNightVision;
Then, implement the delegate method of CameraNightVisionDelegate
to manage the state of starlight.
/**
The delegate method,it will be called when gets whether the device is in starlight mode
@param cameraNightVision The object of starlight manager
@param nightVision The Starlight mode
@param result Whether the current starlight mode was successfully acquired
*/
- (void)cameraNightVision:(CameraNightVision *) cameraNightVision getCameraNightVision:(ENUM_BOSMA_APP_SWITCH_STATE) nightVision result:(ENUM_BOSMA_APP_RESULT)result;
/**
The delegate method,it will be called when sets whether the device is in starlight mode
@param cameraNightVision The object of starlight manager
@param result Whether the setting is successful
*/
- (void)cameraNightVision:(CameraNightVision *) cameraNightVision setCameraNightVisionResult:(ENUM_BOSMA_APP_RESULT)result;
If it is to implement color night vision, get the property cameraNightVision
object in BosmaCamera.h
, and then call the API method
/**
Sets whether the device is in color night vision mode ,When you turn on this mode, the device will start the color image protection system at night to present you with color images as much as possible. In other cases, if the light is insufficient, in order to ensure the clarity of the image, the device will present you with black and white images. The supporting products are Bosma EX series
@param switchState Color night vision mode on or off
*/
-(void)setCameraColorNightVision:(ENUM_BOSMA_APP_SWITCH_STATE) switchState;
/**
Gets whether the device is in color night vision mode. The supporting products are Bosma EX series
*/
-(void)getCameraColorNightVision;
Then, implement the delegate method of CameraNightVisionDelegate
to manage the status of color night vision.
/**
The delegate method,it will be called when gets whether the device is in color night vision mode
@param cameraNightVision The object of manager
@param nightVision The color night vision mode
@param result Whether the current color night vision mode was successfully acquired
*/
- (void)cameraNightVision:(CameraNightVision *) cameraNightVision getCameraColorNightVision:(ENUM_BOSMA_APP_SWITCH_STATE) nightVision result:(ENUM_BOSMA_APP_RESULT)result;
/**
The delegate method,it will be called when sets whether the device is in color night vision mode
@param cameraNightVision The object of manager
@param result Whether the setting is successful
*/
- (void)cameraNightVision:(CameraNightVision *) cameraNightVision setCameraColorNightVisionResult:(ENUM_BOSMA_APP_RESULT)result;
Image effect
Using the property cameraImageEffect
in BosmaCamera.h
, you can modify the contrast, brightness, saturation, and sharpness of the image, but it is not recommended to use this function to adjust the parameters of the image, see CameraImageEffect.h
Declare the implementation object of CameraImageEffectDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraLiveViewController: UIViewController ()<CameraImageEffectDelegate>
@end
camera.cameraImageEffect.delegate = self;
First, obtain the property cameraImageEffect
object in BosmaCamera.h
, and call the API method to obtain the image parameters, refresh the UI, and then call the API method to modify the image parameters when the user modifies the parameters, as follows:
/**
Sets video image parameter
@param contrast The contrast of video image parameter,0-255
@param brightness The brightness of video image parameter,0-255
@param sharpness The sharpness of video image parameter,0-255
@param saturation The saturation of video image parameter,0-255
*/
-(void)setParameter:(int)contrast brightness:(int)brightness sharpness:(int)sharpness saturation:(int)saturation;
/**
Gets video image parameter
*/
-(void)getParameter;
Then, implement the delegate method of CameraImageEffectDelegate
/**
The delegate method,it will be called when send the command to sets video image parameter
@param cameraImageEffect The object of video image parameter manager
@param result Request the results
@param contrast The contrast of video image parameter,0-255
@param brightness The brightness of video image parameter,0-255
@param sharpness The sharpness of video image parameter,0-255
@param saturation The saturation of video image parameter,0-255
*/
- (void)cameraImageEffect:(CameraImageEffect *) cameraImageEffect setResult:(ENUM_BOSMA_APP_RESULT)result contrast:(int)contrast brightness:(int)brightness sharpness:(int)sharpness saturation:(int)saturation ;
/**
The delegate method,it will be called when send the command to gets video image parameter
@param cameraImageEffect The object of video image parameter manager
@param result Request the results
@param contrast The contrast of video image parameter,0-255
@param brightness The brightness of video image parameter,0-255
@param sharpness The sharpness of video image parameter,0-255
@param saturation The saturation of video image parameter,0-255
*/
- (void)cameraImageEffect:(CameraImageEffect *) cameraImageEffect getResult:(ENUM_BOSMA_APP_RESULT)result contrast:(int)contrast brightness:(int)brightness sharpness:(int)sharpness saturation:(int)saturation ;
Quality
Using the property cameraQuality
in BosmaCamera.h
, you can modify the resolution of the image. Different device types have different resolutions. The type of resolution needs to be determined according to the device type, see CameraQuality.h
First, we need to call the API method of BosmaDeviceUtils.h
to determine which resolution switching a device supports. The resolution supported by the device is returned by an integer array, and each integer number represents a resolution, see enumeration ENUM_STREAMQUALITY_LEVEL
is as follows
/// device support video quality
/// @param modelCode The model code of the device
/// @param version The model device verison
+ (NSArray<NSNumber *>*)supportResolutionListWithModelCode:(NSString *)modelCode deviceVersion:(NSString *)version;
typedef enum
{
BOSMA_AVIOCTRL_QUALITY_HIGH = 0x00, //1080P
BOSMA_AVIOCTRL_QUALITY_MIDDLE = 0x01, //720P
BOSMA_AVIOCTRL_QUALITY_LOW = 0x02, //360P
BOSMA_AVIOCTRL_QUALITY_AUTO = 0x03, //Auto
BOSMA_AVIOCTRL_QUALITY_2K = 0x04, //2K
BOSMA_AVIOCTRL_QUALITY_480P = 0x05, //480P
BOSMA_AVIOCTRL_QUALITY_ERROR // Error
}ENUM_STREAMQUALITY_LEVEL;
Declare the implementation object of CameraQualityDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraLiveViewController: UIViewController ()<CameraQualityDelegate>
@end
camera.cameraQuality.delegate = self;
First, get the property cameraQuality
object in BosmaCamera.h
, and call the API method as follows:
/// Sets the resolution of live vedio stream
/// @param quality The resolution of live vedio stream
-(void)setCameraQuality:(ENUM_STREAMQUALITY_LEVEL) quality;
/// Gets the resolution of live vedio stream
-(void)getCameraQuality;
Then, implement the delegate method of CameraQualityDelegate
/// The delegate method,it will be called when gets the resolution of live vedio stream
/// @param cameraQuality The object of live vedio stream manager
/// @param quality The resolution of live vedio stream
/// @param result Request the results
- (void)cameraQuality:(CameraQuality *) cameraQuality getCameraQuality:(ENUM_STREAMQUALITY_LEVEL) quality result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets the resolution of live vedio stream
/// @param cameraQuality The object of live vedio stream manager
/// @param quality The resolution of live vedio stream
/// @param result Request the results
- (void)cameraQuality:(CameraQuality *) cameraQuality setCameraQuality:(ENUM_STREAMQUALITY_LEVEL) quality result:(ENUM_BOSMA_APP_RESULT)result;
Image rotation
Using the property cameraImageRotate
in BosmaCamera.h
, the image of the video can be flipped in 4 directions. If the user's device is installed in the wrong direction, this function can be used to rotate the image; see the specific API method in CameraImageRotate.h
Declare the implementation object of CameraImageRotateDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraImageRotateDelegate>
@end
camera.cameraImageRotate.delegate = self;
First, call the API method to query and modify the device image. The specific API method is as follows:
/// Sets the direction of the video image
/// @param imageRotate The direction of the video image,0: Normal 1: Horizontal flip 2: Vertical flip 3: 180° flip
-(void)setCameraImageRotate:(int) imageRotate;
/// Gets the direction of the video image
-(void)getCameraImageRotate;
Then, implement the proxy method of CameraImageRotateDelegate
to realize the image rotation of the device according to business requirements. as follows:
/// The delegate method,it will be called when gets the direction of the video image
/// @param cameraImageRotate The object of rotate video image manager
/// @param imageRotate The direction of the video image
/// @param result Request the results
- (void)cameraImageRotate:(CameraImageRotate *) cameraImageRotate getCameraImageRotate:(IMAGE_ROTATE_MODE) imageRotate result:(ENUM_BOSMA_APP_RESULT)result;
The delegate method,it will be called when sets the direction of the video image
/// @param cameraImageRotate The object of rotate video image manager
/// @param result Request the results
- (void)cameraImageRotate:(CameraImageRotate *) cameraImageRotate setCameraImageRotateResult:(ENUM_BOSMA_APP_RESULT)result;
Wide dynamic range
Using the property cameraWDR
in BosmaCamera.h
, you can set the wide dynamic range of the video to enhance the image effect in strong light environment, see CameraWDR.h
First, we need to determine whether the device supports WDR settings by calling the API method of BosmaDeviceUtils.h
, as follows
/// Does the device support WDR
/// @param modeCode The model code of the device
/// @param version The version of the device
+ (BOOL)isSupportWDRWithModeCode:(NSString *)modeCode version:(NSString *)version ;
Declare the implementation class of CameraWDRDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraWDRDelegate>
@end
camera.cameraWDR.delegate = self;
First, call the API method to query and modify the WDR of the device. The specific API method is as follows:
/// Sets device’s WDR
/// @param swicthON Whether to turn on WDR
-(void)setCameraWDR:(BOOL)swicthON;
/// Gets device’s WDR
-(void)getCameraWDR;
Then, implement the delegate method of CameraWDRDelegate
to implement the WDR of the device according to the business requirements. as follows:
/// The delegate method,it will be called when gets device’s WDR
/// @param cameraWDR The object of device’s WDR manager
/// @param swicthON Whether to turn on WDR
/// @param result Request the results
- (void)cameraWDR:(CameraWDR *) cameraWDR getCameraWDRSwicthON:(BOOL)swicthON result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets device’s WDR
/// @param cameraWDR The object of device’s WDR manager
/// @param result Request the results
- (void)cameraWDR:(CameraWDR *) cameraWDR setCameraWDRResult:(ENUM_BOSMA_APP_RESULT)result;
SD card storage
Use the property cameraSDcard
in BosmaCamera.h
, the storage management of the device memory card, such as: basic information, formatting, see CameraSDcard.h
, note: This function is not applicable to Home Station, Home Station Pro devices.
Declare the implementation object of CameraSDcardDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraSDcardDelegate>
@end
camera.cameraSDcard.delegate = self;
First, get the property cameraSDcard
object in BosmaCamera.h
, and call the API method as follows:
/// Get SD card information
-(void)getSDcardInformation;
/// Format the SD card
-(void)sdCardFormat;
Then, implement the delegate method of CameraSDcardDelegate
/// The delegate method,it will be called when send the command to get SD card information
/// @param cameraSDcard The object of SD card manager
/// @param exitFlag Whether SD card exists,1: exists 0: does not exist
/// @param total The total size of SD card
/// @param free The available size of SD card
/// @param result Request the results
- (void)cameraSDcard:(CameraSDcard *) cameraSDcard exitFlag:(int)exitFlag total:(int)total free:(int)free result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send the command to format the SD card
/// @param cameraSDcard The object of SD card manager
/// @param result Request the results
- (void)cameraSDcardFormat:(CameraSDcard *) cameraSDcard result:(ENUM_BOSMA_APP_RESULT)result;
External storage
Using the property cameraStation
in BosmaCamera.h
, you can manage the external storage of the device, which is suitable for Station series products, such as: Home Station, Home Station Pro, etc., see CameraStation.h
Declare the implementation class of CameraStationDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraStationDelegate>
@end
camera.cameraStation.delegate = self;
First, call the API method to manage the external storage device: query, modify, format, etc. The specific API methods are as follows:
/**
Get storage management information
@param storageType Type of storage space
*/
-(void) getStorageInformation:(CAMERA_STATION_STORAGE_TYPE) storageType;
/**
Set default storage device partition
@param storageMode Data of storage device partition
*/
-(void) setDefaultStorage:(CameraStationStorageModel *) storageMode;
/**
Format storage device partition
@param storageType Type of storage space
@param partitionIndex Partition index of the storage device,if the type opration if MEMORY_CARD_FORMAT_OPRATION_ALL,Please set parameter 0
@param opration Format operation type,refer to ENUM_MEMORY_CARD_FORMAT_OPRATION
*/
-(void) formatStorage:(CAMERA_STATION_STORAGE_TYPE) storageType partition:(int) partitionIndex opration:(MEMORY_CARD_FORMAT_OPRATION) opration;
Then, implement the delegate method of CameraStationDelegate
to manage the external storage.
/**
The delegate method, this method will be called when get storage space information
@param cameraStation The object of CameraHub manager
@param storageInfo Partition information of storage device
@param storageStatus The state of the storage device
@param result equest the results
*/
- (void)cameraStation:(CameraStation *) cameraStation storageInfo:(NSArray <CameraStationStorageModel *> * __nullable)storageInfo storageStatus:(ENUM_MEMORY_CARD_STATUS) storageStatus result:(ENUM_BOSMA_APP_RESULT)result;
/**
The delegate method, this method will be called when set default storage space
@param cameraStation The object of CameraHub manager
@param result equest the results
*/
- (void)cameraStation:(CameraStation *) cameraStation setDefaultStorageResult:(ENUM_BOSMA_APP_RESULT)result;
/**
The delegate method, this method will be called when format storage space
@param cameraStation The object of CameraHub manager
@param result equest the results
*/
- (void)cameraStation:(CameraStation *) cameraStation formatStorageResult:(ENUM_BOSMA_APP_RESULT)result;
Device information
Using the property cameraInformation
in BosmaCamera.h
, it can get the device information of the device from the device. For specific API methods, see CameraInformation.h
Declare the implementation object of CameraInformationDelegate
in *.
h, and then set its proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraInformationDelegate>
@end
camera.cameraInformation.delegate = self;
First, call the API method to obtain the device information of the device. as follows:
/// Gets device basic information
-(void)getInformation;
Then, implement the delegate method of CameraInformationDelegate
to receive the device information
/// The delegate method,it will be called when gets device basic information
/// @param cameraInformation The object of device basic information manager
/// @param manufacturer manufacturer
/// @param model The product type
/// @param firmwareVersion Current software version
/// @param serialNumber Device UID
/// @param hardWare Current hardware version
/// @param platformType Platform enumeration type
/// @param otaStatus OTA status
/// @param chargeStatus Charge status
/// @param battery Remaining battery
/// @param result Request the results
- (void)cameraInformation:(CameraInformation *) cameraInformation manufacturer:(NSString * __nullable)manufacturer model:(NSString * __nullable)model firmwareVersion:(NSString * __nullable)firmwareVersion serialNumber:(NSString * __nullable)serialNumber hardWare:(NSString * __nullable)hardWare platformType:(BOSMA_PLATFORM_TYPE)platformType otaStatus:(ENUM_OTA_STATUS) otaStatus chargeStatus:(ENUM_CHARGE_STATUS) chargeStatus battery:(int)battery result:(ENUM_BOSMA_APP_RESULT)result;
Firmware update
Use the property cameraOTA
in BosmaCamera.h
, which can be used to update the firmware version of the device. The working principle is:
Step1: Get the latest version information;
Step2: Download the firmware file;
Step3: Refresh the firmware file;
Step4: Compare the old and new version information to determine whether the upgrade is successful.
For specific API methods, see CameraOTA.h
Declare the implementation object of CameraOTADelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraOTADelegate>
@end
camera.cameraOTA.delegate = self;
First, call the API method to obtain the latest version information, and receive the version information in the proxy method. The version information will include the time required for the device to refresh the firmware file. After notifying the device to flash the firmware, you need to count this time. After waiting for the device to complete the firmware update, reconnect the device, obtain the current version information from the device, and then compare the current version information with the version information before the firmware update to determine whether the firmware update is successful. as follows:
/// Get the latest firmware information
/// @param modelCode The model code for device
/// @param deviceUID The uid for device
/// @param version The version for device
-(void)getLatestFirmwareInformationWithModeCode:(NSString *)modelCode deviceUID:(NSString *)deviceUID version:(NSString *)version;
/// The delegate method,it will be called when get the latest firmware information
/// @param cameraOTA The object of OTA manager
/// @param fwModel The basic information for firmware
/// @param result Request the results
- (void)cameraOTA:(CameraOTA *) cameraOTA getLatestFirmwareInformation:(BosmaDeviceOTAModel * __nullable) fwModel result:(ENUM_BOSMA_APP_RESULT)result;
If there is a new version that needs to be updated, you can call the following API methods to notify the device to start/stop/cancel downloading the firmware file, and receive the download status of the firmware file in the proxy method, as follows
/// Start downloading firmware files
/// @param model The basic information for firmware
-(void)startDownload:(BosmaDeviceOTAModel * __nullable) model;
/// Cancel download the firmware file
-(void)cancelDownload;
/// Gets the progress of downloading the firmware file
-(void)getDownloadProgress;
/// The delegate method,it will be called when start downloading firmware files
/// @param cameraOTA The object of OTA manager
/// @param result Request the results
/// @param code Status code
- (void)cameraOTA:(CameraOTA *) cameraOTA startDownloadResult:(ENUM_BOSMA_APP_RESULT)result code:(OTA_START_STATUS) code;
/// The delegate method,it will be called when cancel download the firmware file
/// @param cameraOTA The object of OTA manager
/// @param result Request the results
- (void)cameraOTA:(CameraOTA *) cameraOTA cancelDownloadResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when gets the progress of downloading the firmware file
/// @param cameraOTA The object of OTA manager
/// @param progress The progress of downloading the firmware file
/// @param result Request the results
/// @param code Status code
- (void)cameraOTA:(CameraOTA *) cameraOTA getDownloadProgress:(int) progress result:(ENUM_BOSMA_APP_RESULT)result code:(OTA_DOWNLOAD_STATUS) code;
When the download progress of the firmware file is 100%, it means the download is complete. At this time, the device can be notified to start refreshing the firmware, and the refresh status of the firmware file can be received in the proxy method. If the device enters the firmware refresh process, the device needs to be disconnected. After the device finishes refreshing the firmware, reconnect the device, obtain the version information, and compare the version information, as follows:
/// Start upgrading firmware files
/// @param confirm Whether to upgrade
-(void)startUpgrageWithConfirm:(ENUM_BOSMA_APP_CAMERA_UPGRAGE)confirm;
/// The delegate method,it will be called when start upgrading firmware files
/// @param cameraOTA The object of OTA manager
/// @param result Request the results
/// @param code Status code
- (void)cameraOTA:(CameraOTA *) cameraOTA startUpgrageResult:(ENUM_BOSMA_APP_RESULT)result code:(OTA_UPGRAGE_STATUS) code;
If you need to set whether the device will automatically update the firmware, you can call the following API method, and then receive the setting result in the delegate method. Once setup is successful, the device will check for firmware updates in the middle of the night locally, and if version information is available, the firmware update will be performed automatically. The API methods are as follows:
/// The delegate method,it will be called when gets firmware upgrade mode
/// @param cameraOTA The object of OTA manager
/// @param OTA Firmware upgrade mode, 0: auto auto mode,1: manual manual mode
/// @param result Request the results
- (void)cameraOTA:(CameraOTA *) cameraOTA getCameraOTA:(ENUM_BOSMA_APP_CAMERA_OTA) OTA result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets firmware upgrade mode
/// @param cameraOTA The object of OTA manager
/// @param result Request the results
- (void)cameraOTA:(CameraOTA *) cameraOTA setCameraOTAResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when gets firmware upgrade mode
/// @param cameraOTA The object of OTA manager
/// @param OTA Firmware upgrade mode, 0: auto auto mode,1: manual manual mode
/// @param result Request the results
- (void)cameraOTA:(CameraOTA *) cameraOTA getCameraOTA:(ENUM_BOSMA_APP_CAMERA_OTA) OTA result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets firmware upgrade mode
/// @param cameraOTA The object of OTA manager
/// @param result Request the results
- (void)cameraOTA:(CameraOTA *) cameraOTA setCameraOTAResult:(ENUM_BOSMA_APP_RESULT)result;
Device control
Using the property cameraControl
in BosmaCamera.h
, you can control the device, for example: restart the device, unbind the device, the doorbell light of the video doorbell, see CameraControl.h
Declare the implementation class of CameraControlDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraControlDelegate>
@end
camera.cameraControl.delegate = self;
If it is the doorbell light control of the video doorbell (only supported by Sentry), once this setting is turned on, in a dark environment, if someone comes in front of the video doorbell, the doorbell light will automatically turn on, so that the visitor can ring the doorbell. The specific API methods are as follows:
/// Set the doorbell ring light 's control
/// @param lightStatue Light control, refer to RING_LAMP_STATUS
-(void) setRingLampLighting:(RING_LAMP_STATUS) lightStatue;
/// Get the doorbell ring light 's control
- (void)getRingLampLighting ;
Then, implement the proxy method of CameraControlDelegate
, and realize whether the doorbell light of the device is automatically turned on according to the business requirements. as follows:
/// The delegate method, this method will be called when set/get the doorbell ring light 's control
/// @param cameraControl The object of CameraControl manager
/// @param lightStatue Light control, refer to RING_LAMP_STATUS
/// @param result equest the results
- (void)cameraControl:(CameraControl *) cameraControl autoLighting:(RING_LAMP_STATUS) lightStatue result:(ENUM_BOSMA_APP_RESULT)result;
If it is to restart the device (only supported by Sentry and EX series products), since the removal of the device is troublesome, the following API methods can be called when the device needs to be restarted without removing the device:
/// Restart the device
- (void)restartDevice;
Then, implement the delegate method of CameraControlDelegate
to prompt users according to business requirements. as follows:
/// The delegate method,it will be called when restart the device's
/// @param cameraControl The object of CameraControl manager
/// @param result Request the results
- (void)cameraControl:(CameraControl *) cameraControl result:(ENUM_BOSMA_APP_RESULT)result;
If you unbind the device, it is recommended that you notify the device that its binding relationship with the user has been unbound, so that the device can automatically restore its factory settings. The specific API method:
/// Unbind the device, the device will automatically reset
/// @param deviceMAC The MAC address of the device to be unbound. If the device is bound to the gateway, it must send the MAC address of the device. If the device is used alone, there is no need to send the MAC of the device
-(void) unbindDeviceMAC:(NSString *__nullable) deviceMAC;
Then, implement the delegate method of CameraControlDelegate
to prompt users according to business requirements. as follows:
/// The delegate method, this method will be called when remove the device
/// @param cameraControl The object of CameraControl manager
/// @param result equest the results
- (void)cameraControl:(CameraControl *) cameraControl removeResult:(ENUM_BOSMA_APP_RESULT)result;
Device health report
Using the property cameraHealth
in BosmaCamera.h
, you can query the health status of the device, such as network signal strength, etc., see CameraHealth.h
Declare the implementation class of CameraHealthDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraLiveViewController: UIViewController ()<CameraHealthDelegate>
@end
camera.cameraHealth.delegate = self;
First, call the API method to start/stop the detection of device health status. The specific API method is as follows:
/// Control the heatlh test status of the device
/// @param control The heatlh test status of the device
-(void) startHealthTest:(DEVICE_HEALTH_TEST) control;
Then, implement the delegate method of CameraHealthDelegate
to obtain device health data, such as WiFi strength, etc., see CameraHealthModel.h
.
/// The delegate method, this method will be called when setting the heatlh test status of the device
/// @param cameraHealth The object of CameraHealth manager
/// @param control The control of the Camera Health
/// @param healthModel The data of the Camera Health
/// @param result equest the results
- (void)cameraHealth:(CameraHealth *) cameraHealth testControl:(DEVICE_HEALTH_TEST) control deviceHealth:(CameraHealthModel * __nullable) healthModel result:(ENUM_BOSMA_APP_RESULT)result;
Privacy mode
Using the property cameraSwicth
in BosmaCamera.h
, the device privacy mode can be turned on/off. Once the privacy mode is turned on, the device will no longer record events or perform real-time preview, which can protect the privacy of users to the greatest extent. For specific API methods, see CameraSwicth.h
Declare the implementation object of CameraSwicthDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraSwicthDelegate>
@end
camera.cameraSwicth.delegate = self;
First, call the API method to query and modify the privacy mode of the device. The specific API method is as follows:
/// Sets the main switch of the device
/// @param enable Whether the main switch of the device is turned on
-(void)setCameraSwicth:(BOOL)enable;
/// Gets the status of the device's main switch
-(void)getCameraSwicth;
Then, implement the proxy method of CameraSwicthDelegate
to implement the device privacy mode according to business requirements. as follows:
/// The delegate method,it will be called when gets the status of the device's main switch
/// @param cameraSwicth The object of the device master switch manager
/// @param enable Whether the main switch of the device is turned on
/// @param result Request the results
- (void)cameraSwicth:(CameraSwicth *) cameraSwicth getCameraSwicth:(BOOL)enable result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets the main switch of the device
/// @param cameraSwicth The object of the device master switch manager
/// @param result Request the results
- (void)cameraSwicth:(CameraSwicth *) cameraSwicth setCameraSwicthResult:(ENUM_BOSMA_APP_RESULT)result;
Network configuration
Using the property cameraWiFi
in BosmaCamera.h
, you can modify the WiFi network configuration of the device. For specific API methods, see CameraWiFi.h
Declare the implementation class of CameraWiFiDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraWiFiDelegate>
@end
camera.cameraWiFi.delegate = self;
First, call the API method to modify the network configuration of the device, or query the list of WiFi hotspots around the device. The specific API methods are as follows:
/// Sets the WiFi information of the device
/// @param ssid The SSID of WiFi
/// @param password The password of WiFi
-(void)setCameraWiFi:(NSString * __nullable) ssid password:(NSString * __nullable) password;
/// Gets the WiFi list of searched result by the device
-(void)getCameraWiFi;
Then, implement the proxy method of CameraWiFiDelegate
, and realize the network configuration management of the device according to the business requirements. as follows:
/// The delegate method,it will be called when gets the WiFi list of searched result by the device
/// @param cameraWiFi The object of WiFi manager
/// @param wifiArray The WiFi list of searched result by the device.You can traverse this WiFi list. If the status field of a WiFi information is 1, it is the hotspot currently connected to the device. Otherwise, it is not the hotspot connected to the device
/// @param result Request the results
- (void)cameraWiFi:(CameraWiFi *) cameraWiFi getCameraWiFi:(NSArray <CameraWiFiModel *> * __nullable) wifiArray result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets the WiFi information of the device
/// @param cameraWiFi The object of WiFi manager
/// @param result The result of sending WiFi information data is not the result of WiFi configuration (whether WiFi is successfully connected)
- (void)cameraWiFi:(CameraWiFi *) cameraWiFi setCameraWiFiResult:(ENUM_BOSMA_APP_RESULT)result;
How to judge whether the new WiFi information distribution network is successful? It can be judged according to the following steps:
- Call
-(void)getCameraWiFi
to obtain the WiFi hotspot information around the device, find the hotspot A currently connected to the device in the returned WiFi list (you can judge according to thestatus
inCameraWiFiModel. h
, 1 device is currently connected, 0 is not currently connected), and then cache the hotspot A - Send a new WiFi information (SSID, Password) to device. If the information is sent successfully, disconnect the device. Otherwise, the configuration of the new WiFi information fails
- Reconnect the device after some time (it is recommended to connect every 30 seconds for a total of 3 times)
- If the connection is successful, call
-(void)getCameraWiFi
again to obtain the WiFi hotspot information around the device, and find the hotspot B currently connected to the device from the returned WiFi list. If the connection fails, the user is prompted to check whether the WiFi information configuration is successful (because it is impossible to determine whether it is successful at this time). - Compare the WiFi names of hotspot A and hotspot B. If they are different, the new WiFi information is successfully configured. If they are the same, the new WiFi information is failed to be configured.Because if the new WiFi information fails to connect, the device will use the old WiFi information to connect again
Recording mode
Use the property cameraRecord
in BosmaCamera.h
to set the recording mode management of the device, including: 24-hour recording (only supported by some devices), event recording, and no recording at any time. see CameraRecord.h
First, we need to call the API method of BosmaDeviceUtils.h
to determine whether the device supports 24-hour recording. If not, the recording method cannot provide 24-hour recording switching, as follows
/// Whether the recording mode of the device supports full-time
/// @param modelCode modelCode
+ (BOOL)isSupportFullTimeRecordWithModelCode:(NSString *)modelCode;
Declare the implementation class of CameraRecordDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraRecordDelegate>
@end
camera.cameraRecord.delegate = self;
First, call the API method to query and modify the recording mode of the device (see enumeration ENUM_BOSMA_APP_SDCARD_RECORD
). The specific API method is as follows:
/// Sets SD card record mode
/// @param mode SD card record mode
-(void)setCameraRecord:(ENUM_BOSMA_APP_SDCARD_RECORD)mode;
/// Gets SD card record mode
-(void)getCameraRecord;
typedef enum
{
BOSMA_APP_SDCARD_RECORD_CLOSE = 0x00, // Turn off the video record
BOSMA_APP_SDCARD_RECORD_EVENT = 0x01, // Only recorded when an event occurs
BOSMA_APP_SDCARD_RECORD_FULLTIME = 0x02, // 24 hours recording
BOSMA_APP_SDCARD_RECORD_ERROR
}ENUM_BOSMA_APP_SDCARD_RECORD;
Then, implement the proxy method of CameraRecordDelegate
, and realize the management of the recording mode of the device according to the business requirements. as follows:
/// The delegate method,it will be called when gets SD card record mode
/// @param cameraRecord The object of SD card record mode manager
/// @param mode SD card record mode
/// @param result Request the results
- (void)cameraRecord:(CameraRecord *) cameraRecord getCameraRecord:(ENUM_BOSMA_APP_SDCARD_RECORD) mode result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets SD card record mode
/// @param cameraRecord The object of SD card record mode manager
/// @param result Request the results
- (void)cameraRecord:(CameraRecord *) cameraRecord setCameraRecordResult:(ENUM_BOSMA_APP_RESULT)result;
Recording schedule
Using the property cameraVideoSchedule
in BosmaCamera.h
, you can set the schedule of the video recording plan, which can set the device to record video in a specific time period according to the video recording method. For specific API methods, see CameraVideoSchedule.h
Declare the implementation class of CameraVideoScheduleDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraVideoScheduleDelegate>
@end
camera.cameraVideoSchedule.delegate = self;
First, call the API method to query and modify the recording plan of the device. If the recording plan is to be modified, the plan data of the entire device needs to be passed in, and partial updates are not supported. Each schedule in the plan is a CameraScheduleModle.h
object, and the specific API methods are as follows:
/// Sets the video record schedule setting
/// @param videoSchedules The array of video record schedule
-(void)setCameraVideoSchedule:(NSArray<CameraScheduleModle *> * __nullable) videoSchedules;
/// Gets the video record schedule setting
-(void)getCameraVideoSchedule;
Then, implement the proxy method of CameraVideoScheduleDelegate
, and realize the management of the video recording plan of the device according to the business requirements. as follows:
/// The delegate method,it will be called when gets the video record schedule setting
/// @param cameraVideoSchedule The object of video record schedule manager
/// @param videoSchedules The array of video record schedule setting
/// @param result Request the results
- (void)cameraVideoSchedule:(CameraVideoSchedule *) cameraVideoSchedule getCameraVideoSchedule:(NSArray<CameraScheduleModle *> * __nullable) videoSchedules result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets the video record schedule
/// @param cameraVideoSchedule The object of video record schedule manager
/// @param result Request the results
- (void)cameraVideoSchedule:(CameraVideoSchedule *) cameraVideoSchedule setCameraVideoScheduleResult:(ENUM_BOSMA_APP_RESULT)result;
Timeline
Using the property cameraTimeline
in BosmaCamera.h
, you can query the timeline data stored on the SD card. Note: This function is only supported on specific products, such as: X1 series products, XC series products, CC series products, etc. Other products do not support. For specific API methods, see CameraTimeline.h
Declare the implementation object of CameraTimelineDelegate
in *.h
, and then set its proxy as the current object in the *.m
file, as follows:
@interface CameraLiveViewController: UIViewController ()<CameraTimelineDelegate>
@end
camera.cameraTimeline.delegate = self;
First, call the API method to query the data of the timeline from the device. as follows:
/// Gets the list of SD card video record
/// @param startTime Start timestamp of video record
/// @param endTime End timestamp of video record
/// @param offset Time zone offset
-(void)getCameraTimelineWithStartTime:(unsigned int) startTime endTime:(unsigned int) endTime offset:(int) offset;
Then, implement the proxy method of CameraTimelineDelegate
to receive the data of the timeline. After you receive the timeline data, you can plot the data on the timeline. as follows:
/// The delegate method,it will be called when gets the list of SD card video record
/// @param cameraTimeline The object of SD card video record manager
/// @param timeLineData The list of SD card video record
/// @param flagSD Whether SD card is installed. 1 is installed, 0 is not
/// @param result Request the results
- (void)cameraTimeline:(CameraTimeline *) cameraTimeline getCameraTimeline:(NSArray <CameraTimeLineModel *> * __nullable) timeLineData flagSD:(int) flagSD result:(ENUM_BOSMA_APP_RESULT)result;
Auto-tracking
Using the property cameraAutoTracking
in BosmaCamera.h
, you can manage the automatic tracking of the device, such as: query/modify the status of the automatic tracking, query/modify the target object of the automatic tracking. For specific API methods, see CameraAutoTracking.h
First, we need to determine whether the device supports automatic tracking by calling the API method of BosmaDeviceUtils.h
, as follows
/// Does the device support MD
/// @param modeCode The model code of the device
/// @param version The version of the device
+ (BOOL)isSupportMDWithModeCode:(NSString *)modeCode version:(NSString *)version;
Declare the implementation class of CameraAutoTrackingDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraAutoTrackingDelegate>
@end
camera.cameraAutoTracking.delegate = self;
First, call the API method to query whether automatic tracking is turned on. If it is turned on, get the target object parameters of automatic tracking, and then refresh the UI. If the user has modified it, then call the method of modifying the state/parameter to update the data. The specific API method is as follows:
/// Gets the status of auto tracking
-(void)getAutoTrackingStatus;
/// Switch the status of auto tracking
-(void)switchAutoTrackingStatus:(ENUM_AUTO_TRACKING_STATUS) status;
/// Gets device’s parameter of auto tracking
-(void)getAutoTrackingParams;
/// Sets device’s parameter of auto tracking
/// @param params The parameter of auto tracking
-(void)setAutoTrackingParams:(NSArray <CameraAutoTrackingModel *> *) params ;
Then, implement the proxy method of CameraAutoTrackingDelegate
to realize the automatic tracking management of equipment according to business requirements. as follows:
///The delegate method,it will be called when gets the status of auto tracking
/// @param cameraAutoTracking The object of auto tracking manager
/// @param status The status of auto tracking
- (void)cameraAutoTracking:(CameraAutoTracking *) cameraAutoTracking getAutoTrackingStatus:(ENUM_AUTO_TRACKING_STATUS)status;
/// The delegate method,it will be called when switch the auto tracking
/// @param cameraAutoTracking The object of auto tracking manager
/// @param result equest the results
- (void)cameraAutoTracking:(CameraAutoTracking *) cameraAutoTracking switchAutoTrackingStatusResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when gets the params of auto tracking
/// @param cameraAutoTracking The object of device’s auto tracking manager
/// @param autoTrackingParams The param of auto tracking
/// @param result Request the results
- (void)cameraAutoTracking:(CameraAutoTracking *) cameraAutoTracking getAutoTrackingParams:(NSArray <CameraAutoTrackingModel *> * __nullable) autoTrackingParams result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets device’s auto tracking
/// @param cameraAutoTracking The object of device’s auto tracking manager
/// @param result Request the results
- (void)cameraAutoTracking:(CameraAutoTracking *) cameraAutoTracking setAutoTrackingParamsResult:(ENUM_BOSMA_APP_RESULT)result;
Detection Area
Use the property cameraDetectionArea
in BosmaCamera.h
to manage the event detection area of the device. The number of areas can only support up to 3 areas, see CameraDetectionArea.h
Declare the implementation class of CameraDetectionAreaDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraDetectionAreaDelegate>
@end
camera.cameraDetectionArea.delegate = self;
First, call the API method first, query the data of the event detection area, and draw the UI. If the user modifies it, call the method of setting the area to update the event detection area. Generally speaking, the value of status should be DETECTION_AREA_STATUS_OPEN
, the specific API Methods as below:
/// Sets device’s active detection area
/// @param params The param of active detection area
/// @param status The status of active detection area,Recommended value DETECTION_AREA_STATUS_OPEN
-(void)setDetectionAreaParams:(NSArray <CameraDetectionAreaModel *> *) params status:(ENUM_DETECTION_AREA_STATUS) status;
/// Gets device’s active detection area
-(void)getDetectionAreaParams;
Then, implement the proxy method of CameraDetectionAreaDelegate
to implement the event detection area of the device according to business requirements. as follows:
/// The delegate method,it will be called when gets device’s active detection area
/// @param cameraDetectionArea The object of device’s active detection area manager
/// @param widthResolution The resolution width of the view.Coordinate transformation for detection area
/// @param heightResolution The resolution height of the view.Coordinate transformation for detection area
/// @param params The param of active detection area
/// @param status The status of active detection area
/// @param result Request the results
- (void)cameraDetectionArea:(CameraDetectionArea *) cameraDetectionArea width:(int)widthResolution height:(int)heightResolution getParams:(NSArray <CameraDetectionAreaModel *> * __nullable) params status:(ENUM_DETECTION_AREA_STATUS) status result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets device’s active detection area
/// @param cameraDetectionArea The object of device’s active detection area manager
/// @param result Request the results
- (void)cameraDetectionArea:(CameraDetectionArea *) cameraDetectionArea setParamsResult:(ENUM_BOSMA_APP_RESULT)result;
Event Detection
Using the property cameraEventDetection
in BosmaCamera.h
, you can query the event detection of the device, see CameraEventDetection.h
.
Note: These events do not include AI-detected events. For AI-detected events, see CameraAI.h
Declare the implementation class of CameraEventDetectionDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraEventDetectionDelegate>
@end
camera.cameraEventDetection.delegate = self;
First, call the API method to query and modify the event detection. The specific API method is as follows:
/// Set device‘s event detection.You can set which event detections the device has, and the switch of event detection
/// @param cameraEventModel Event detection settings that need to be modified
-(void)setCameraEventDetection:(CameraEventDetectionModel * __nullable) cameraEventModel;
/// Query device‘s event detection.You can query which event detections the device has, and the switch of event detection
-(void)getCameraEventDetection;
Then, implement the delegate method of CameraEventDetectionDelegate
to implement event detection settings.
/// The delegate method,it will be called when query device‘s event detection
/// @param cameraEventDetection The object of event detection manager
/// @param cameraEventModel Device‘s event detection
/// @param result equest the results
- (void)cameraEventDetection:(CameraEventDetection *) cameraEventDetection getCameraEventDetection:(CameraEventDetectionModel * __nullable) cameraEventModel result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when modify event detection settings
/// @param cameraEventDetection The object of event detection manager
/// @param result equest the results
- (void)cameraEventDetection:(CameraEventDetection *) cameraEventDetection setCameraEventDetectionResult:(ENUM_BOSMA_APP_RESULT)result;
Event Detection Parameter
Use the property cameraEventDetectionParameter
in BosmaCamera.h
to independently set a certain event detection parameter. The supported products include EX, EX PRO, EverView, and Station series, but other products are not supported. For details, see CameraEventDetectionParameter.h
Declare the implementation class of CameraEventDetectionParameterDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraEventDetectionParameterDelegate>
@end
camera.cameraEventDetectionParameter.delegate = self;
First, call the API method to query and modify the detailed parameters of event detection. The specific API method is as follows:
/// Setting event detection's parameter
/// @param eventModel The parameter of event detection
- (void)setParameter:(CameraEventDetectionParameterModel *)eventModel;
/// Get the event detection's parameter
- (void)getParameter:(EVENT_PROPERTY)type;
Then, implement the delegate method of CameraEventDetectionParameterDelegate
to implement detailed settings for event detection.
/// The delegate method,it will be called when setting event detection's parameter
/// @param cameraEventDetection The managment of event detection
/// @param result The result of setting parameter of event detection
- (void)cameraEventDetectionParameter:(CameraEventDetectionParameter *)cameraEventDetection setParameterResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when getting event detection's parameter
/// @param cameraEventDetection The managment of event detection
/// @param parameter The parameter of event detection
/// @param result The result of getting parameter of event detection
- (void)cameraEventDetectionParameter:(CameraEventDetectionParameter *)cameraEventDetection getParameter:(CameraEventDetectionParameterModel * __nullable)parameter result:(ENUM_BOSMA_APP_RESULT)result;
If you need the event type to be motion detection, you can set the detection range. If it is manual setting, please follow the above process, if it is automatic adjustment, please follow the following steps:
First, call the following method to control the state of automatic adjustment of motion detection parameters
/// Controls the state of automatically adjust motion detection's parameters
- (void)setParameterControl:(ENUM_EVENT_DETECTION_PARAMETER_AUTO_STATUS)status;
Then, implement the delegate method of CameraEventDetectionParameterDelegate
to monitor the status of automatic adjustment of motion detection parameters.
/// The delegate method,it will be called when the state of automatically adjust the motion detection‘s changes
/// @param cameraEventDetection The managment of event detection
/// @param parameter The parameter of event detection
/// @param status The status of automatic adjustment
/// @param result The result of getting parameter of event detection
- (void)cameraEventDetectionParameter:(CameraEventDetectionParameter *)cameraEventDetection parameter:(CameraEventDetectionParameterModel * __nullable)parameter controlStatus:( ENUM_EVENT_DETECTION_PARAMETER_AUTO_STATUS)status result:(ENUM_BOSMA_APP_RESULT)result;
Event Filter
Using the property cameraEventFilter
in BosmaCamera.h
, you can manage the event filters of the device, such as: humanoid filter, motion detection filter, etc. The humanoid filter starts event detection when the device detects that someone has passed by. ;Motion detection filter is to start event detection after the device detects motion detection, see CameraEventFilter.h
Declare the implementation class of CameraEventFilterDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraEventFilterDelegate>
@end
camera.cameraEventFilter.delegate = self;
First, call the API method to query the filter configuration. If the user modifies it, call the API method to update the configuration. The specific API method is as follows:
/// Sets event filter of the device. Select the appropriate event filter according to your use environment, which can reduce false alarms
/// @param filter The type of event filter, refer to ENUM_BOSMA_APP_EVENT_FILTER,Motion detection filter, suitable for non-downtown houses, scenes with few people coming and going in front of the house.Human-shaped filter, suitable for non-downtown houses, scenes with few people coming and going in front of the house.
-(void)setCameraEventFilter:(ENUM_BOSMA_APP_EVENT_FILTER)filter;
/// Gets event filter of the device
-(void)getCameraEventFilter;
Then, implement the delegate method of CameraEventFilterDelegate
to manage the event filter.
/// The delegate method,it will be called when gets whether the device‘s event filter
/// @param cameraEventFilter The object of event filter manager
/// @param filter The type of event filter
/// @param result Whether the event filter was successfully acquired
- (void)cameraEventFilter:(CameraEventFilter *) cameraEventFilter getEventFilter:(ENUM_BOSMA_APP_EVENT_FILTER) filter result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when sets whether the device‘s event filter
/// @param cameraEventFilter The object of event filter manager
/// @param result Whether the setting is successful
- (void)cameraEventFilter:(CameraEventFilter *) cameraEventFilter setEventFilterResult:(ENUM_BOSMA_APP_RESULT)result;
Ai Service
Using the property cameraAI
in BosmaCamera.h
, you can manage the Ai services of the device, such as: Ai testing, Ai event detection, etc., see CameraAI.h
Declare the implementation class of CameraAIDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraAIDelegate>
@end
camera.cameraAI.delegate = self;
If you need to query and modify Ai event detection, you can implement it according to the following process. The API method is as follows:
/// Get the ability set of Ai recognition
-(void) getAiAbilityList;
/// Set the ability parameters of Ai recognition
/// @param parameter Ai recognition parameters
- (void)setAiAbilityParameter:(CameraEventSwitchModel *)parameter;
Then, implement the proxy method of CameraAIDelegate
to realize the management of device Ai event detection.
/// The delegate method,it will be called when get the ability parameters of Ai recognition
/// @param cameraAI The object of CameraAI manager
/// @param aiArray The ability list
/// @param result result
- (void)cameraAI:(CameraAI *)cameraAI getAbilityArray:(NSArray <CameraEventSwitchModel *> * __nullable) aiArray result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when set the ability parameters of Ai recognition
/// @param cameraAI The object of CameraAI manager
/// @param result result
- (void)cameraAI:(CameraAI *)cameraAI setAbilityParameterResult:(ENUM_BOSMA_APP_RESULT)result;
If Ai test needs to be performed, for example: querying the Ai test status, modifying the Ai test status, and setting the detection object of the Ai test, it can be implemented according to the following process. The API method is as follows:
/// Get Ai test mode
-(void) getAiTest;
/// Set the parameters of Ai test mode
/// @param params The parameters of Ai test mode
-(void) setAiTestParameter:(NSArray <CameraEventSwitchModel *> *) params;
/// Get the parameters of Ai test mode
-(void) getAiTestParameter;
Then, implement the delegate method of CameraAIDelegate
to implement the device Ai test.
/// The delegate method, this method will be called when get/set the parameters of Ai test mode
/// @param cameraAI The object of CameraAI manager
/// @param mode The control of the Ai test
/// @param result equest the results
- (void)cameraAI:(CameraAI *)cameraAI testMode:(AI_TEST_MODE) mode result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when set the parameters of Ai test mode
/// @param cameraAI The object of CameraAI manager
/// @param result result
- (void)cameraAI:(CameraAI *)cameraAI setTestModeParameterResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when get the parameters of Ai test mode
/// @param cameraAI The object of CameraAI manager
/// @param aiArray The ability list
/// @param result result
- (void)cameraAI:(CameraAI *)cameraAI getTestModeParameter:(NSArray <CameraEventSwitchModel *> * __nullable) aiArray result:(ENUM_BOSMA_APP_RESULT)result;
Floodlight (Video doorbell)
Using the property doorbellFloodLight
in BosmaCamera.h
, you can manage the floodlight module of the device, for example: manually turn on/off the light, read the light status, automatically turn on the light (not recommended), see DoorbellFloodLight.h
Declare the implementation class of DoorbellFloodLightDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<DoorbellFloodLightDelegate>
@end
camera.doorbellFloodLight.delegate = self;
First, call the API method to manage the floodlight of the device, such as querying whether the light is on, or turning the indicator light on/off, etc. The specific API methods are as follows:
/// Get the status of floodlight
- (void)queryFloodLightStatus;
/// Manually turn on/of the floodlight
/// @param status 1 on ,0 off
- (void)switchFloodLightStatus:(BOOL)status;
/// Set the automatic control of the floodlight. If you turn on this control, at night, if the PIR detects someone passing by, it will automatically light up
/// @param enable 1 on ,0 off
- (void)updateFloodLightAutoControl:(BOOL)enable;
Then, implement the delegate method of DoorbellFloodLightDelegate
to manage the device floodlights.
/// The delegate method,it will be called when send a command get doorbell floodlight status
/// @param doorbellFloodLight doorbellFloodLight
/// @param exist Does PIR light exist,1 yes,0 no
/// @param autoCtrl The automatic control of the PIR light, 0 off, 1 on
/// @param status The status of the PIR light, 0 off, 1 on
/// @param result result
- (void)doorbellFloodLight:(DoorbellFloodLight *)doorbellFloodLight lightExist:(NSUInteger)exist autoCtrl:(NSUInteger)autoCtrl status:(NSUInteger)status result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command manually turn on/of the floodlight
/// @param doorbellFloodLight doorbellFloodLight
/// @param result result
- (void)doorbellFloodLight:(DoorbellFloodLight *)doorbellFloodLight switchStatusResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command set the automatic control of the floodlight
/// @param doorbellFloodLight doorbellFloodLight
/// @param result result
- (void)doorbellFloodLight:(DoorbellFloodLight *)doorbellFloodLight updateAutoControlResult:(ENUM_BOSMA_APP_RESULT)result;
Leave mode (Video Doorbell)
When the device is online, you can complete the message mode setting of the video doorbell through DoorbellWorkMode.h
, as follows
Create the DoorbellWorkMode.h
object and declare the object of the delegated agent
@interface CameraSettingViewController : NSObject<DoorbellWorkModeDelegate>
@end
DoorbellWorkMode *doorbellWorkMode = [[DoorbellWorkMode alloc] init];
doorbellWorkMode.delegate = self;
Call the member method, query the status of the message mode, and implement the proxy method
/// Get the work mode of doorbell
/// @param deviceID The device id,not pid
- (void)queryDoorbellLeaveMode:(NSString *) deviceID;
/// The delegate method,it will be called when send a command get doorbell leave mode
/// @param doorbellWorkMode doorbellWorkMode
/// @param leaveMode YES no,no off
/// @param result refer BosmaErrorCodeDefine.h
- (void)doorbellWorkMode:(DoorbellWorkMode *)doorbellWorkMode leaveMode:(BOOL)leaveMode leaveModeQueryResult:(int)result;
Call the member method, update the state of the message mode, and implement the proxy method
/// Set the work mode of doorbell
/// @param leaveMode The leave mode,YES on,NO off
/// @param deviceID The device id,not pid
- (void)updateDoorbellLeaveMode:(BOOL)leaveMode deviceID:(NSString *) deviceID;
/// The delegate method,it will be called when send a command set doorbell leave mode
/// @param doorbellWorkMode doorbellWorkMode
/// @param result refer BosmaErrorCodeDefine.h
- (void)doorbellWorkMode:(DoorbellWorkMode *)doorbellWorkMode leaveModeUpdateResult:(int)result;
Visitor Information (Video Doorbell)
Using the property doorbellOperation
in BosmaCamera.h
, the visitor's visit information (for example: answering, hanging up) can be processed. When a visitor presses the doorbell button, the device will send out a visiting message. When the App receives this message, it needs to process the message. If the user chooses to hang up, the App needs to use the method provided by DoorbellOperation.h
to send a user hang-up message to the device; if the user chooses to answer, it needs to use the method of CameraSpeakerAudio.h
to start the call (see the introduction of the call function).
Declare the implementation class of CameraLocalDownloadDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraLiveViewController: UIViewController ()<DoorbellOperationDelegate>
@end
camera.doorbellOperation.delegate = self;
First, call the API method to send the user hangup message, as follows:
/// When you receive the visitor's information, if you want to reject the visitor's visit, call this method
- (void)doorbellRefuseTalk;
Then, implement the delegate method of DoorbellOperationDelegate
, where you can do state switching
/// The delegate method,it will be callback when you refuse a visitor
/// @param doorbellOperation doorbellOperation
/// @param result result
- (void)doorbellOperation:(DoorbellOperation *)doorbellOperation refuseTalkResult:(ENUM_BOSMA_APP_RESULT)result;
Face ID(Cloud)
The face ID in the cloud is currently only suitable for products such as Sentry, EX, and EX Pro. If the product is Home Station Pro, please use the face ID on the device. When the device is online, you can complete the message mode setting of the video doorbell through CameraFaceIDCloud.h
, as follows
Create the CameraFaceIDCloud.h
object and declare the object of the proxy agent
First, create the CameraFaceIDCloud.h
object
CameraFaceIDCloud *cameraFaceIDCloud = [CameraFaceIDCloud sharedInstance];
Then, call the member method and receive data in the callback block to complete the related functions. as follows:
/// Import the user's FaceID to a device without creating a new one
/// @param devicePid The PID of the device
/// @param faceIDArray The FaceID' id array of target import
/// @param block Operation result callback
-(void)addFaceIDFromUserToDevice:(NSString *)devicePid faceIDs:(NSArray <NSString *> *)faceIDArray block:(CameraFaceIDCloudOprationBlock)block;
/// Upload an image of FaceID on device. If it is created, the parameter faceID can be nil; if it is modified, the parameter faceID cannot be nil;
/// @param devicePid The PID of the device
/// @param faceID The FaceID's id
/// @param name The FaceID's name
/// @param image The upload target image
/// @param facingType The type of the picture
/// @param block Operation result callback
-(void)uploadFaceIDImageDevice:(NSString *) devicePid faceID:(nullable NSString *) faceID name:(NSString *) name image:(UIImage *)image facingType:(CouldFaceFacingType) facingType block:(CameraFaceIDCloudImageUploadBlock)block ;
/// Upload an image of FaceID on user Information . If it is created, the parameter faceID can be nil; if it is modified, the parameter faceID cannot be nil;
/// @param faceID The FaceID's id
/// @param name The FaceID's name
/// @param image The upload target image
/// @param facingType The type of the picture
/// @param block Operation result callback
-(void)uploadFaceIDImageUser:(nullable NSString *) faceID name:(NSString *) name image:(UIImage *)image facingType:(CouldFaceFacingType) facingType block:(CameraFaceIDCloudImageUploadBlock)block ;
/// Remove FaceID on device
/// @param faceID The FaceID's id
/// @param block Operation result callback
-(void)deleteFaceIDDevice:(NSString *)faceID block:(CameraFaceIDCloudOprationBlock)block;
/// Remove FaceID on user Information
/// @param faceID The FaceID's id
/// @param block Operation result callback
-(void)deleteFaceIDUser:(NSString *)faceID block:(CameraFaceIDCloudOprationBlock)block;
/// Update the name of FaceID on user Information or device
/// @param faceID The FaceID's id
/// @param name The FaceID's name
/// @param block Operation result callback
-(void)updateFaceIDName:(NSString *)faceID name:(NSString *)name block:(CameraFaceIDCloudOprationBlock)block ;
/// Query the picture list of FaceID on user Information or device
/// @param faceID The FaceID's id
/// @param block Operation result callback
-(void)queryFaceIDImageList:(NSString *)faceID block:(CameraFaceIDCloudImageListBlock)block;
#pragma mark 1.4 FaceID 列表查询【设备】
/// Query the FaceID list on device
/// @param devicePID The PID of the device
/// @param block Operation result callback
-(void)queryFaceIDListDevie:(NSString *)devicePID block:(CameraFaceIDCloudListBlock)block;
#pragma mark 1.10 FaceID 列表查询【用户】
/// Query the FaceID list on user Information
/// @param block Operation result callback
-(void)queryFaceIDListUser:(CameraFaceIDCloudListBlock)block;
Face ID(Device)
The Face ID on the device is currently only suitable for Home Station Pro products, and other products can only use the Face ID in the cloud. We can use the property cameraFaceID
in BosmaCamera
to manage the local face ID of the device, see CameraFaceID.h
Declare the implementation class of CameraFaceIDDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<CameraFaceIDDelegate>
@end
camera.cameraFaceID.delegate = self;
First, call the API method to complete the functions of adding, modifying, querying and deleting the face ID, as follows:
/// Add a face ID data
/// @param image Image data of face ID
/// @param faceName Face ID name
- (void)addFaceIDWithImage:(UIImage *)image faceName:(NSString *)faceName faceType:(ENUM_BOSAM_FACE_TYPE)faceType;
/// Send FaceID image data
/// @param faceID Face ID
/// @param image Image data
/// @param faceType FaceID type
- (void)updateImageWithFaceID:(NSString *)faceID image:(UIImage *)image faceType:(ENUM_BOSAM_FACE_TYPE)faceType;
/// Update a face ID data
/// @param faceID Face ID
/// @param faceName Face ID name
-(void) updateFaceID:(NSString *)faceID faceName:(NSString *)faceName;
/// Get face ID list
-(void) getFaceIDList;
/// Remove a face ID data
/// @param faceID Face ID
-(void) removeFaceID:(NSString *)faceID;
Then, implement the delegate method of CameraFaceIDDelegate
, receive data, and complete your business requirements.
/// The delegate method,it will be called when add a face ID data
/// @param cameraFaceID The object of CameraFaceID manager
/// @param errorType errorType
/// @param result result
- (void)cameraFaceID:(CameraFaceID *)cameraFaceID errorType:(ENUM_FACE_ADD_RET_CODE)errorType faceID:(nullable NSString *)faceID addFaceIDResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when update a face ID data
/// @param cameraFaceID The object of CameraFaceID manager
/// @param errorType errorType
/// @param result update a face ID data result
- (void)cameraFaceID:(CameraFaceID *)cameraFaceID errorType:(ENUM_FACE_ADD_RET_CODE)errorType updateFaceIDResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when update face id name
/// @param cameraFaceID The object of CameraFaceID manager
/// @param result result
- (void)cameraFaceID:(CameraFaceID *)cameraFaceID updateFaceIDNameResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when get faceID list
/// @param cameraFaceID The object of CameraFaceID manager
/// @param result result
- (void)cameraFaceID:(CameraFaceID *)cameraFaceID getFaceIDArray:(NSArray <CameraFaceIDModel *> * __nullable) faces result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when remove face id
/// @param cameraFaceID The object of CameraFaceID manager
/// @param result result
- (void)cameraFaceID:(CameraFaceID *)cameraFaceID removeFaceIDResult:(ENUM_BOSMA_APP_RESULT)result;
Touch ID(Video Doorbell)
Using the property doorbellTouchID
in BosmaCamera
, this property can complete the management of TouchID of the video doorbell, including: TouchID application (purpose), remote restart of fingerprint module hardware, and addition, deletion, modification, query of TouchID data, etc., see DoorbellTouchID .h
Declare the implementation class of DoorbellTouchIDDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<DoorbellTouchIDDelegate>
@end
camera.doorbellTouchID.delegate = self;
If it is the addition, deletion, modification, and query of TouchID, it can be implemented according to the following process.
First, call the API method as follows:
/// Start collect the data of touchID
- (void)collectStart;
/// Stop collect the data of touchID
- (void)collectStop;
/// Query the progress of collecting touchID's data
- (void)collectProgressQuery;
/// Confirm that the progress of collecting touchID's data has been received, when you query the progress of collection
- (void)collectProgressEnsure;
/// Save touch ID
/// @param touchID When the TouchID collection is 100% complete, the Touch ID you get.
/// @param name TouchID‘s name
- (void)saveTouchID:(NSString *)deviceID touchID:(NSString *) touchID name:(NSString*) name;
/// Remove touch ID
/// @param touchIDModel TouchID model
- (void)deleteTouchID:(CameraTouchIDModel *)touchIDModel;
/// Query list of touch ID
/// @param deviceID The device id,not pid
- (void)queryTouchIDList:(NSString *) deviceID;
/// Update the touch ID
/// @param touchIDModel TouchID model
/// @param name TouchID's name
- (void)updateTouchID:(CameraTouchIDModel *)touchIDModel name:(NSString*)name;
Then, implement the delegate method of DoorbellTouchIDDelegate
, where your business needs are implemented.
/// The delegate method,it will be callback when send a message to start collect the data of touchID.
/// @param doorbellTouchID doorbellTouchID
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID collectStartResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be callback when send a message to stop collect the data of touchID
/// @param doorbellTouchID doorbellTouchID
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID collectStopResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be callback when you receive a command to release your finger while collecting touchID's data
/// @param doorbellTouchID doorbellTouchID
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID collectReleaseFingerResult:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be callback when send a message to query the progress of collecting touchID's data
/// @param doorbellTouchID doorbellTouchID
/// @param progress The progress of collecting data, value form 10 to 999
/// @param touchID Fingerprint id
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID collectProgress:(int)progress touchID:(NSString *__nullable)touchID result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be callback when send a message to notify the fingerprint module to save fingerprint data
/// @param doorbellTouchID doorbellTouchID
/// @param touchIDModel The touchID
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID saveTouchID:(CameraTouchIDModel *__nullable) touchIDModel result:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
/// The delegate method,it will be callback when send a message to notify the fingerprint module to remove fingerprint data
/// @param doorbellTouchID doorbellTouchID
/// @param result 0 successful, others fail
/// @param error Error message, can be nil
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID deleteTouchIDResult:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
/// The delegate method,it will be callback when send a message to notify the fingerprint module to update the fingerprint data
/// @param doorbellTouchID doorbellTouchID
/// @param result 0 successful, others fail
/// @param error Error message, can be nil
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID updateTouchIDResult:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
/// The delegate method,it will be callback when send a command to get the fingerprint data
/// @param doorbellTouchID doorbellTouchID
/// @param dataArray Array of fingerprint data
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID touchIDArray:(NSArray <CameraTouchIDModel *> *)dataArray result:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
/// The delegate method,it will be callback when command call back error
/// @param doorbellTouchID doorbellTouchID
/// @param result 1 fail 0 success
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID errorReplyCMDWithResult:(ENUM_BOSMA_APP_RESULT)result;
If it is the management of the application (purpose) of TouchID, it can be realized according to the following process.
First, call the API method. If, as follows:
/// Query touchID's scope, eg: unlock,undefended or defended.
/// @param deviceID The device id,not pid
- (void)queryTouchIDScope:(NSString *) deviceID;
/// Update touchID's scope, eg: unlock,undefended or defended.
/// @param deviceID The device id,not pid
/// @param scopeUnlock The scope of unlocked. If you don't need to modify it, can be nil
/// @param scopeSecurity The scope of security. If you don't need to modify it, can be nil
- (void)updateTouchIDScope:(NSString *) deviceID scopeUnlock:(CameraTouchIDScopeUnlockModel *__nullable) scopeUnlock scopeSecurity:(CameraTouchIDScopeSecurityModel *__nullable) scopeSecurity;
Then, implement the delegate method of DoorbellTouchIDDelegate
, where your business needs are implemented.
/// The delegate method,it will be callback when send a message to query touchID's scope.
/// @param doorbellTouchID doorbellTouchID
/// @param moudleMAC Fingerprint moudle's Mac
/// @param unlock The scope of unlocked. If it is nil, it means that the smart lock has not been bound, otherwise the smart lock has been bound
/// @param security The scope of security
/// @param result Query result, 0 successful, others fail
/// @param error Error message, can be nil
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID queryTouchIDScope:(NSString *__nullable)moudleMAC usedForUnlock:(CameraTouchIDScopeUnlockModel *__nullable)unlock usedForSecurity:(CameraTouchIDScopeSecurityModel *__nullable)security result:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
/// The delegate method,it will be callback when send a message to uqdate touchID's scope.
/// @param doorbellTouchID doorbellTouchID
/// @param result 0 successful, others fail
/// @param error Error message, can be nil
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID updateTouchIDScopeResult:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
Since the video doorbell is installed, it is troublesome to remove it. If you need to restart the fingerprint module remotely in order to fix some unknown problems, you can follow the process below.
First, call the API method. If, as follows:
/// Restart the fingerprint module of the doorbell. If there is an unknown problem with the fingerprint module of your doorbell, you can use this method to try to solve the problem
/// @param deviceID The device id,not pid
- (void)restartFingerprintMoudle:(NSString *) deviceID;
Then, implement the delegate method of DoorbellTouchIDDelegate
, where your business needs are implemented.
/// The delegate method,it will be callback when send a message to restart the fingerprint module of the doorbell
/// @param doorbellTouchID doorbellTouchID
/// @param result 0 successful, others fail
/// @param error Error message, can be nil
- (void)doorbellTouchID:(DoorbellTouchID *)doorbellTouchID restartFingerprintMoudleResult:(ENUM_BOSMA_APP_RESULT)result error:(NSString *__nullable)error;
Mechanical Doorbell (Video Doorbell)
Using the property doorbellExternal
in BosmaCamera.h
, you can allow/disable the device to use the external mechanical doorbell. Note: If the external doorbell is not installed, please do not enable this option, otherwise it may cause a fire when the doorbell button of the smart doorbell is pressed. If you are not sure if your external doorbell is installed correctly, please consult a professional electrician or contact our customer support. Remember! Remember! Remember! See DoorbellExternal.h
Declare the implementation class of DoorbellExternalDelegate
in *.h
, and then set the proxy object in the *.m
file, as follows:
@interface CameraSettingViewController: UIViewController ()<DoorbellExternalDelegate>
@end
camera.doorbellExternal.delegate = self;
First, call the API method to query and modify the linkage support of the mechanical door ring, as follows:
/// Get the open state of the mechanical doorbell
- (void)doorbellExternalRequestState;
/// Set the open state of the mechanical doorbell
/// @param state The open state of the mechanical doorbell, 0 off, 1 on
- (void)doorbellExternalSetupWithState:(int)state;
Then, implement the delegate method of DoorbellExternalDelegate
, where you can do state switching
/// The delegate method,it will be called when send a command get the open state of the mechanical doorbell
/// @param doorbellExternal The object of the doorbell to mechanical doorbell settings
/// @param state The open state of the mechanical doorbell, 0 off, 1 on
/// @param result Response result
@optional
- (void)doorbellExternal:(DoorbellExternal *)doorbellExternal switchState:(int)state result:(ENUM_BOSMA_APP_RESULT)result;
/// The delegate method,it will be called when send a command set the open state of the mechanical doorbell
/// @param doorbellExternal The object of the doorbell to mechanical doorbell settings
/// @param result Response result
@optional
- (void)doorbellExternal:(DoorbellExternal *)doorbellExternal setupSwitchStateResult:(ENUM_BOSMA_APP_RESULT)result;
Submodule (Video Doorbell)
Sentry's submodules can be freely assembled. We can query the submodules through DoorbellSubMoudle.h
, as follows
Create the DoorbellSubMoudle.h
object and declare the object of the proxy agent
@interface CameraSettingViewController : NSObject<DoorbellSubMoudleDelegate>
@end
DoorbellSubMoudle *doorbellSubMoudle = [DoorbellSubMoudle sharedInstance];
doorbellSubMoudle.delegate = self;
Call member methods to query the status of submodules and implement proxy methods
/// Get doorbell sub-moudle list
/// @param deviceID The device id,not pid
- (void)querySubMoudleList:(NSString *) deviceID;
/// The delegate method,it will be called when send a command get doorbell accessory list
/// @param doorbellSubMoudle doorbellAccessory
/// @param subMoudle subMoudleList
/// @param result result
- (void)doorbellSubMoudle:(DoorbellSubMoudle *)doorbellSubMoudle subMoudle:(BosmaDeviceMoudleModel * __nullable)subMoudle result:(ENUM_BOSMA_APP_RESULT)result;
Linkage management (Smart lock)
If your product has a smart door lock (e.g. Aegis), it can be linked with a video doorbell (e.g. Sentry). When you are not at home, if there is a visitor, when you press the doorbell, you can check the identity of the specific visitor, and then unlock or lock remotely. details as follows
Create the DoorbellLock.h
object, declare the object of the delegated agent
DoorbellLock *doorbellLock = [DoorbellLock sharedInstance];
First, call the member method and bind the smart door lock (such as Aegis) with the video doorbell (such as Sentry) before remote unlocking can be performed. You can also unbind them at any time. as follows:
/// Bind doorbell and smart lock. Once the binding is successful, the default‘s scope is to unlock. Currently supports Sentry, Aegis binding
/// @param lockPid The PID of the smart lock waiting to be bound can be obtained from the device information
/// @param lockMAC The MAC of the smart lock waiting to be bound can be obtained from the device information
/// @param doorbellPid The PID of the doorbell waiting to be bound can be obtained from the device information
/// @param doorbellFBMAC The MAC of the doorbell‘s fingerprint module waiting to be bound can be obtained from the device information
/// @param doorbellLockBindBlock Callback for binding result
-(void) bindDoorbellLock:(NSString *)lockPid lockMac:(NSString *)lockMAC doorbellPid: (NSString *)doorbellPid doorbellFingerprintMAC:(NSString *)doorbellFBMAC doorbellLockBindBlock:(DoorbellLockBindBlock)doorbellLockBindBlock;
/// Unbind doorbell and smart lock. Currently supports Sentry, Aegis binding
/// @param lockPid The PID of the smart lock waiting to be bound can be obtained from the device information
/// @param lockMAC The MAC of the smart lock waiting to be bound can be obtained from the device information
/// @param doorbellPid The PID of the doorbell waiting to be bound can be obtained from the device information
/// @param doorbellFBMAC The MAC of the doorbell‘s fingerprint module waiting to be bound can be obtained from the device information
/// @param doorbellLockUnBindBlock Callback for unbinding result
-(void) unbindDoorbellLock:(NSString *)lockPid lockMac:(NSString *)lockMAC doorbellPid: (NSString *)doorbellPid doorbellFingerprintMAC:(NSString *)doorbellFBMAC doorbellLockUnBindBlock:(DoorbellLockUnBindBlock)doorbellLockUnBindBlock;
If you need to perform remote unlocking/locking operations, you need to use the related classes of the BosmaLock
module to complete them. The BosmaCamera
module does not provide related API methods for the time being. The simple process is as follows (see the user guide of the BosmaLock
module for the detailed process):
Create BosmaLock.h
object
BosmaLock *bosmaLock = [BosmaLock sharedInstance];
Configure the basic data of BosmaLock
, this step is necessary, otherwise BosmaLock
cannot be used normally
/// Initialize the necessary data
/// @param devicePid pid
/// @param deviceMac macAddress
- (void)configureDeivceWithDevicePid:(NSString*)devicePid deiceMac:(nullable NSString*)deviceMac;
Before performing the unlocking/locking operation, you need to query the current lock status of the smart door lock (locked or unlocked)
/// Query the status of the device by remote. If your door lock has been bound to a linkage device, then you can use this method, otherwise you cannot use it
/// @param callback status Info
- (void)remoteQueryStatusCallback: (BSLockRemoteLinkResult)callback;
Finally, according to the current lock state of the smart door lock, the opposite operation is performed. If the smart door lock is already locked, unlock it, otherwise lock it.
/// Lock/Unlock the device by remote. If your door lock has been bound to a linkage device, then you can use this method, otherwise you cannot use it
/// @param operation Device operation type
/// @param linkageDevicePid The device's pid of the linkage device,For example:Sentry or gateway
/// @param callback result callBack
- (void)remoteOperation:(LOCK_OPERATION_TYPE) operation linkageDevicePid:(nullable NSString*)linkageDevicePid callback:(BSLockRemoteOperationResult)callback;