Smart Camera products
mart Camera module belongs to the business layer, which mainly provides support for intelligent IPC Camera series products, Smart Doorbell series products, Station series products, Subdevice series products, EX series products, etc.
Before you can use the camera, you must add the device first. Please see the sample demo for detailed usage guidelines.
After the device is added, you will get the device information DeviceModel
, which is used to connect the device
Device Connection Management
Initialize the connections and commands, which can be called once in Application.
ApiP2pCmdController.INSTANCE.initSDK(MyApplication.getApplication());
Initialize IPC LiveView business, Used for LiveView's play-pause and other business control. Here we use DeviceModel
to create a new instance of LiveViewBusiness
deviceModel = getIntent().getParcelableExtra(SDKConstantValue.EXTRA_DEVICE_MODEL);
liveViewBusiness = new LiveViewBusiness(deviceModel.getDeviceId(), deviceModel.getDevicePassword(), "", "", "", "", deviceModel.getModelCode(), deviceModel.getDeviceVersion(), deviceModel.getOwnerTinyuid());
/**
* Start Create new LiveView business
* @param endpointDeviceId endpoint device id
* @param endpointDevicePwd endpoint device Pwd
* @param gatewayDeviceId gatewayDevice id
* @param gatewayDevicePwd gatewayDevice Pwd
* @param gatewayDevicePid gatewayDevice pid
* @param endpointDeviceMac endpoint device mac
* @param endpointDeviceMacModelCode endpoint modelCode
* @param endpointDeviceHardWareVersion endpoint device hardwareVersion
* @param endpointDeviceOwnerTinyuid endpoint device ownerTinyuid
*/
public LiveViewBusiness(String endpointDeviceId, String endpointDevicePwd, String gatewayDeviceId, String gatewayDevicePwd, String gatewayDevicePid, String endpointDeviceMac, String endpointDeviceMacModelCode, String endpointDeviceHardWareVersion, String endpointDeviceOwnerTinyuid)
Initialize video surface CTextureView
liveViewBusiness.initVideoParams(textureView, surfaceContainer);
Connected to device and start live view
liveViewBusiness.launchConnect((liveViewBusiness, bean) -> live());
stop live view in onPuase
, which will stop receiving video data streaming , and destroy TextureView, that you can start another video in the next activity(if needed).
liveViewBusiness.destroyLiveView();
Reconnect to device in onResume
liveViewBusiness.reInitVideoParams(textureView, surfaceContainer, null);
liveViewBusiness.launchConnect((liveViewBusiness, bean) -> live());
Disconnect and quit live view when leaving the activity
ipCameraControllerWrapper.quitVideoDecode();
Device Settings
for device control, parameter setting, etc. The DeviceSettingCommander
class is required.
Initialize DeviceSettingCommander
. Before control device, it should be connected.
/***
* Create DeviceSettingCommander with device you have bind
*
* @param endpointDeviceId device id, can not be empty
* @param endpointDevicePwd device password, can not be empty
* @param gatewayDeviceId if device gatewayPid not empty, this value is the master gateway device's deviceId, cannot be empty
* @param gatewayDevicePwd if device gatewayPid not empty, this value is the master gateway device's devicePassword , cannot be empty
* @param gatewayDevicePid device gatewayPid, maybe empty
* @param endpointDeviceMac device mac, maybe empty
* @param endpointDeviceMacModelCode device modelCode
*/
public DeviceSettingCommander(String endpointDeviceId, String endpointDevicePwd, String gatewayDeviceId, String gatewayDevicePwd, String gatewayDevicePid, String endpointDeviceMac, String endpointDeviceMacModelCode) {
All response entities , will available in the API documents
1. Live Video and Playback
See the LiveViewActivity
in the sample for details. The specific implementation logic is in LiveViewBusiness
, which includes video live, video playback, voice intercom, video capture, video recording, etc.
/**
* Video snapshot(Take a snapshot of video)
*
* @param savePath path to save snapshot
* @return
*/
public boolean videoScreenshot(String savePath)
2. Control device turning(PTZ)
Control the camera to turn left or right, only for devices that support PTZ control
Implementation Logic is in LiveViewBusiness
/**
* PTZ controller
* @param listener ptz status listener
* See{@link PtzStatusListener}
* @mode the mode of ptz controller See
* {@link CommandType#TURN_LEFT},{@link CommandType#TURN_RIGHT}
* {@link CommandType#LONG_TURN_LEFT},{@link CommandType#LONG_TURN_RIGHT}
* {@link CommandType#TURN_STOP
*/
public void rotateLeftOrRight(byte mode, PtzStatusListener listener)
3. Talk & Call
Call: Full-duplex intercom, supporting simultaneous transmission of audio and reception of audio data
Talk: Half-duplex intercom, only supports sending audio data
Implementation Logic is in LiveViewBusiness
/**
* open audio listener or voiceIntercom
* @param channelId device connection channelId
* @param sessionId device connection sessionId
* @param controlCmd the mode of voice controller. See
* {@link CommandType#TYPE_INTERCOM}}, {@link CommandType#TYPE_LISTEN}}
* {@link CommandType#TYPE_SPEAKER}}
* @param listener open audio listener or voiceIntercom callback
* See {@link OpenVoiceIntercomListener}
*/
public void openVoiceIntercom(int channelId, int sessionId, byte controlCmd, OpenVoiceIntercomListener listener)
/**
* close audio listener or voiceIntercom
* @param controlCmd the mode of voice controller
* @param audioSendChannel voice controller audio see channel
* @param isSendCommand current command send or not
* @param listener close audio listener or voiceIntercom callback
*/
public void closeVoiceIntercom(int sessionId, byte controlCmd, int audioSendChannel, boolean isSendCommand, CloseVoiceIntercomListener listener)
4. Listening
Listen to the sound recorded on the device side
Implementation Logic is in LiveViewBusiness
/**
* Turn on audio (listening to device voice)
* @param channelId Device connection channelId
* @param listener Device audio callback
*/
public void openAudioPlay(int channelId, OpenAudioPlayListener listener)
/**
* Turn off audio
*/
public void closeAudioPlay(CloseAudioPlayListener listener)
5. Starlight mode (color night vision)
With starlight mode on, color video effects can be displayed at night in darker environments, instead of black and white video
Implementation Logic is inDeviceSettingCommander
, which is in FrameworkCommandDemoActivity
of sample
/**
* Query device night color vision
* @return
*/
public BosmaCall<APP_NIGHT_VISION_RESP> getNightModel()
/**
* Set device night color vision
* @return
*/
public BosmaCall<FWCommonResponse> translateNightModel(byte enable)
6. Device voice and siren
Device voice: You can make the device play commonly used voices (device Reset, reboot, voice during adding), and play different voices depending on the parameters passed in
Device siren: Let the device play the siren sound
Implementation Logic is in LiveViewBusiness
/**
* open camera voice
* @param ePrompt voice type see {@link CommandType#SIREN_ALARM_AUDIO}
* @param eLangType specify the language in which the alarm sounds will be broadcast
* @param listener open siren alarm callback
*/
public void openSirenAlarm(byte ePrompt, byte eLangType, OpenAlarmListener listener)
/**
* close siren alarm
* @param ePrompt voice type
* @param eLangType specify the language in which the alarm sounds will be broadcast
* @param listener close siren alarm callback
*
*/
public void closeSirenAlarm(byte ePrompt, byte eLangType, CloseAlarmListener listener)
7. Scan for sub devices
Some cameras allow associated sub-devices, you can scan and bind sub-devices to do the linkage function between devices (for example: door sensor, Ding-dong doorbell. When event triggered , the camera can automatically turn to the specified preset location to observe what things are vocalized)
Implementation Logic is inDeviceSettingCommander
,
/***
* Set device start to scan sub device(call after appAddAccessories())
*/
public BosmaCall<RawCmdDataByteArray> scanAccessories()
Note: This is only scan for surrounding sub-devices. If you need to add a sub-device, go through the following steps.
- The master device enters add mode
- The master device scans for sub devices
- add sub-device
- the master device exits the add mode
/***
* Set device prepare to add sub device
* @param mode 1: prepare to add 2、exit adding
*/
public BosmaCall<FWCommonResponse> appAddAccessories(byte mode)
/***
* Set device start to scan sub device(call after appAddAccessories())
*/
public BosmaCall<RawCmdDataByteArray> scanAccessories()
/***
* Set device start to update sub device list
*/
public BosmaCall<FWCommonResponse> updateAccessories()
8. Video image parameter setting
Set the contrast, brightness, saturation, sharpness of the camera video, we have tuned the image to the optimum and do not recommend custom tuning.
Implementation Logic is inDeviceSettingCommander
,
/***
* Query device video image parameter
* @return
*/
public BosmaCall<APP_GET_IMAGE_EFFECT> queryImageParameters()
/***
* Set device video image parameter
* @param contrast 0~255
* @param brightness 0~255
* @param sharpness 0~255
* @param saturation 0~255
* @return
*/
public BosmaCall<FWCommonResponse> setImageParameters(int contrast, int brightness, int sharpness, int saturation)
9. Video Resolution
Set the camera video resolution
Implementation Logic is inDeviceSettingCommander
,
/**
* Query device currently Video clarity
* @return
*/
public BosmaCall<APP_STREAMQUALITY_REQ> queryVideoClarity()
/**
* Set device currently Video clarity
* @param quality the mode of resolution See
* {@link CommandType#BOSMA_AVIOCTRL_QUALITY_HIGH}, {@link CommandType#BOSMA_AVIOCTRL_QUALITY_MIDDLE}
* {@link CommandType#BOSMA_AVIOCTRL_QUALITY_LOW}, {@link CommandType#BOSMA_AVIOCTRL_QUALITY_AUTO}
* @return
*/
public BosmaCall<FWCommonResponse> setVideoClarity(short quality)
It can also be queried in the business logic in LiveViewBusiness
.
/**
*
* switch resolution
*
*
* @param resolution the mode of resolution See
* {@link CommandType#BOSMA_AVIOCTRL_QUALITY_HIGH}, {@link CommandType#BOSMA_AVIOCTRL_QUALITY_MIDDLE}
* {@link CommandType#BOSMA_AVIOCTRL_QUALITY_LOW}, {@link CommandType#BOSMA_AVIOCTRL_QUALITY_AUTO}
* @param listener switch resolution callback
*/
public void switchResolution(byte resolution, SwitchResolutionListener listener)
10. Storage Management
Device SDcard management, including querying, formatting
Implementation Logic is inDeviceSettingCommander
,
/***
* Query SDCard detail
*
* @return See APP_SD_INFORMATION_RESP in api document
*/
public BosmaCall<APP_SD_INFORMATION_RESP> querySdCard()
/***
* Query SDCard detail
*
* @return See APP_SD_INFORMATION_RESP in api document
*/
public BosmaCall<FWCommonResponse> formatSdcard()
11. Firmware Updates
Query whether the device auto update is on and set the device auto update
Steps: 1. Set the device to enter firmware update mode 2. Check the progress of firmware update 3. And start firmware update
Implementation Logic is inDeviceSettingCommander
,
/**
* Query device firmware auto update status
* @return
*/
public BosmaCall<APP_OTA_MODE> queryAutoUpdate()
/**
* Set device firmware auto update status
* @param mode 0 = auto mode, 1 = manual mode
* @return
*/
public BosmaCall<FWCommonResponse> setAutoUpdate(byte mode)
/**
* Start update mode(Device will be into update mode)
* @param confirm 0: Leave update mode, 1: update now
* @return
*/
public BosmaCall<FWCommonResponse> startUpdateMode(byte confirm)
/***
* Get firmware download progress
* @return
*/
public BosmaCall<APP_GET_DOWNLOAD_PROGRESS> getDownLoadProgress()
/***
* start firmware update
* @param app_start_download_fw firmware update information
* @return
*/
public BosmaCall<FWCommonResponse> updateFirmware(APP_START_DOWNLOAD_FW app_start_download_fw)
12. Full-time video recording
Full-time video recording for Timeline way to display video records, you can query the SD card on the record of the full time video.
Note: only supported on specific products, support products: X1 series products, XC series products, CC series products, etc., other products are not supported.
Implementation Logic is in LiveViewBusiness
/**
* @param eventStartTime the record data try to query startTime
* @param eventEndTime the record data try to query endTime
* @param timeZone current record data timeZone info
* @param devCurrentTimeZone current device timezone info
* @param scrollPosition
* @param listener query record data callback
* @description query Sd card record data
*/
public void queryTimeLineEventList(long eventStartTime, long eventEndTime, TimeZone timeZone, TimeZone devCurrentTimeZone, long scrollPosition, QueryTimeLineEventListener listener)
13. Device Lens Switch
Can control the device's lens on/off
Implementation Logic is in DeviceSettingCommander
,
/**
* Query device lens switch status
* @return
*/
public BosmaCall<APP_POWER_ON> getLensSwitchStatus()
/**
* Set device lens switch status
* @param uEnable
* @return
*/
public BosmaCall<FWCommonResponse> translateLensSwitch(short uEnable)
14. Rotate image orientation
The image of the video can be flipped in 4 directions
Implementation Logic is in DeviceSettingCommander
,
/***
* Query Device image rotate mode
* @return APP_IMAGE_ROTATE_RESP
*/
public BosmaCall<APP_IMAGE_ROTATE_RESP> queryImageMode()
/***
* Set Device image rotate mode
* @return Common Response
*/
public BosmaCall<FWCommonResponse> setImageMode(short selectMode)
15. Device Volume
You can set the volume level of the device's call/speak
Implementation Logic is in DeviceSettingCommander
,
/***
* Query device volume value(value must be integer 0 to 10)
* @return
*/
public BosmaCall<APP_GET_DEVICE_VOLUME> qryVolumeValue()
/**
* Set device volume value
* @param volumeValue volume values(value must be integer 0 to 10)
* @return
*/
public BosmaCall<FWCommonResponse> setVolumeValue(byte volumeValue)
16. Network Configuration
Network configuration and management of devices
Implementation Logic is in DeviceSettingCommander
,
/***
* Query WiFi form device(Returns WiFi around found by device)
* @return
*/
public BosmaCall<APP_WIFI_INFORMATION_RESP> getWifiInfo()
/***
* Device connects to the Specified WiFi
* @param ssid Had better not more than 64 characters
* @param wifiPassword Had better not more than 64 characters
* @return common response
*/
public BosmaCall<FWCommonResponse> setWifiInformation(String ssid, String wifiPassword)
17. Video recording
Query and set the recording method of IPC device
Implementation Logic is in DeviceSettingCommander
,
/***
* query device video record strategy
* @return
*/
public BosmaCall<APP_SD_RECORD_RESP> querySchedule()
/***
* Set device video record strategy
* @param app_sd_record record strategy information {@link APP_SD_RECORD_RESP}
* @return
*/
public BosmaCall<FWCommonResponse> setRecordStrategy(APP_SD_RECORD_RESP app_sd_record)
The response APP_SD_RECORD_RESP
is as follows
public class APP_SD_RECORD_RESP {
/***
* Is enable sdcard record or not( 1:enable 0:disable)
*/
public FWUnsignedChar enable;
/***
* Sdcard video record strategy ( 1:Only record when event happen 2:Record all the time)
*/
public FWUnsignedChar mode;
EmptyPack reserve;
@Override
public String toString() {
return "APP_SD_RECORD_RESP{" +
"enable=" + enable +
", mode=" + mode +
'}';
}
}
18. Video Recording Plan
Query and set up IPC devices to perform recording in which specified time periods
The business logic is in the DeviceSettingCommander
,
/**
* query device video record schedule
* @return
*/
public BosmaCall<APP_TIME_HOUR_SCOPE> queryVideoSchedule()
/**
* set device video record schedule
* @return
*/
public BosmaCall<FWCommonResponse> setVideoSchedule(APP_TIME_HOUR_SCOPE app_time_hour_scope)
19. Video Wide Dynamic
Query and set the video wide dynamic enable status of IPC devices
The business logic is in the DeviceSettingCommander
,
/***
* Query device Video Wide dynamic
* @return
*/
public BosmaCall<APP_WDR_SWITCH_OPERATION> getWideDynamic()
/***
* Set device Wide dynamic
* @param enable 0: disable, 2:enable
* @return
*/
public BosmaCall<FWCommonResponse> translateWideDynamic(byte enable)
20. Device Siren
For details, see 6. Device voice and siren, pass CommandType#SIREN_ALARM_AUDIO
for the parameter type to indicate siren
Also the business logic is in the DeviceSettingCommander
,
/**
* open camera voice
* @param ePrompt voice type see {@link CommandType#SIREN_ALARM_AUDIO}
* @param eLangType specify the language in which the alarm sounds will be broadcast
*/
public BosmaCall<FWCommonResponse> openDeviceSystemVoice(short ePrompt, short eLangType)
/**
* close device voice
* @param ePrompt voice type see {@link CommandType#SIREN_ALARM_AUDIO}
* @param eLangType specify the language in which the alarm sounds will be broadcast
*/
public BosmaCall<FWCommonResponse> closeDeviceSystemVoice(short ePrompt, short eLangType)
21. Spotlight
Set the on-off state and brightness of the spotlight of the IPC device, currently supported devices are Ex, ExPro
The business logic is in the DeviceSettingCommander
,
/***
*
* Spot light switch state
* @return
*/
public BosmaCall<SpotLightSwitchStatusRespBean> getSpotLightSwitchStatus()
/***
* Set spot light switch state
* @param status spot light state
* @param luminance sopt light luminance
*/
public BosmaCall<FWCommonResponse> setSpotLightSwitchStatus(byte status, byte luminance)
22. Device Control
Can control the device, e.g. reboot the device
The business logic is in the DeviceSettingCommander
,
/**
* Restart device
*/
public BosmaCall<FWCommonResponse> restartDevice()
23. Automatic tracking
Query and set up automatic tracking details for devices
The business logic is in the DeviceSettingCommander
,
/***
* Get Auto tracking information
*/
public BosmaCall<APP_AUTO_TRACKING_INFO_REQ> requestGetAiAutoTrackingEventDetection()
/***
* Set Auto tracking information
*/
public BosmaCall<FWCommonResponse> requestSetAiAutoTrackingEventDetection(List<AUTO_TRACKING_INFO> params)
24. Detection area
Query and set the area range for IPC event detection
The business logic is in the DeviceSettingCommander
,
/***
* Query Video motion detection area
* @return
*/
public BosmaCall<APP_DETECTION_AREA_RESP> qryAreaRect()
/***
* Set Video motion detection area
* @return
*/
public BosmaCall<FWCommonResponse> setAreaRect(APP_DETECTION_AREA_RESP paramSetEventDetectionArea)
25. Device Health State
You can check the health status of the device, such as network signal strength, etc.
This command is used for the App to notify the Station device to enter/exit the health measurement status. After the Station performs the device health measurement status, the Station gets the health measurement data of the IPC device and returns it to the App.
0: Stopping the evaluation
1: Start the evaluation and return the results only once
2: Start the evaluation and return the results of multiple evaluations
The business logic is in the DeviceSettingCommander
,
/**
*
* Query device health information
*
* @param status check health mode, 0 = stop, 1 = only once,2 = many times
*/
public BosmaCall<APP_DEVICE_HEALTH_ASSESSMENT_RESP> queryHealthInfo(short status)
26. Ai Service
Ai services for devices can be managed, e.g. Ai testing, Ai detection, etc.
The business logic is in the DeviceSettingCommander
,
/***
* Set Ai test mode
* @param status 1=stop 2=start 3= max
*/
public BosmaCall<FWCommonResponse> requestSetAiTestStatus(byte status)
/***
* Get Ai test mode
*/
public BosmaCall<APP_AI_TEST_RESP> requestGetAiTestStatus()
/***
* Get Ai test parameters
*/
public BosmaCall<APP_AI_TEST_DATA_REQ> requestGetAiTestParameter()
/***
* Set AI test parameters
*/
public BosmaCall<FWCommonResponse> requestSetAiTestParameter(List<APP_AI_ABILITY> aiAbilities)
27. Storage Gateway
Storage gateway that can manage devices, applicable products Station series, such as: Mini Station, Home Station, etc.
The business logic is in theAiBoxCommander
,
/***
* Get storage information
* @param storageType 1=System Storage 2=SD Card 3=Removable disk
*/
public BosmaCall<APP_MEMORY_CARD_RESP> queryStorageInfo(short storageType)
/***
* Set default storage
* @param type 1=System Storage 2=SD Card 3=Removable disk
* @param index storage index
*/
public BosmaCall<FWCommonResponse> setDefaultStorage(short type, short index)
/***
* Format Storage
* @param type 1=System Storage 2=SD Card 3=Removable disk
* @param index storage index
* @param opration 0=format all. 1=format partition
*/
public BosmaCall<FWCommonResponse> formatStorage(short type, short index, short opration)
28. Event Filters
manage devices Event filters
The business logic is in theDeviceSettingCommander
,
/**
* Get device event filter
*/
public BosmaCall<APP_EVENT_FILTER_REQ> queryEventFilter()
/**
*
* Set device Event filter
* @param eventType
*/
public BosmaCall<FWCommonResponse> setEventFilter(short eventType)
29. Indicator light
Manage the indicator light of the device, light on/off
The business logic is in theDeviceSettingCommander
,
/**
*
* Query device indicator light state
*/
public BosmaCall<APP_INDICATOR_LIGHT_SWITCH_RESP> queryIndicatorLight()
/**
*
* Set device indicator light state
* @param turnON 0 = off, 1 = on
*/
public BosmaCall<FWCommonResponse> setIndicatorLight(short turnON)
30. Face ID
Can manage the local face ID of the device, only available for Home Station products
The business logic is in theDeviceSettingCommander
,
/***
* Get device face recognition list
*/
public BosmaCall<APP_FACE_ID_LIST_RESP> getFaceList()
/***
* Update face recognition name
* @param faceID face ID
* @param name face name
*/
public BosmaCall<FWCommonResponse> updateFaceName(int faceID, String name)
/***
* Delete face id
* @param faceID face ID
*/
public BosmaCall<FWCommonResponse> deleteFaceData(int faceID)
31. No disturbance mode of doorbell
You can set the message/no disturb mode of the device
The business logic is in theDeviceSettingCommander
,
/***
* Query the parameters of the doorbell message box
*/
public BosmaCall<APP_DOORBELL_VOICE_MESSAGE_GET> queryReplyVoiceSwitchSettingStatus()
/***
* Set the parameters of the doorbell message box
* @param replyVoiceType reply voice type
* @param switchStatus enable or not
* @return
*/
public BosmaCall<FWCommonResponse> setReplyVoiceSwitchSettingStatus(byte replyVoiceType, byte switchStatus)
32. PIR light of doorbell
You can manage the PIR module of the device, such as: turn on/off the automatic control, manual light on/off, read the light status of the PIR lamp
The business logic is in the DeviceSettingCommander
,
/***
* Get the doorbell lamp state whether it lights automatically
* @return
*/
public BosmaCall<APP_RING_LAMP_STATUS_REQ> getSentryRangLampStatus()
/***
* Set the doorbell lamp state whether it lights automatically
* @param sensitivityType
* @return
*/
public BosmaCall<FWCommonResponse> setSentryRangLampStatus(byte sensitivityType)
/**
* Set DoorBell floodlight auto enable
* @param status 1: enable auto, 0: disable auto
* @return
*/
public BosmaCall<FWCommonResponse> setFloodLightAutoData(byte status)
/**
* Close-open DoorBell floodlight
* @param status 1: open, 0: close
* @return
*/
public BosmaCall<FWCommonResponse> setFloodLightLedOpenOrClose(byte status)
33. Download video record of doorbell
The business logic is in the RdtBusiness
,
/**
* Record download
* @param startTime Recording start time
* @param duration Recording time
* @param recordType Type of recording event
* @param downLoadListener Record download callback. See{@link DownLoadListener}
*/
public void recordDownLoad(int sessionId, long startTime, long duration, short recordType, String recordSavePath, DownLoadListener downLoadListener)
34. Visitor information of doorbell
Visitor information can be handled, e.g. refusal to answer
The business logic is in the DeviceSettingCommander
,
/***
* Refuse Doorbell talk
* @return
*/
public BosmaCall<FWCommonResponse> refuseDoorBellTalk()
35. Doorbell fingerprint
Fingerprint module for managing devices
The business logic is in the DeviceSettingCommander
,
/***
* Doorbell exit Adding fingerprint
*/
public BosmaCall<FWCommonResponse> exitFBStatus()
/**
* Doorbell add fingerprint
* @param fbType 1=normal,2=Anti hijacking fingerprint
* @param fbName fingerprint nickName(As short as possible)
* @return
*/
public BosmaCall<FWCommonResponse> addFBStatus(byte fbType, String fbName)
/***
* Save Fingerprint data
*/
public BosmaCall<FWCommonResponse> saveFBStatus(short fbID, byte fbType, String fbName)
/***
* delete Fingerprint data
* @param fbId fingerprint id
*/
public BosmaCall<FWCommonResponse> deleteFBStatus(byte fbId)
/***
* get Fingerprint data from doorbell
*/
public BosmaCall<RawCmdDataByteArray> getFBData()
/***
* get Fingerprint collecting progress
*/
public BosmaCall<APP_DOORBELL_FB_COLLECT_PROGRESS_RESP> collectFBProgress()
/***
* release finger when collecting fingerprint
*/
public BosmaCall<FWCommonResponse> releaseFBStatus()
36. Replay Voice Of Doorbell
You can set the auto-reply voice of the device
The business logic is in the DeviceSettingCommander
,
/***
* Add an reply voice to doorbell
* @param msgName reply voice nickName(As short as possible)
* @param replyType reply voice type
* @param mAACMsgPath reply voice aac path
* @param mPCMMsgPath reply voice pcm path
* @return
*/
public BosmaCall<FWCommonResponse> addReplyVoice(String msgName, Byte replyType, String mAACMsgPath, String mPCMMsgPath)
/***
* delete an reply voice by id
* @param replyID reply id
*/
public BosmaCall<FWCommonResponse> deleteReplyVoice(short replyID)
/***
* Set an reply voice to default
* @param replyID reply id
*/
public BosmaCall<FWCommonResponse> setDoorBellVoiceReply(short replyID)
/***
* Download reply voice
*/
public BosmaCall<APP_DOORBELL_VOICE_REPLY_LOAD_RESP> loadDoorbellVoiceReply(byte replyId)
37. Doorbell chime
Can allow/disallow devices to use external mechanical doorbells
The business logic is in the DeviceSettingCommander
,
/**
* Query DoorBell chime switch status
* @return
*/
public BosmaCall<APP_DOORBELL_EXTERNAL_DOORBELL_GET> getExternalDoorBellModel()
/****
* Set Doorbell chime enable
* @param isTranslate 1=open 0=colse
*/
public BosmaCall<FWCommonResponse> setExternalDoorBellModel(byte isTranslate)
38. Cloud Event Video Play and Download
Only devices that have joined the cloud service have cloud video. If we need to play back these cloud stored videos, first of all, we need to get the URL of the cloud video resource first (that is, the URL of the remote playback, get the download cloud video saved locally), and then use the video player to play this cloud video URL to complete the playback of the video.
38.1 Cloud Event Video To Play
First get the event list from Bosma Server
and get the details of the events that need to be played. In our sample, we put the cloud event information in the PlayBackParamBean
class.
Get the cloud event video playback Url by cloud event information
CloudPlayHelper.requestCloudPlaybackUrl(requestParam, new Function2<String, String, Unit>() {
@Override
public Unit invoke(String code, String url) {
ViseLog.i("code = " + code);
ViseLog.i("url = " + url);
if (UrlConfig.RESULT_OK.equals(code)) {
HandlerUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
startPlayVideo(url);
}
});
}
return Unit.INSTANCE;
}
});
Get the url to play, you can use the player to play, in the sample, we used Gsyvideoplayer
, you can also use ExoPlayer
38.2 Cloud Event Download
Before downloading, you must successfully get the url that can be played before allowing the download. The download class is as follows CloudPlayHelper
/**
* Download video interface
* @param videoPath :Video download save address
* @param successBlock :Call back the request result to the application layer
* @param downloadingBlock :Call back download progress
*/
@JvmStatic
fun downLoadVideo2(videoPath:String,successBlock: (String) -> Unit, downloadingBlock: (Int) -> Unit)
Download Sample code
CloudPlayHelper.downLoadVideo2(filePath, successBlock = { videoPath ->
ViseLog.i("path = $videoPath")
var mDownFile = File(videoPath)
if (!TextUtils.isEmpty(videoPath) && mDownFile.exists() && mDownFile.length() > 0 && !isFinishing) {
ViseLog.i("Download success")
} else {
ViseLog.i("Download failed")
}
}) { progress ->
when (progress < 0) {
true -> {
if (progress == CloudPlayHelper.INTERRUPT_CODE) {
ViseLog.i("Download cancell")
} else {
ViseLog.i("Download failed")
}
}
false -> {
ViseLog.i("Download progress:${progress}")
}
}
}
Firmware upgrade
This description applies to firmware upgrades for IPC devices
1. Firmware upgrade settings
Query and set the firmware upgrade mode of the device
Query the current device firmware upgrade mode, this interface is implemented in DeviceSettingCommander
.
/**
* Query device firmware auto update status
* @return
*/
public BosmaCall<APP_OTA_MODE> queryAutoUpdate()
Return value APP_OTA_MODE
, parameter otaUpdateMode
value 0 means that the device will automatically upgrade when a new version of firmware is detected, value 1 means that the user needs to manually upgrade when a new version is available
Set the upgrade mode, this interface is implemented in DeviceSettingCommander
.
/**
* Set device firmware auto update status
* @param mode 0 = auto mode, 1 = manual mode
* @return
*/
public BosmaCall<FWCommonResponse> setAutoUpdate(byte mode)
Returns common response, status code result of 0 means the setting is successful
2. Start firmware upgrade
First, get the current firmware version number of the device, this interface is implemented in DeviceSettingCommander
/***
* Query device information
* @return
*/
public BosmaCall<APP_DEVICE_INFO_RESP> checkDeviceUpDateStatus()
The returned entity class is APP_DEVICE_INFO_RESP
, which requires the firmwareVersion
field
public class APP_DEVICE_INFO_RESP {
/**
* manufacturer
*/
public FWString manufacturer;
/**
* Device model code
*/
public FWString model;
/**
* Firmware version
*/
public FWString firmwareVersion;
/**
* Device UID
*/
public FWString serialNumber;
/**
* Device hardware id
*/
public FWString hardwareId;
/**
* Device hardware platform:{@link com.bosma.p2p.setting.enums.BOSMA_PLATFORM_TYPE}
*/
public FWUnsignedChar platformType;
/**
* Device ota update status {@link com.bosma.p2p.setting.enums.OTA_STATUS_E}
*/
public FWUnsignedChar otaStatus;
/**
* Charge status refer to ENUM_CHARGE_STATUS
*/
public FWUnsignedChar chargeStatus;
/**
*
* BATTERY INFORMATION - left electricity(e.g 20 mean left 20%)
*
*/
public FWUnsignedChar volBattery;
}
Get the current version number information of the device, we can check the version update, this interface is implemented in DeviceSettingHttpHelper2
.
/**
* Check if the firmware is updated
*
* @param modelCode device's model code
* @param uid device's id
* @param currentFirmwareVersion current firmware version
* @param systemLanguage current system language
* @param email empty
* @param mobile empty
* @return
*/
public static Call<FirmwareUpdateResp> doQryDevInfoAndCheckUpdate(String modelCode, String uid, String currentFirmwareVersion, String systemLanguage, String email, String mobile)
email
and mobile
can be empty, if there is a new version, this interface will return the new version details, including changes, download address, etc.
Set the new version information you got above to the device, and the device will download the version to upgrade based on this information. This interface is implemented in DeviceSettingCommander
.
//Prepare the New Firmware Information to device
val startDownloadFw = APP_START_DOWNLOAD_FW()
startDownloadFw.url = FWString(productModel.url, 256)
startDownloadFw.size = FWUnsignedInt(productModel.file_size)
startDownloadFw.checksum = FWString(productModel.checksum, 32)
startDownloadFw.version = FWString(productModel.version, 32)
startDownloadFw.reserved = EmptyPack(12)
/***
* start firmware update
* @param app_start_download_fw firmware update information
* @return
*/
public BosmaCall<FWCommonResponse> updateFirmware(APP_START_DOWNLOAD_FW app_start_download_fw)
Once the command is sent, the device will start downloading the new version of the firmware, at which point you can get the download progress. This interface is implemented in DeviceSettingCommander
.
Note: This interface is not recommended to be called frequently, it is recommended to be called once every 3~5 seconds
/***
* Get firmware download progress
* @return
*/
public BosmaCall<APP_GET_DOWNLOAD_PROGRESS> getDownLoadProgress()
When the progress reaches 100, the device can be notified that starting execution of firmware update. This interface is implemented in DeviceSettingCommander
/**
* Start update mode(Device will be into update mode)
* @param confirm 0: Leave update mode, 1: update now
* @return
*/
public BosmaCall<FWCommonResponse> startUpdateMode(byte confirm)
After the command is sent, the device starts to execute the firmware update, at this time the device cannot be powered off, and the update is expected to take about 30 seconds.
When the firmware update is finished, the device will restart automatically, at this time, you can check the device information (see the checkDeviceUpDateStatus method mentioned earlier) and compare whether the device version is consistent with the latest version, if it is consistent, the device firmware update is finished, otherwise the upgrade fails.
Doorbell Sentry & Smart Lock Aegis
Our Doorbell Sentry can install Fingerprint module, which can be used to connect to the Aegis for fingerprint unlocking and remote unlocking.
1. Check Doorbell's current Aegis binding status
Each Sentry can only pair to one Aegis at the same time, you need to check whether the Aegis has been paired. This API is in the FingerPrintHttpHelper2
class
/**
* Check the binding status of the Sentry
* @param dbPid The pid of the Sentry
* @return
*/
public static Call<BaseTResp<DoorbellBindStatusModel>> checkDoorBellBindStatus(String dbPid)
Return DoorbellBindStatusModel
to check isBind
to confirm that aegis is paired or not
2. Aegis pair to Doorbell Sentry
You can get fbMac
from DoorbellBindStatusModel
, and type
can be 2(for remote). This API is in the FingerPrintHttpHelper2
class
/***
* Aegis and Sentry binding interface
* @param fbMac The mac address of the fingerprint module
* @param lockMac Aegis mac
* @param dbPid The pid of the Sentry
* @param lockPid The pid of the Aegis
* @param type Operator type. 1:local 2: remote
*/
public static Call<BaseTResp<String>> bindFingerPrint(String fbMac, String lockMac, String dbPid, String lockPid, String type)
3. Aegis unpair to Doorbell Sentry
Unpair the aegis from Sentry. This API is in the FingerPrintHttpHelper2
class
/***
* Aegis and Sentry unbinding interface
* @param fbMac The mac address of the fingerprint module
* @param lockMac Aegis mac
* @param dbPid The pid of the Sentry
* @param lockPid The pid of the Aegis
* @param type Operator type. 1:local 2: remote
*/
public static Call<BaseTResp<String>> unbindFbDevice(String fbMac, String lockMac, String dbPid, String lockPid, String type)
4. Doorbell Sentry Lock/Unlock Aegis
Once Doorbell is paired to the Aegis, it can perform remote unlocking via the network method. The procedure for remote lock opening and closing can be seen in the sample in the AegisHomeActivity
class.
Live video recording from camera
Record the live video stream as MP4 and save it to the phone album. Note that the incoming path must be a writable path, otherwise the recording will not be successful. After the video is recorded successfully, then just swipe the video file with the saved path into the album.
For example
getCacheDir().getAbsolutePath() //Writable
This API is in theLiveViewBusiness2
class
/**
* Start video recording
*
* @param listener
* @param cachePath path to cache the video
*/
public void startRecord(RecordStatusListener listener, String cachePath)
/**
* Stop video recording
*/
public void stopRecord()