Copilot Android API Integration Guide
1. Integration Guide
1.1 Requirements
- Android SDK Version:
API Level 23
or above - Gradle Version:
7.4.2
or above
1.2 Quick Integration
Required Dependencies
- 1.Integrate Thingsmart
- 2.Integrate IPCSDK
- Add Copilot SDK API dependencies in your
build.gradle
file.
dependencies {
implementation 'com.thingclips.smart:thingsmart-ipcsdk:2.0.0-cube.5'
implementation 'com.thingclips.smart:thingsmart:2.1.0-cube'
implementation("com.thing.solution:copilot-sdk:1.0.0-cube-starsg.3") {
exclude group: 'com.thingclips.smart', module: 'thingsmart-thinghomesdk'
}
}
configurations.all {
resolutionStrategy {
force 'com.thingclips.smart:thingsmart-ipcsdk:2.0.0-cube.5'
}
}
1.3 Initialize SDK
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
ThingHomeSdk.init(this)
//Set base request host
CopilotSdk.setHost("https://api.starsg.com/api.json")
}
}
class MyActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
HomeInfoManager.setCurrentHomeId(homeId)
}
}
2. Core APIs
2.1 System Configuration
2.1.1 Query AI Capability Entry Configuration
Method Name:
fun getAiCapabilityConfig(homeId: String?, callBack: IEntranceSettingNewCallBack?)
Parameters:
homeId
: Home ID (optional)callBack
: Callback function for receiving AI capability entry configuration information
Return Value:
- Returns AI capability entry configuration information through
callBack
. - entranceType: Icon entrance display mode (0: bottom, 1: top, 2: both bottom and top)
- serviceType: Configuration type (0: general service, 1: product service)
- AiCopilotUiBean fields:
Field Name | Type | Description |
---|---|---|
voiceInput | int | Voice input switch (0: disabled, 1: enabled) |
voicePlayback | int | Voice output switch (0: disabled, 1: enabled) |
iconURL | String | Icon URL |
copilotName | String | Copilot name |
copilotDescription | String | Copilot description |
copilotId | String | Copilot ID |
copilotVersion | String | Copilot version |
preamble | String | Preamble |
aiType | String | AI type |
uiType | String | UI type |
status | int | Status (0: normal, 1: discontinued) |
subscribeStatus | int | Subscription status (0: subscribed, 1: unsubscribed) |
category | String | Category |
copilotSrc | String | Copilot source |
triggers | ArrayList |
Trigger list |
- AiTriggerItem fields:
Field Name | Type | Description |
---|---|---|
category | String | Category (value is "Fixed Time" or "End-user Setting") |
event | String | Trigger event |
value | String | Value (format: "hour:minute timezone", 24-hour format, time needs to be set when category is "End-user Setting") |
{
"voiceInput": 1,
"voicePlayback": 1,
"iconURL": "https://example.com/icon.png",
"copilotName": "AI Assistant",
"copilotDescription": "An AI-powered assistant for your daily tasks.",
"copilotId": "copilot123",
"copilotVersion": "1.0",
"preamble": "Hello, how can I assist you today?",
"aiType": "Chat Bot",
"uiType": "General Chat",
"status": 0,
"subscribeStatus": 0,
"category": "End-user Setting",
"copilotSrc": "ai_service",
"triggers": [
{
"category": "End-user Setting",
"event": "Daily Reminder",
"value": "08:00"
}
]
}
Example:
CopilotSdk.getCopilotApi().getAiCapabilityConfig(homeId, object : IEntranceSettingNewCallBack {
override fun onFail(error: String?) {
}
override fun onSuccess(entranceType: Int, serviceType: Int, copilotDetail: AiCopilotUiBean?) {
}
})
2.2 Copilot Management
2.2.1 Query Copilot List Content and Style
Method Name:
fun getCopilotList(homeId: String, listener: ICopilotListCallBack)
Parameters:
homeId
: Home IDlistener
: Result listener for receiving Copilot list content and style
Return Value:
- Returns Copilot list content and style through
listener
. listStyle
: Style 0: List, 1: Card, 2: MasonryrecommendList
: Featured Copilot list (maximum 3)copilotList
: Copilot list- AiCopilotUiBean same as 2.1.1
Example:
CopilotSdk.getCopilotApi().getCopilotList(homeId, object : ICopilotListCallBack {
override fun onUiDataCallBack(listStyle: Int, recommendList: ArrayList<AiCopilotUiBean>?, copilotList: ArrayList<AiCopilotUiBean>?) {
}
override fun onDataError(error: String?) {
}
})
2.2.2 Query Copilot Details
Method Name:
fun getCopilotDetail(homeId: String, copilotId: String, copilotVersion: String, copilotSrc: String?, listener: ICopilotDetailCallBack)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot source (optional)listener
: Result listener for receiving Copilot details
Return Value:
- Returns Copilot details through
listener
. - AiCopilotUiBean same as 2.1.1
Example:
CopilotSdk.getCopilotApi().getCopilotDetail(homeId, copilotId, copilotVersion, copilotSrc, object : ICopilotDetailCallBack {
override fun onUiDataCallBack(detail: AiCopilotUiBean) {
}
override fun onDataError(error: String?) {
}
})
2.2.3 Query Copilot Usage History List
Method Name:
fun getCopilotHistory(homeId: String, listener: IAiUiHistoryCopilotListCallBack)
Parameters:
homeId
: Home IDlistener
: Result listener for receiving Copilot usage history list
Return Value:
- Returns Copilot usage history list through
listener
. - AiCopilotUiBean same as 2.1.1
Example:
CopilotSdk.getCopilotApi().getCopilotHistory(homeId, object : IAiUiHistoryCopilotListCallBack {
override fun onUiDataCallBack(historyList: ArrayList<AiCopilotUiBean>?) {
}
override fun onDataError(error: String?) {
}
})
2.3 Subscription Management
2.3.1 Subscribe to a Copilot
Method Name:
fun subscribeCopilot(homeId: String, copilotId: String, copilotVersion: String, copilotSrc: String?, listener: Business.ResultListener<String>)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot source (optional)listener
: Result listener for receiving subscription result
Return Value:
- Returns subscription result through
listener
.
Example:
CopilotSdk.getCopilotApi().subscribeCopilot(homeId, copilotId, copilotVersion, copilotSrc, object : Business.ResultListener<String> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
})
2.3.2 Query Copilot Subscription Status
Method Name:
fun getCopilotSubscriptionStatus(homeId: String, copilotId: String, copilotVersion: String, copilotSrc: String?, listener: Business.ResultListener<AiCopilotSubscribeItem>)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot source (optional)listener
: Result listener for receiving Copilot subscription status
Return Value:
- Returns Copilot subscription status through
listener
. - AiCopilotSubscribeItem bean fields:
Field Name | Type | Description |
---|---|---|
status | String | Subscription status ("subscribed": subscribed, "none": unsubscribed) |
copilotId | String | Copilot ID |
createTime | long | Creation time (timestamp) |
copilotVersion | String | Copilot version |
copilotSrc | String | Copilot source |
{
"status": "subscribed",
"copilotId": "copilot123",
"createTime": 1672531200,
"copilotVersion": "1.0",
"copilotSrc": "ai_service"
}
Example:
CopilotSdk.getCopilotApi().getCopilotSubscriptionStatus(homeId, copilotId, copilotVersion, copilotSrc, object : Business.ResultListener<AiCopilotSubscribeItem> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: AiCopilotSubscribeItem?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: AiCopilotSubscribeItem?, apiName: String?) {
}
})
2.3.3 Batch Query Copilot Subscription Status
Method Name:
fun batchGetSubscriptionStatus(homeId: String, copilots: ArrayList<CopilotRequestBean>, listener: Business.ResultListener<ArrayList<AiCopilotSubscribeItem>>)
Parameters:
homeId
: Home IDcopilots
: Copilot information listlistener
: Result listener for receiving batch query Copilot subscription status
Return Value:
- Returns batch query Copilot subscription status through
listener
. - AiCopilotSubscribeItem same as 2.3.2
Example:
var copilots = ArrayList()
var copilotRequestBean = CopilotRequestBean(copilotId, copilotVersion, copilotSrc)
CopilotSdk.getCopilotApi().batchGetSubscriptionStatus(homeId, copilots, object : Business.ResultListener<ArrayList<AiCopilotSubscribeItem>> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: ArrayList<AiCopilotSubscribeItem>?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: ArrayList<AiCopilotSubscribeItem>?, apiName: String?) {
}
})
2.4 Product Management
2.4.1 Query Product List Content and Style
Method Name:
fun getProductList(homeId: String, listener: IProductListCallBack)
Parameters:
homeId
: Home IDlistener
: Result listener for receiving product list
Return Value:
- Returns product list through
listener
. - listStyle: Style 0: List, 1: Card, 2: Masonry
- recommendList: Recommended Product list
- list: Unpurchased Product list
- AiProductUiBean fields:
Field Name | Type | Description |
---|---|---|
productType | String | Product type |
productId | String | Product ID |
productName | String | Product name |
productDescription | String | Product description |
iconURL | String | Icon URL |
expireTime | long | Expiration time (timestamp) only for purchased products |
serviceStatus | int | Service status (1: service enabled, 2: service expired) only for purchased products |
orderNo | String | Order number |
showPromotion | int | Show promotion (0: don't show, 1: show) only for unpurchased products |
promotionDescription | String | Promotion description |
isPurchased | boolean | Whether purchased |
serviceType | int | Service Type |
uiType | String | UI Type |
aiType | String | AI Type |
instanceType | String | Instance Type (0: Device, 2: User) |
instanceId | String | Instance ID (e.g., Device ID, User ID) |
userCommodityServiceId | String | User Commodity Service ID |
copilotId | String | Copilot ID |
copilotVersion | String | Copilot Version |
{
"productType": "AI Service",
"productId": "product123",
"productName": "AI Assistant",
"productDescription": "An AI-powered assistant for your daily tasks.",
"iconURL": "https://example.com/icon.png",
"expireTime": 1672537600000,
"serviceStatus": 1,
"orderNo": "ORDER12345",
"showPromotion": 1,
"promotionDescription": "Get 20% off for a limited time!",
"isPurchased": true,
"serviceType": 1,
"uiType": "General",
"aiType": "Chat Bot",
"instanceType": "0",
"instanceId": "device123",
"userCommodityServiceId": "service123",
"copilotId": "copilot123",
"copilotVersion": "1.0"
}
Example:
CopilotSdk.getProductApi().getProductList(homeId, object : IProductListCallBack {
override fun onUiDataCallBack(listStyle: Int, recommendList: ArrayList<AiProductUiBean>?, list: ArrayList<AiProductUiBean>?) {
}
override fun onDataError(error: String?) {
}
})
2.4.2 Query Purchased Product List
Method Name:
fun getPurchasedProductList(homeId: String, pageSize: Int, pageNo: Int, listener: IPurchasedProductListCallBack)
Parameters:
homeId
: Home IDpageSize
: Items per pagepageNo
: Page numberlistener
: Result listener for receiving purchased product list
Return Value:
- Returns purchased product list through
listener
- Same as 2.4.1 AiProductUiBean, returns ArrayList
Example:
CopilotSdk.getProductApi().getPurchasedProductList(homeId, pageSize, pageNo, object : IPurchasedProductListCallBack {
override fun onUiDataCallBack(list: ArrayList<AiProductUiBean>?) {
}
override fun onDataError(error: String?) {
}
})
2.4.3 Query Product Order List
Method Name:
fun getProductOrderList(homeId: String, orderStatusList: ArrayList<Int>, orderType: String, pageSize: Int, pageNo: Int, listener: IProductOrderListCallBack)
Parameters:
homeId
: Home IDorderStatusList
: Order status listorderType
: Order typepageSize
: Items per pagepageNo
: Page numberlistener
: Result listener for receiving product order list
Return Value:
- Returns product order list through
listener
. - AiProductOrderItemUiBean fields:
Field Name | Type | Description |
---|---|---|
orderName | String | Order name |
orderNo | String | Order number |
orderStatus | int | Order status |
createTime | long | Creation time (timestamp) |
expireTime | long | Expiration time (timestamp) |
deviceId | String | Device ID |
payType | String | Payment type |
currencySymbol | String | Currency symbol |
payAmount | String | Payment amount |
payOptionType | int | Payment option type |
productName | String | Product name |
[{
"orderName": "AI Assistant Subscription",
"orderNo": "ORDER12345",
"orderStatus": 1,
"createTime": 1672531200,
"expireTime": 1704067200,
"deviceId": "DEVICE12345",
"payType": "WeChat Pay",
"currencySymbol": "$",
"payAmount": "19.99",
"payOptionType": 2,
"productName": "AI Assistant"
}]
Example:
CopilotSdk.getProductApi().getProductOrderList(homeId, orderStatusList, orderType, pagesize, pageNo, object : IProductOrderListCallBack {
override fun onUiDataCallBack(list: ArrayList<AiProductOrderItemUiBean>?) {
}
override fun onDataError(error: String?) {
}
})
2.5 Intelligent Chat (General Chat)
2.5.1 Send Chat Message
Method Name:
fun sendMessage(sendMessageRequestBean: SendMessageRequestBean, callBack: AiChatResultCallBack)
Parameters:
sendMessageRequestBean
: Send message request beancallBack
: Callback function for receiving send message result- sendMessageRequestBean fields:
Field Name | Type | Description |
---|---|---|
homeId | String | Home ID |
copilotId | String | Copilot ID |
copilotVersion | String | Copilot version |
messageText | String | Message text |
sendId | String | Send ID (temporary client-generated ID) |
receiveId | String | Receive ID (temporary client-generated ID) |
chatId | String | Chat ID |
Return Value:
- Returns send message result through
callBack
.
Example:
var requestBean = SendMessageRequestBean()
requestBean.homeId = homeId
requestBean.copilotId = copilotId
requestBean.copilotVersion = copilotVersion
requestBean.messageText = "fdkfjd"
requestBean.sendId = System.currentTimeMillis().toString() + Math.random()
CopilotSdk.getChatApi().sendMessage(requestBean, object : AiChatResultCallBack {
//Receive text
override fun onReceive(receiveId: String, oneResult: String?, result: String?) {
<!--Receive message -->
}
//Receive failed
override fun onFailReceive(receiveId: String, error: String?) {
}
//Send failed
override fun onFailSend(sendId: String, error: String?) {
}
// Send successful
override fun onSuccessSend(sendId: String) {
}
//Receive successful
override fun onFinishReceive(receiveId: String) {
}
})
2.5.2 Query Copilot Chat Message History
Method Name:
fun getChatHistory(
homeId: String,
copilotId: String,
copilotVersion: String?,
type: String?,
pageNo: Int,
pageSize: Int,
listener: Business.ResultListener<AiChatListBean>
)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVersion
: Copilot version (optional)type
: Type, can begeneral
orproduct
pageNo
: Page numberpageSize
: Items per pagelistener
: Result listener for receiving chat message history
Return Value:
- Returns
AiChatListBean
object throughlistener
, containing chat message history. - AiChatListBean fields:
Field Name | Type | Description |
---|---|---|
total | int | Total number of chat items |
data | ArrayList |
Chat item list |
AiChatItemBean fields:
Field Name | Type | Description |
---|---|---|
role | String | Role (user: user, assistant: AI Copilot assistant) |
content | String | Chat content |
gmtCreate | long | Creation time (timestamp) |
extra | ChatExtaBean | Additional information |
Field Name | Type | Description |
---|---|---|
presetQuestions | ArrayList |
Preset question list |
{
"total": 1,
"data": [
{
"role": "user",
"content": "Hello, Copilot!",
"gmtCreate": 1672531200,
"extra": {
"presetQuestions": [
"How can I help you today?",
"What can I assist you with?"
]
}
}
]
}
Example:
CopilotSdk.getChatApi().getChatHistory(homeId, copilotId, copilotVersion, type, pageNo, pageSize, object : Business.ResultListener<AiChatListBean> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: AiChatListBean?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: AiChatListBean?, apiName: String?) {
}
})
2.6 Daily Message
2.6.1 Set Daily Message Schedule
Method Name:
fun setDailyMessageSchedule(
homeId: String,
copilotId: String,
copilotVersion: String,
deviceId: String?,
triggerTime: String?,
copilotSrc: String?,
listener: Business.ResultListener<String>?
)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVersion
: Copilot versiondeviceId
: Device ID (optional)triggerTime
: Trigger time (optional)copilotSrc
: Copilot source (optional)listener
: Result listener for receiving setup result (optional)
Return Value:
- Returns setup result string through
listener
.
Example:
CopilotSdk.getDailyMessageApi().setDailyMessageSchedule(homeId,copilotId,copilotVersion,deviceId,triggerTime,copilotSrc,object:Business.ResultListener<String>{
override fun onFailure(p0: BusinessResponse?, p1: String?, p2: String?) {
}
override fun onSuccess(p0: BusinessResponse?, p1: String?, p2: String?) {
}
})
2.6.2 Get Daily Message Schedule Configuration
Method Name:
fun getDailyMessageSchedule(
homeId: String,
copilotId: String,
copilotVersion: String,
copilotSrc: String?,
listener: Business.ResultListener<AiDailyTimeConfigBean>?
)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot source (optional)listener
: Result listener for receiving Daily Message schedule (optional)
Return Value:
- Returns
AiDailyTimeConfigBean
object throughlistener
, containing Daily Message schedule. - AiDailyTimeConfigBean fields:
Field Name | Type | Description |
---|---|---|
deviceId | String | Device ID |
triggerTime | String | Trigger time HH:mm timezone |
{
"deviceId": "device123",
"triggerTime": "08:00 Asia/Shanghai"
}
Example:
CopilotSdk.getDailyMessageApi().getDailyMessageSchedule(homeId,copilotId,copilotVersion,copilotSrc,object:Business.ResultListener<AiDailyTimeConfigBean>{
override fun onFailure(p0: BusinessResponse?, p1: AiDailyTimeConfigBean?, p2: String?) {
}
override fun onSuccess(p0: BusinessResponse?, p1: AiDailyTimeConfigBean?, p2: String?) {
}
})
2.6.3 Get Daily Message Detail
Method Name:
fun getDailyMessageDetail(
taskId: String,
listener: Business.ResultListener<AiDailyMessageResultBean>?
)
Parameters:
taskId
: Task IDlistener
: Result listener for receiving Daily Message details (optional)
Return Value:
- Returns
AiDailyMessageResultBean
and field descriptions:
Field Name | Type | Description |
---|---|---|
title | String | Title |
content | String | Content |
{
"title": "Daily Message",
"content": "This is the content of the daily message."
}
Example:
CopilotSdk.getDailyMessageApi().getDailyMessageDetail(taskId,object:Business.ResultListener<AiDailyMessageResultBean>{
override fun onFailure(p0: BusinessResponse?, p1: AiDailyMessageResultBean?, p2: String?) {
}
override fun onSuccess(p0: BusinessResponse?, p1: AiDailyMessageResultBean?, p2: String?) {
}
})
2.7 Intrusion Detection (Intrusion Message)
2.7.1 Get Intrusion Task List
Method Name:
fun getIntrusionTasks(
homeId: String?,
copilotId: String,
copilotVersion: String,
copilotSrc: String?,
listener: Business.ResultListener<IntrusionTaskList>?
)
Parameters:
homeId
: Home ID (optional)copilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot source (optional)listener
: Result listener for receiving task list
Return Value:
- Returns
IntrusionTaskList
object throughlistener
. Field descriptions:
Name | Type | Default | Description | Other Info |
---|---|---|---|---|
items | object | Notes: | ||
taskId | string | Intrusion area task ID | ||
masks | object [] | Area list | item type: object | |
snapshotUrl | string | Camera image URL | ||
maskedSnapshotUrl | string | |||
deviceId | string | Device ID | ||
createTime | string | Seconds, timestamp, creation time | ||
imgFileId | string | |||
status | string | Task status, enum: running, success, fail, finish | ||
question | string | |||
desc | string | |||
total | integer | Total count |
{
"items": [
{
"copilotId": "",
"createTime": 0,
"desc": "",
"deviceId": "",
"taskId": "",
"imgFileId": 0,
"maskedSnapshotUrl": null,
"masks": [
{
"bottom": 1293,
"left": 2061,
"right": 2303,
"top": 6
}
],
"question": "",
"snapshotUrl": "",
"status": ""
}
],
"total": 1
}
Example:
CopilotSdk.getIntrusionApi().getIntrusionTasks(homeId, copilotId, copilotVersion, copilotSrc, object : Business.ResultListener<IntrusionTaskList> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: IntrusionTaskList?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: IntrusionTaskList?, apiName: String?) {
}
})
2.7.2 Submit Intrusion Analysis
Method Name:
fun submitIntrusionAnalysis(
deviceId: String,
desText: String,
imgPath: String,
copilotId: String,
copilotVersion: String,
copilotSrc: String?,
callback: (code: String, msg: String) -> Unit
)
Parameters:
deviceId
: Device IDdesText
: Description textimgPath
: IPC image pathcopilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot source (optional)callback
: Callback function returning submission result code and message
Return Value:
- Returns submission result code and message through
callback
.code is taskId
Example:
CopilotSdk.getIntrusionApi().submitIntrusionAnalysis(deviceId, desText, imgPath, copilotId, copilotVersion, copilotSrc) { code, msg -> }
2.7.3 Delete Intrusion Task
Method Name:
fun deleteIntrusionTask(
taskId: String,
listener: Business.ResultListener<String>?
)
Parameters:
taskId
: Task IDlistener
: Result listener for receiving deletion result (optional)
Return Value:
- Returns deletion result string through
listener
.
Example:
CopilotSdk.getIntrusionApi().deleteIntrusionTask(taskId, object : Business.ResultListener<String> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
})
2.8 Camera Control
Example:
// Get IPC control instance
var iAiCameraIntrusion: IAiCameraIntrusion = CopilotSdk.getCameraIntrusion(deviceId)
// Connect to IPC
iAiCameraIntrusion.connectCamera(object : CameraConnectCallBack {
override fun connectSuccess() {
}
override fun connectFail(error: Int) {
}
})
// Get IPC screenshot
iAiCameraIntrusion.cameraSnapshotClick(context, photoPath, object : CameraSnapShotCallBack {
override fun snapshotSuc(data: String) {
}
override fun snapshotFail(error: Int) {
}
})
// PTZ control - move left
iAiCameraIntrusion.ptzLeft()
// PTZ control - move up
iAiCameraIntrusion.ptzUp()
// PTZ control - move right
iAiCameraIntrusion.ptzRight()
// PTZ control - move down
iAiCameraIntrusion.ptzDown()
// PTZ control - stop movement
iAiCameraIntrusion.ptzStop()
// Check if PTZ control is supported
iAiCameraIntrusion.isSupportPTZ()
// Close connection
iAiCameraIntrusion.disconnectCamera(true)
2.9 Picture Describer (Video to Text)
2.9.1 Query Task List
Method Name:
fun getPictureDescriberTasks(
homeId: String,
copilotId: String,
copilotVision: String,
copilotSrc: String?,
pageNo: Int,
pageSize: Int,
listener: Business.ResultListener<AnalysisList>
)
Parameters:
homeId
: Home IDcopilotId
: Copilot IDcopilotVision
: Copilot versioncopilotSrc
: Copilot source (optional), general service isai_service
pageNo
: Page numberpageSize
: Items per pagelistener
: Result listener for receiving PictureDescriber task list
Return Value:
- Returns
AnalysisList
object throughlistener
. PictureDescriber fields:
Field Name | Type | Description |
---|---|---|
items | List |
Analysis list items |
total | int | Total count |
Field Name | Type | Description |
---|---|---|
createTime | long | Creation time (timestamp) |
taskId | String | Analysis task ID |
content | String | Content |
copilotId | String | Copilot ID |
status | String | Analysis status (running, success, failed) |
deviceId | String | Device ID |
title | String | Title |
{
"items": [
{
"createTime": 1672531200,
"taskId": "task123",
"content": "Analysis content 1",
"copilotId": "copilot123",
"status": "success",
"deviceId": "device123",
"title": "Analysis Task 1"
}
],
"total": 2
}
Example:
CopilotSdk.getPictureDescriber().getPictureDescriberTasks(homeId, copilotId, copilotVersion, copilotSrc, pageNo, pageSize, object : Business.ResultListener<AnalysisList> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: AnalysisList?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: AnalysisList?, apiName: String?) {
}
})
2.9.2 Query Task Details
Method Name:
fun getPictureDescriberTaskDetail(taskId: String, listener: ResultListener<AnalysisResultDetail>)
Parameters:
taskId
: Task IDlistener
: Result listener for receiving PictureDescriber task details
Return Value:
- Returns
AnalysisResultDetail
object throughlistener
. AnalysisResultDetail fields:
Field Name | Type | Description |
---|---|---|
createTime | long | Creation time (timestamp) |
taskId | String | Analysis task ID |
content | String | Content |
copilotId | String | Copilot ID |
status | String | Analysis status (running, success, failed) |
deviceId | String | Device ID |
title | String | Title |
{
"createTime": 1672531200,
"taskId": "task123",
"content": "Analysis content",
"copilotId": "copilot123",
"status": "success",
"deviceId": "device123",
"title": "Analysis Task"
}
Example:
CopilotSdk.getPictureDescriber().getPictureDescriberTaskDetail(taskId, object : Business.ResultListener<AnalysisResultDetail> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: AnalysisResultDetail?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: AnalysisResultDetail?, apiName: String?) {
}
})
2.9.3 Delete Analysis Task
Method Name:
fun deletePictureDescriberTask(taskId: String, listener: ResultListener<String>)
Parameters:
taskId
: Task IDlistener
: Result listener for receiving deletion result
Return Value:
- Returns deletion result string through
listener
.
Example:
CopilotSdk.getPictureDescriber().deletePictureDescriberTask(taskId, object : Business.ResultListener<String> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
})
2.9.4 Query Current Home Camera Device List
Method Name:
fun getFamilyCameras(homeId: Long?, callback: IAiDeviceListCallBack)
Parameters:
homeId
: Current home IDcallback
: Result listener for getting device list (optional)
Return Value:
- Returns setup result string through
listener
. - IpcDeviceUiBean fields:
Variable Name | Type | Description |
---|---|---|
deviceId |
String |
Device unique identifier |
iconURL |
String |
Device icon URL |
isOnline |
boolean |
Device online status flag |
deviceName |
String |
Device name |
homeName |
String |
Home name of device |
selected |
boolean |
Device selection flag |
homeId |
String |
Home unique identifier |
[{
"deviceId": "String",
"iconURL": "String",
"isOnline": "boolean",
"deviceName": "String",
"homeName": "String",
"selected": "boolean",
"homeId": "String"
}]
Example
CopilotSdk.getDeviceApi().getFamilyCameras(true,homeId,object:IAiDeviceListCallBack{
})
2.9.5 Query All Family Camera Device List
Method Name:
fun getFamilyCameras(deviceType: String?, pageNo: String?, pageSize: String?, callback: IAiDeviceListCallBack)
Parameter Description:
deviceType
: Device type, e.g., "ipc"pageNo
: Page number, can be nullpageSize
: Number of items per page, can be nullcallback
: Result listener, retrieves the list of devices
Return Result:
- Returns the result via
listener
as a string. - Fields of
IpcDeviceUiBean
are as follows: Same as 2.9.4
Usage Example
CopilotSdk.getDeviceApi().getFamilyCameras("ipc", null, null, object : IAiDeviceListCallBack {
override fun onUiDataCallBack(list: ArrayList<IpcDeviceUiBean>) {
}
override fun onDataError(error: String?) {
}
})
2.9.6 Query Device Video List
Method Name:
fun getDeviceVideos(
deviceId: String,
startTime: Long,
pageSize: Int,
listener: ResultListener<ArrayList<IpcVideoClip>>
)
Parameters:
deviceId
: Device IDstartTime
: Start time (timestamp)pageSize
: Items per pagelistener
: Result listener for receiving device video list
Return Value:
- Returns
ArrayList<IpcVideoClip>
object throughlistener
. IpcVideoClip fields:
Field Name | Type | Description |
---|---|---|
prefix | long | Video prefix |
startTime | long | Start time (timestamp) |
endTime | long | End time (timestamp) |
snapshotUrl | String | Snapshot URL |
v | int | Version |
encryption | EncryptionBean | Encryption information |
Field Name | Type | Description |
---|---|---|
key | String | Encryption key |
{
"prefix": 1234567890,
"startTime": 1672531200,
"endTime": 1672534800,
"snapshotUrl": "https://example.com/snapshot.jpg",
"v": 1,
"encryption": {
"key": "encryptionKey123"
}
}
Example:
CopilotSdk.getPictureDescriber().getDeviceVideos(deviceId, startTime, pageSize, object : Business.ResultListener<ArrayList<IpcVideoClip>> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: ArrayList<IpcVideoClip>?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: ArrayList<IpcVideoClip>?, apiName: String?) {
}
})
2.9.7 Submit Task
Method Name:
fun submitPictureDescriberTask(task: CreateAnalysisTask, listener: ResultListener<String>)
Parameters:
task
: Create analysis task Beanlistener
: Result listener for receiving submission result
Return Value:
- Returns submission result string through
listener
. bizResult is taskId
Example:
var createAnalysisTask = CreateAnalysisTask()
createAnalysisTask.copilotId = "fdsfd"
createAnalysisTask.copilotVersion = "1.0"
createAnalysisTask.copilotSrc = "ai_service"
createAnalysisTask.homeId = "home13e"
createAnalysisTask.deviceId = "fdfff"
createAnalysisTask.prefixes = arrayListOf(1L, 2L)
CopilotSdk.getPictureDescriber().submitPictureDescriberTask(createAnalysisTask, object : Business.ResultListener<String> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: String?, apiName: String?) {
}
})
2.10 Message Management
2.10.1 Get AI Group Message List
Method Name
fun getAiMessageGroupList(
msgType: Int,
pageNo: Int,
pageSize: Int,
listener: ResultListener<AiMessageListBean>?
)
Parameter Description
msgType
: Message type, 1: AI copilot messagepageNo
: Page numberpageSize
: Page sizelistener
: Result listener, returns data of typeAiMessageListBean
Return Result:
- Returns an
AiMessageListBean
object vialistener
. The fields of AiMessageListBean are as follows:
Field Name | Type | Description |
---|---|---|
data | ArrayList |
List of message items |
total | int | Total number of messages |
Fields of AiMessageItemBean are as follows:
Field Name | Type | Description |
---|---|---|
msgCategory | int | Message category |
id | String | Message ID |
msgType | int | Message type |
msgSrcId | String | Message source ID |
msgTitle | String | Message title |
msgContent | String | Message content |
icon | String | Message icon |
actionUrl | String | Action URL |
uid | String | User ID |
appId | String | Application ID |
tenantId | String | Tenant ID |
deleted | int | Deletion status |
gmtCreate | long | Creation time |
gmtModified | long | Modification time |
attachs | ArrayList |
List of attachments |
hasUnRead | boolean | Whether there are unread messages |
pushTime | long | Push time |
Fields of AIAttachBean are as follows:
Field Name | Type | Description |
---|---|---|
attachType | int | Attachment type (0: Image, 1: Audio, 2: Video) |
attach | AIAttachFileBean | Attachment file |
Fields of AIAttachFileBean are as follows:
Field Name | Type | Description |
---|---|---|
fileType | int | File type (1: Normal URL, 2: File ID type, 3: File encryption) |
file | AIAttachFileUrlBean | File information |
Fields of AIAttachFileUrlBean are as follows:
Field Name | Type | Description |
---|---|---|
urls | ArrayList |
List of URLs |
{
"data": [
{
"msgCategory": 1,
"id": "12345",
"msgType": 1,
"msgSrcId": "src123",
"msgTitle": "Message Title",
"msgContent": "Message Content",
"icon": "http://example.com/icon.png",
"actionUrl": "http://example.com/action",
"uid": "user123",
"appId": "app123",
"tenantId": "tenant123",
"deleted": 0,
"gmtCreate": 1633072800000,
"gmtModified": 1633072800000,
"attachs": [
{
"attachType": 0,
"attach": {
"fileType": 1,
"file": {
"urls": [
"http://example.com/file1.jpg",
"http://example.com/file2.jpg"
]
}
}
}
],
"hasUnRead": true,
"pushTime": 1633072800000
}
],
"total": 1
}
Usage Example
CopilotSdk.getMessageApi().getAiMessageGroupList(1,1,20,object:Business.ResultListener<AiMessageListBean>{
override fun onFailure(bizResponse: BusinessResponse?, bizResult: AiMessageListBean?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: AiMessageListBean?, apiName: String?) {
}
})
2.10.2 Get AI Message List
Method Name
fun getAiMessageList(
msgType: Int,
msgSrcId: String?,
pageNo: Int,
pageSize: Int,
listener: ResultListener<AiMessageListBean>?
)
Parameter Description
msgType
: Message type, 1: AI copilot messagemsgSrcId
: Message source IDpageNo
: Page numberpageSize
: Page sizelistener
: Result listener, returns data of typeAiMessageListBean
Return Result:
- Returns an
AiMessageListBean
object vialistener
. The fields of AiMessageListBean are the same as in 2.10.1.
Usage Example
CopilotSdk.getMessageApi().getAiMessageList(1,"11,22",1,20,object:Business.ResultListener<AiMessageListBean>{
override fun onFailure(bizResponse: BusinessResponse?, bizResult: AiMessageListBean?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: AiMessageListBean?, apiName: String?) {
}
})
2.10.3 Batch Delete Messages
Method Name
fun deleteAiMessages(
msgType: Int,
type: Int,
ids: String?,
msgSrcIds: String?,
listener: ResultListener<Boolean>?
)
Parameter Description
msgType
: Message type, 1: AI copilot messagetype
: Operation type, 0: Group message, 1: Messageids
: Collection of message IDs, multiple IDs separated by commas. Cannot be null when type=1; can be null when type=0.msgSrcIds
: Collection of message source IDs, multiple IDs separated by commas. Cannot be null when type=0; can be null when type=1.listener
: Result listener, returns a Boolean value indicating whether the operation was successful.
Return Result:
- Returns the deletion result via
listener
.
Usage Example
CopilotSdk.getMessageApi().deleteAiMessages(1,0,"","11,22",object:Business.ResultListener<Boolean>{
override fun onFailure(bizResponse: BusinessResponse?, bizResult: Boolean?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: Boolean?, apiName: String?) {
}
})
2.10.4 Check for New Messages
Method Name
fun checkForNewMessages(
msgType: Int,
listener: ResultListener<Boolean>?
)
Parameter Description
msgType
: Message type, 1: AI copilot messagelistener
: Result listener, returns a Boolean value indicating whether there are new messages.
Return Result:
- Returns whether there are new messages via
listener
.
Usage Example
CopilotSdk.getMessageApi().checkForNewMessages(1, object : Business.ResultListener<Boolean> {
override fun onFailure(bizResponse: BusinessResponse?, bizResult: Boolean?, apiName: String?) {
}
override fun onSuccess(bizResponse: BusinessResponse?, bizResult: Boolean?, apiName: String?) {
}
})
2.11 Pet Care
2.11.1 Get Pet List
Method Name
fun getPetList(callback: IAIResultCallBack<ArrayList<AiPetUiBean>>)
Parameters
callback
: Result listener that returns the pet list
Return Result:
- Returns
AiPetUiBean
object throughcallback
, AiMessageListBean fields are as follows:
Field Name | Type | Description |
---|---|---|
petId |
String |
Unique identifier for the pet |
petIcon |
String |
Pet icon URL or path |
petIconFileId |
String |
Pet icon file unique identifier |
petName |
String |
Pet name |
weight |
float |
Pet weight |
age |
int |
Pet age |
birthDay |
long |
Pet birthday (timestamp) |
gender |
String |
Pet gender (Enum: GIRL, BOY, STERILIZED_BOY, STERILIZED_GIRL) |
petType |
String |
Pet type (Enum: CAT, DOG) |
status |
String |
Pet status (e.g., healthy, sick) |
identityId |
String |
Pet identity identifier |
{
"petId": "12345",
"petIcon": "https://example.com/pet-icon.jpg",
"petIconFileId": "icon-file-123",
"petName": "Buddy",
"weight": 12.5,
"age": 3,
"birthDay": 1672531200,
"gender": "Male",
"petType": "Dog",
"status": "Healthy",
"identityId": "pet-identity-123"
}
Usage Example
CopilotSdk.getPetCareApi().getPetList(object:IAIResultCallBack<ArrayList<AiPetUiBean>>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: ArrayList<AiPetUiBean>?) {
}
})
2.11.2 Delete Pet
Method Name
fun deletePet(petId: String, callback: IAIResultCallBack<Boolean>?)
Parameters
callback
: Result listener that returns the deletion result
Return Result:
- Returns
Boolean
object throughcallback
Usage Example
CopilotSdk.getPetCareApi().deletePet("12345", object:IAIResultCallBack<Boolean>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result:Boolean?) {
}
})
2.11.3 Add Pet
Method Name
fun addPet(petType: String, name: String, avatar: String, gender: String, birthday: Long, weight: Float, videoIdentityId: String, callback: IAIResultCallBack<AIPetItem>?)
Parameters
petType
: Pet type enum (CAT, DOG)name
: Pet nameavatar
: Pet avatargender
: Gender (Enum: GIRL, BOY, STERILIZED_BOY, STERILIZED_GIRL)birthday
: Birthday timestamp in millisecondsweight
: WeightvideoIdentityId
: Recognition video IDcallback
: Result listener that returnsAIPetItem
type data
Return Result:
- Returns
AIPetItem
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Pet ID |
type |
String |
Pet type (Enum: CAT, DOG) |
name |
String |
Pet name |
avatar |
String |
Pet avatar info (local path or identifier) |
gender |
String |
Pet gender, possible values: - BOY (Male)- GIRL (Female)- STERILIZED_BOY (Neutered Male)- STERILIZED_GIRL (Spayed Female) |
birthday |
long |
Pet birthday (timestamp in milliseconds) |
age |
int |
Pet age (in years) |
weight |
float |
Pet weight (in kg or other standard unit) |
avatarUrl |
String |
Pet avatar URL |
status |
String |
Pet status (e.g., healthy, sick) |
identityId |
String |
Pet identity identifier (e.g., chip number) |
{
"id": "12345",
"type": "Dog",
"name": "Buddy",
"avatar": "local-avatar-path",
"gender": "BOY",
"birthday": 1672531200,
"age": 3,
"weight": 12.5,
"avatarUrl": "https://example.com/pet-avatar.jpg",
"status": "Healthy",
"identityId": "chip-123456"
}
Usage Example
CopilotSdk.getPetCareApi().addPet(
"DOG",
"Team",
"fdfd",
"GIRL",
1343434343434,
12f,
"ffdf",
object:IAIResultCallBack<AIPetItem>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: AIPetItem?) {
}
}
)
2.11.4 Update Pet
Method Name
fun updatePet(petId: String, name: String, avatar: String, gender: String, birthday: Long, weight: Float, identityId: String?, callback: IAIResultCallBack<AIPetItem>?)
Parameters
petId
: Pet IDname
: Pet nameavatar
: Pet avatargender
: Gender (Enum: GIRL, BOY, STERILIZED_BOY, STERILIZED_GIRL)birthday
: Birthdayweight
: WeightidentityId
: Identity IDcallback
: Result listener that returnsAIPetItem
type data
Return Result:
- Returns
AIPetItem
object throughcallback
with fields as described in section 2.11.3
Usage Example
CopilotSdk.getPetCareApi().updatePet(
"11",
"Team",
"fdfd",
"GIRL",
1343434343434,
12f,
"ffdf",
object:IAIResultCallBack<AIPetItem>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: AIPetItem?) {
}
}
)
2.11.5 Upload Identity
Method Name
fun uploadAiIdentify(fileId: String, callback: IAIResultCallBack<AIVideoIdentifyBean>?)
Parameters
fileId
: File IDcallback
: Result listener that returnsAIVideoIdentifyBean
type data
Return Result:
- Returns
AIVideoIdentifyBean
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
id |
String |
File ID |
{
"id": "12345"
}
Usage Example
CopilotSdk.getPetCareApi().uploadAiIdentify(
"11",
object:IAIResultCallBack<AIVideoIdentifyBean>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: AIVideoIdentifyBean?) {
}
}
)
2.11.6 Get Identity Status
Method Name
fun getAiIdentifyStatus(id: String, callback: IAIResultCallBack<AIIdentifyBean>?)
Parameters
id
: Identity ID to checkcallback
: Result listener that returnsAIIdentifyBean
type data
Return Result:
- Returns
AIIdentifyBean
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
fileId |
String |
File ID |
id |
String |
File ID |
status |
String |
Status (Enum: READY, FAILED, ANALYZING) |
{
"id": "12345",
"fileId": "dfd",
"status": "READY"
}
Usage Example
CopilotSdk.getPetCareApi().getAiIdentifyStatus(
"11",
object:IAIResultCallBack<AIIdentifyBean>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: AIIdentifyBean?) {
}
}
)
2.11.7 Get Tag List
Method Name
fun getTagList(callback: IAIResultCallBack<ArrayList<AiPetUiTagBean>>)
Parameters
callback
: Result listener that returnsAiPetUiTagBean
type data
Return Result:
- Returns
AiPetUiTagBean
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
tagName |
String |
Tag name |
tagId |
long |
Tag ID |
tagType |
String |
Tag type (Enum: HIGHLIGHT, ABNORMAL, CUSTOM) |
{
"tagId": "12345",
"tagName": "dfd",
"tagType": "HIGHLIGHT"
}
Usage Example
CopilotSdk.getPetCareApi().getTagList(
object:IAIResultCallBack<ArrayList<AiPetUiTagBean>>{
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: ArrayList<AiPetUiTagBean>?) {
}
}
)
2.11.8 Add Custom Tag
Method Name
fun addCustomTag(type: String, tagName: String, callback: IAIResultCallBack<AiPetUiTagBean>)
Parameters
type
: Tag type (Enum: CUSTOM)tagName
: Tag namecallback
: Result listener that returnsAiPetUiTagBean
type data
Return Result:
- Returns
AiPetUiTagBean
object throughcallback
with fields as described in section 2.11.7
Usage Example
CopilotSdk.getPetCareApi().addCustomTag(
"CUSTOM",
"kjfdjkf",
object : IAIResultCallBack<AiPetUiTagBean> {
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: AiPetUiTagBean?) {
}
}
)
2.11.9 Delete Custom Tag
Method Name
fun deleteCustomTag(id: Long, callback: IAIResultCallBack<String>)
Parameters
id
: Tag IDcallback
: Result listener that returnsString
type data
Return Result:
- Returns
String
throughcallback
Usage Example
CopilotSdk.getPetCareApi().deleteCustomTag(
111,
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: String?) {
}
}
)
2.11.10 Get Daily Album List
Method Name
fun getDayAlbumList(petIds: ArrayList<String>, pageSize: Int, startTime: Long?, endTime: Long?, callback: IAIResultCallBack<ArrayList<AIAlbumUiBean>>)
Parameters
petIds
: List of pet IDspageSize
: Number of items per pagestartTime
: Start time (timestamp in milliseconds, optional)endTime
: End time (timestamp in milliseconds, optional)callback
: Result listener that returnsArrayList<AIAlbumUiBean>
type data
Return Result:
- Returns
ArrayList<AIAlbumUiBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
type |
int |
Album type (1:Year, 2:Month, 3:Day, 4:Time) |
time |
long |
Timestamp |
id |
int |
Album ID |
mediaBean |
AIAlbumMediaBean |
Media information |
timeInfo |
AiAlbumTimeUiInfo |
Time information |
AIAlbumMediaBean fields:
Field Name | Type | Description |
---|---|---|
startTime |
long |
Start time |
endTime |
long |
End time |
fileURL |
String |
File URL |
previewURL |
String |
Preview URL |
id |
long |
Media ID |
model |
String |
Media type (IMAGE, AUDIO, VIDEO) |
source |
String |
Source type (MOTION, SOUND) |
AiAlbumTimeUiInfo fields:
Field Name | Type | Description |
---|---|---|
year |
String |
Year |
month |
String |
Month (1-12) |
firstDay |
String |
First day of the month |
lastDay |
String |
Last day of the month |
{
"type": 3,
"time": 1672531200000,
"id": 123,
"mediaBean": {
"startTime": 1672531200000,
"endTime": 1672534800000,
"fileURL": "https://example.com/file.mp4",
"previewURL": "https://example.com/preview.jpg",
"id": 456,
"model": "VIDEO",
"source": "MOTION"
},
"timeInfo": {
"year": "2023",
"month": "12",
"firstDay": "1",
"lastDay": "31"
}
}
Usage Example
var petIds = ArrayList<String>()
petIds.add("pet123")
CopilotSdk.getPetCareApi().getDayAlbumList(
petIds,
20,
null,
null,
object : IAIResultCallBack<ArrayList<AIAlbumUiBean>> {
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: ArrayList<AIAlbumUiBean>?) {
}
}
)
2.11.11 Get Monthly Album List
Method Name
fun getMonthAlbumList(petIds: ArrayList<String>, pageSize: Int, startTime: Long?, endTime: Long?, callback: IAIResultCallBack<ArrayList<AIAlbumUiBean>>)
Parameters
petIds
: List of pet IDspageSize
: Number of items per pagestartTime
: Start time (timestamp in milliseconds, optional)endTime
: End time (timestamp in milliseconds, optional)callback
: Result listener that returnsArrayList<AIAlbumUiBean>
type data
Return Result:
- Returns
ArrayList<AIAlbumUiBean>
object throughcallback
with fields as described in section 2.11.10
Usage Example
var petIds = ArrayList<String>()
petIds.add("pet123")
CopilotSdk.getPetCareApi().getMonthAlbumList(
petIds,
20,
null,
null,
object : IAIResultCallBack<ArrayList<AIAlbumUiBean>> {
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: ArrayList<AIAlbumUiBean>?) {
}
}
)
2.11.12 Get Yearly Album List
Method Name
fun getYearAlbumList(petIds: ArrayList<String>, callback: IAIResultCallBack<ArrayList<AIAlbumUiBean>>)
Parameters
petIds
: List of pet IDscallback
: Result listener that returnsArrayList<AIAlbumUiBean>
type data
Return Result:
- Returns
ArrayList<AIAlbumUiBean>
object throughcallback
with fields as described in section 2.11.10
Usage Example
var petIds = ArrayList<String>()
petIds.add("pet123")
CopilotSdk.getPetCareApi().getYearAlbumList(
petIds,
object : IAIResultCallBack<ArrayList<AIAlbumUiBean>> {
override fun onError(errorCode: String?, error: String?) {
}
override fun onSuccess(result: ArrayList<AIAlbumUiBean>?) {
}
}
)
2.11.13 Delete Photo
Method Name
fun deletePetAlbum(id: Long, callback: IAIResultCallBack<String>)
Parameters
id
: Photo IDcallback
: Result listener that returns deletion result
Return Result:
- Returns result string through
callback
Usage Example
CopilotSdk.getPetCareApi().deletePetAlbum(
photoId,
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
}
}
)
2.11.14 Get Activity List
Method Name
fun getPetActivityList(
petIds: ArrayList<String>,
source: String,
startTime: Long,
endTime: Long,
pageNo: Int,
pageSize: Int,
callback: IAIResultCallBack<ArrayList<AIActivityUiBean>>?
)
Parameters
petIds
: List of pet IDssource
: Source typestartTime
: Start time (timestamp in milliseconds)endTime
: End time (timestamp in milliseconds)pageNo
: Page numberpageSize
: Number of items per pagecallback
: Result listener that returns activity list data
Return Result:
- Returns
ArrayList<AIActivityUiBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
type |
int |
Type (3:Image, 4:Time) |
time |
long |
Timestamp |
activityId |
String |
Activity ID |
mediaBean |
AIAlbumMediaBean |
Media information |
contentList |
ArrayList<AIPetContentUiItem> |
Content list |
AIAlbumMediaBean fields:
Field Name | Type | Description |
---|---|---|
startTime |
long |
Start time |
endTime |
long |
End time |
fileURL |
String |
File URL |
previewURL |
String |
Preview URL |
id |
long |
Media ID |
model |
String |
Media type (IMAGE, AUDIO, VIDEO) |
source |
String |
Source type (MOTION, SOUND) |
AIPetContentUiItem fields:
Field Name | Type | Description |
---|---|---|
pet |
String |
Pet ID |
tag |
ArrayList<AiTagContent> |
Tag content list |
AiTagContent fields:
Field Name | Type | Description |
---|---|---|
type |
String |
Tag type |
name |
String |
Tag name |
source |
String |
Tag source |
{
"type": 3,
"time": 1672531200000,
"activityId": "activity123",
"mediaBean": {
"startTime": 1672531200000,
"endTime": 1672534800000,
"fileURL": "https://example.com/file.mp4",
"previewURL": "https://example.com/preview.jpg",
"id": 456,
"model": "VIDEO",
"source": "MOTION"
},
"contentList": [
{
"pet": "pet123",
"tag": [
{
"type": "activity",
"name": "running",
"source": "system"
}
]
}
]
}
Usage Example
var petIds = ArrayList<String>()
petIds.add("pet123")
CopilotSdk.getPetCareApi().getPetActivityList(
petIds,
"MOTION",
startTime,
endTime,
1,
20,
object : IAIResultCallBack<ArrayList<AIActivityUiBean>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AIActivityUiBean>?) {
// Handle success
}
}
)
2.11.15 Delete Activity Tag
Method Name
fun deleteActivityTag(
activityId: String,
petId: String,
type: String,
tagName: String,
callback: IAIResultCallBack<AIActivityUiBean>?
)
Parameters
activityId
: Activity IDpetId
: Pet IDtype
: Tag typetagName
: Tag namecallback
: Result listener that returns updated activity information
Return Result:
- Returns
AIActivityUiBean
object throughcallback
with fields as described in section 2.11.14
Usage Example
CopilotSdk.getPetCareApi().deleteActivityTag(
"activity123",
"pet123",
"activity",
"running",
object : IAIResultCallBack<AIActivityUiBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIActivityUiBean?) {
// Handle success
}
}
)
2.11.16 Add Activity Tag
Method Name
fun addActivityTag(
activityId: String,
petId: String,
type: String,
tagName: String,
callback: IAIResultCallBack<AIActivityUiBean>?
)
Parameters
activityId
: Activity IDpetId
: Pet IDtype
: Tag type (Enum: HIGHLIGHT, ABNORMAL, CUSTOM)tagName
: Tag namecallback
: Result listener that returns updated activity information
Return Result:
- Returns
AIActivityUiBean
object throughcallback
with fields as described in section 2.11.14
Usage Example
CopilotSdk.getPetCareApi().addActivityTag(
"activity123",
"pet123",
"activity",
"running",
object : IAIResultCallBack<AIActivityUiBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIActivityUiBean?) {
// Handle success
}
}
)
2.11.17 Get Activity Details
Method Name
fun getPetActivityDetail(
activityId: String,
callback: IAIResultCallBack<AIActivityUiBean>?
)
Parameters
activityId
: Activity IDcallback
: Result listener that returns activity details
Return Result:
- Returns
AIActivityUiBean
object throughcallback
with fields as described in section 2.11.14
Usage Example
CopilotSdk.getPetCareApi().getPetActivityDetail(
"activity123",
object : IAIResultCallBack<AIActivityUiBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIActivityUiBean?) {
// Handle success - activity details received
}
}
)
2.11.18 Get Abnormal Calendar
Method Name
fun getAbnormalCalendar(
petIds: List<String>,
startTime: Long,
endTime: Long,
callback: IAIResultCallBack<ArrayList<AiPetAbnormalCalendarBean>?>?
)
Parameters
petIds
: List of pet IDsstartTime
: Start time (timestamp)endTime
: End time (timestamp)callback
: Result listener that returns abnormal calendar data
Return Result:
- Returns
ArrayList<AiPetAbnormalCalendarBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
pet |
List<AIPetItem> |
List of pet information |
days |
List<String> |
List of abnormal dates |
AIPetItem fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Pet ID |
type |
String |
Pet type (e.g., CAT) |
name |
String |
Pet name |
avatar |
String |
Avatar |
avatarUrl |
String |
Avatar URL |
gender |
String |
Gender (BOY:Male, GIRL:Female, STERILIZED_BOY:Neutered Male, STERILIZED_GIRL:Spayed Female) |
birthday |
long |
Birthday timestamp |
age |
int |
Age |
weight |
float |
Weight |
status |
String |
Status |
identityId |
String |
Identity ID |
[
{
"pet": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "CAT",
"name": "Kitty",
"avatar": "avatar_path",
"avatarUrl": "https://example.com/avatar.jpg",
"gender": "STERILIZED_GIRL",
"birthday": 1566604800000,
"age": 3,
"weight": 4.5,
"status": "active",
"identityId": "id123"
}
],
"days": [
"2023-12-01",
"2023-12-15",
"2023-12-30"
]
}
]
Usage Example
val petIds = listOf("pet123", "pet456")
CopilotSdk.getPetCareApi().getAbnormalCalendar(
petIds,
startTime,
endTime,
object : IAIResultCallBack<ArrayList<AiPetAbnormalCalendarBean>?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiPetAbnormalCalendarBean>?) {
// Handle success - process abnormal calendar data
result?.forEach { calendar ->
// Process pet information
calendar.pet?.forEach { pet ->
val petName = pet.name
val petGender = pet.gender
val petAge = pet.age
}
// Process abnormal dates
calendar.days?.forEach { day ->
// Process each abnormal date
}
}
}
}
)
2.11.19 Get Abnormal Behavior
Method Name
fun getAbnormalBehavior(
petIds: List<String>,
startTime: Long,
endTime: Long,
callback: IAIResultCallBack<ArrayList<AiPetAbnormalBehaviorBean>?>?
)
Parameters
petIds
: List of pet IDsstartTime
: Start time (timestamp)endTime
: End time (timestamp)callback
: Result listener that returns abnormal behavior data
Return Result:
- Returns
ArrayList<AiPetAbnormalBehaviorBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
tag |
String |
Abnormal behavior tag |
count |
int |
Number of occurrences of abnormal behavior |
[
{
"tag": "excessive_grooming",
"count": 5
},
{
"tag": "scratching",
"count": 3
}
]
Usage Example
val petIds = listOf("pet123", "pet456")
CopilotSdk.getPetCareApi().getAbnormalBehavior(
petIds,
startTime,
endTime,
object : IAIResultCallBack<ArrayList<AiPetAbnormalBehaviorBean>?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiPetAbnormalBehaviorBean>?) {
// Handle success - process abnormal behavior data
result?.forEach { behavior ->
val behaviorTag = behavior.tag
val behaviorCount = behavior.count
// Process each abnormal behavior data
}
}
}
)
2.11.20 Get Pet Abnormal List
Method Name
fun getPetAbnormalList(
petIds: List<String>,
startTime: Long,
endTime: Long,
size: Int,
page: Int,
callback: IAIResultCallBack<AiAbnormalPageBean?>?
)
Parameters
petIds
: List of pet IDsstartTime
: Start time (timestamp)endTime
: End time (timestamp)size
: Number of items per pagepage
: Page numbercallback
: Result listener that returns abnormal list data
Return Result:
- Returns
AiAbnormalPageBean
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
totalPages |
int |
Total number of pages |
totalElements |
int |
Total number of records |
size |
int |
Page size |
number |
int |
Current page number |
content |
List<AiPetActivityItem> |
List of abnormal activities |
AiPetActivityItem fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Activity ID |
media |
AiMediaBean |
Media information |
content |
ArrayList<AIPetContentItem> |
Pet content list |
AiMediaBean fields:
Field Name | Type | Description |
---|---|---|
id |
int |
Media ID |
uri |
String |
Media URI |
modal |
String |
Media mode |
source |
String |
Media source |
startTime |
long |
Start time (timestamp) |
endTime |
long |
End time (timestamp) |
fileUrl |
String |
File URL |
previewUrl |
String |
Preview URL |
{
"totalPages": 5,
"totalElements": 100,
"size": 20,
"number": 1,
"content": [
{
"id": "activity123",
"media": {
"id": 456,
"uri": "media/456",
"modal": "VIDEO",
"source": "MOTION",
"startTime": 1672531200000,
"endTime": 1672534800000,
"fileUrl": "https://example.com/video.mp4",
"previewUrl": "https://example.com/preview.jpg"
},
"content": [
{
"pet": "pet123",
"tag": [
{
"type": "activity",
"name": "running",
"source": "system"
}
]
}
]
}
]
}
Usage Example
val petIds = listOf("pet123", "pet456")
CopilotSdk.getPetCareApi().getPetAbnormalList(
petIds,
startTime,
endTime,
20, // size
1, // page
object : IAIResultCallBack<AiAbnormalPageBean?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AiAbnormalPageBean?) {
// Handle success - process abnormal list data
}
}
)
2.11.21 Get Daily Activity
Method Name
fun getDailyActivity(
petIds: List<String>,
startTime: Long,
endTime: Long,
callback: IAIResultCallBack<ArrayList<AiPetDailyActiveBean>?>?
)
Parameters
petIds
: List of pet IDsstartTime
: Start time (timestamp)endTime
: End time (timestamp)callback
: Result listener that returns daily activity data
Return Result:
- Returns
ArrayList<AiPetDailyActiveBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
hour |
int |
Hour (0-23) |
count |
int |
Number of activities in that hour |
[
{
"hour": 8,
"count": 5
}
]
Usage Example
val petIds = listOf("pet123", "pet456")
CopilotSdk.getPetCareApi().getDailyActivity(
petIds,
startTime,
endTime,
object : IAIResultCallBack<ArrayList<AiPetDailyActiveBean>?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiPetDailyActiveBean>?) {
// Handle success - process daily activity data
result?.forEach { activity ->
val hour = activity.hour // Get hour
val count = activity.count // Get activity count for that hour
// Process hourly activity data
}
}
}
)
2.11.22 Get Daily Sleep
Method Name
fun getDailySleep(
petIds: List<String>,
startTime: Long,
endTime: Long,
callback: IAIResultCallBack<ArrayList<AiPetDailySleepBean>?>?
)
Parameters
petIds
: List of pet IDsstartTime
: Start time (timestamp)endTime
: End time (timestamp)callback
: Result listener that returns daily sleep data
Return Result:
- Returns
ArrayList<AiPetDailySleepBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
tag |
String |
Sleep tag |
count |
int |
Number of sleep occurrences |
[
{
"tag": "deep_sleep",
"count": 3
},
{
"tag": "light_sleep",
"count": 5
}
]
Usage Example
val petIds = listOf("pet123", "pet456")
CopilotSdk.getPetCareApi().getDailySleep(
petIds,
startTime,
endTime,
object : IAIResultCallBack<ArrayList<AiPetDailySleepBean>?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiPetDailySleepBean>?) {
// Handle success - process daily sleep data
}
}
)
2.11.23 Get Daily Behavior
Method Name
fun getDailyBehavior(
petIds: List<String>,
startTime: Long,
endTime: Long,
callback: IAIResultCallBack<ArrayList<AiPetDailyBehaviorBean>?>?
)
Parameters
petIds
: List of pet IDsstartTime
: Start time (timestamp)endTime
: End time (timestamp)callback
: Result listener that returns daily behavior data
Return Result:
- Returns
ArrayList<AiPetDailyBehaviorBean>
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
tag |
String |
Behavior tag |
count |
int |
Number of behavior occurrences |
[
{
"tag": "playing",
"count": 8
}
]
Usage Example
val petIds = listOf("pet123", "pet456")
CopilotSdk.getPetCareApi().getDailyBehavior(
petIds,
startTime,
endTime,
object : IAIResultCallBack<ArrayList<AiPetDailyBehaviorBean>?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiPetDailyBehaviorBean>?) {
// Handle success - process daily behavior data
}
}
)
2.12 Baby Care
2.12.1 Get Baby List
Method Name:
fun getBabyList(
callback: IAIResultCallBack<ArrayList<AiBabyUiBean>>
)
Parameters:
callback
: Result listener that returns the baby list data
Return Result:
- Returns
ArrayList<AiBabyUiBean>
object throughcallback
, AiBabyUiBean fields are as follows:
Field Name | Type | Description |
---|---|---|
babyId |
String |
Baby ID |
avatar |
String |
Avatar |
name |
String |
Name |
weight |
float |
Weight |
age |
int |
Age |
birthDay |
String |
Birth date |
gender |
String |
Gender |
deviceId |
String |
Device ID |
[
{
"babyId": "baby123",
"avatar": "https://example.com/avatar.jpg",
"name": "Tommy",
"weight": 8.5,
"age": 1,
"birthDay": "2023-01-01",
"gender": "BOY",
"deviceId": "device123"
}
]
Usage Example:
CopilotSdk.getBabyCareApi().getBabyList(
object : IAIResultCallBack<ArrayList<AiBabyUiBean>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiBabyUiBean>?) {
// Handle success, baby list data received
}
})
2.12.2 Add Baby
Method Name:
fun addBaby(
name: String,
gender: String,
avatar: String,
birthday: String,
weight: Float,
cameraId: String,
listener: IAIResultCallBack<AiBabyItem>?
)
Parameters:
name
: Baby's namegender
: Gender ("BOY" or "GIRL")avatar
: Avatarbirthday
: Birth date (format: yyyy-MM-dd)weight
: WeightcameraId
: Camera device IDlistener
: Result listener that returns the added baby information
Return Result:
- Returns
AiBabyItem
object throughlistener
with the following fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Baby ID |
type |
String |
Type |
name |
String |
Name |
avatar |
String |
Avatar |
gender |
String |
Gender ("BOY" or "GIRL") |
birthday |
String |
Birth date |
age |
int |
Age |
weight |
float |
Weight |
cameraId |
String |
Camera device ID |
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "BABY",
"name": "Tommy",
"avatar": "https://example.com/avatar.jpg",
"gender": "BOY",
"birthday": "2023-01-01",
"age": 1,
"weight": 8.5,
"cameraId": "camera123"
}
Usage Example:
CopilotSdk.getBabyCareApi().addBaby(
name = "Tommy",
gender = "BOY",
avatar = "https://example.com/avatar.jpg",
birthday = "2023-01-01",
weight = 8.5f,
cameraId = "camera123",
object : IAIResultCallBack<AiBabyItem> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AiBabyItem?) {
// Handle success, new baby information received
}
}
)
2.12.3 Update Baby
Method Name:
fun updateBaby(
babyId: String,
name: String,
gender: String,
avatar: String,
birthday: String,
weight: Float,
cameraId: String,
listener: IAIResultCallBack<AiBabyItem>?
)
Parameters:
babyId
: Baby IDname
: Baby's namegender
: Gender ("BOY" or "GIRL")avatar
: Avatarbirthday
: Birth date (format: yyyy-MM-dd)weight
: WeightcameraId
: Camera device IDlistener
: Result listener that returns the updated baby information
Return Result:
- Returns
AiBabyItem
object throughlistener
with fields as described in section 2.12.2
Usage Example:
CopilotSdk.getBabyCareApi().updateBaby(
babyId = "497f6eca-6276-4993-bfeb-53cbbbba6f08",
name = "Tommy",
gender = "BOY",
avatar = "https://example.com/avatar.jpg",
birthday = "2023-01-01",
weight = 9.0f,
cameraId = "camera123",
object : IAIResultCallBack<AiBabyItem> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AiBabyItem?) {
// Handle success, updated baby information received
}
}
)
2.12.4 Delete Baby
Method Name:
fun deleteBaby(
id: String,
listener: IAIResultCallBack<Boolean>?
)
Parameters:
id
: Baby IDlistener
: Result listener that returns the deletion result
Return Result:
- Returns
Boolean
value throughlistener
, indicating whether the deletion was successfultrue
: Deletion successfulfalse
: Deletion failed
true
Usage Example:
CopilotSdk.getBabyCareApi().deleteBaby(
id = "497f6eca-6276-4993-bfeb-53cbbbba6f08",
object : IAIResultCallBack<Boolean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: Boolean?) {
// Handle success
}
}
)
2.12.5 Get Album List
Method Name:
fun getBabyAlbumList(
babyIdList: ArrayList<String>,
startTime: String?,
endTime: String?,
pageSize: Int,
type: String,
callback: IAIResultCallBack<ArrayList<AIBabyAlbumUiBean>>
)
Parameters:
babyIdList
: List of baby IDsstartTime
: Start time (optional)endTime
: End time (optional)pageSize
: Number of items per pagetype
: Album typecallback
: Result listener that returns album list data
Return Result:
- Returns
ArrayList<AIBabyAlbumUiBean>
object throughcallback
with the following structure:
AIBabyAlbumUiBean fields:
Field Name | Type | Description |
---|---|---|
type |
int |
Time type (1: Year, 2: Month, 3: Day, 4: Time) |
time |
long |
Timestamp |
mediaBean |
AIBabyAlbumMediaBean |
Media information |
timeInfo |
AiAlbumTimeUiInfo |
Time information |
AIBabyAlbumMediaBean fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Media ID |
startTime |
String |
Start time |
endTime |
String |
End time |
fileURL |
String |
File URL |
previewURL |
String |
Preview URL |
model |
String |
Media type (IMAGE, AUDIO, VIDEO) |
source |
String |
Source type (MOTION, SOUND) |
AiAlbumTimeUiInfo fields:
Field Name | Type | Description |
---|---|---|
year |
String |
Year |
month |
String |
Month |
firstDay |
String |
First day of the period |
lastDay |
String |
Last day of the period |
[
{
"type": 1,
"time": 1672531200000,
"mediaBean": {
"id": "media123",
"startTime": "timestamp in milliseconds",
"endTime": "timestamp in milliseconds",
"fileURL": "https://example.com/media/file.mp4",
"previewURL": "https://example.com/media/preview.jpg",
"model": "VIDEO",
"source": "MOTION"
},
"timeInfo": {
"year": "2023",
"month": "1",
"firstDay": "2023-01-01",
"lastDay": "2023-01-31"
}
}
]
Usage Example:
val babyIds = arrayListOf("baby123", "baby456")
CopilotSdk.getBabyCareApi().getBabyAlbumList(
babyIdList = babyIds,
startTime = "2023-01-01",
endTime = "2023-12-31",
pageSize = 20,
type = "PHOTO",
object : IAIResultCallBack<ArrayList<AIBabyAlbumUiBean>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AIBabyAlbumUiBean>?) {
// Handle success, album list data received
}
}
)
2.12.6 Delete Album Photo
Method Name:
fun deleteBabyAlbum(
id: String,
callback: IAIResultCallBack<String>
)
Parameters:
id
: Media IDcallback
: Result listener that returns the deletion result
Return Result:
- Returns
String
throughcallback
indicating the result of the deletion operation
Usage Example:
CopilotSdk.getBabyCareApi().deleteBabyAlbum(
id = "media123",
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
result?.let { response ->
// Deletion successful, update UI accordingly
}
}
}
)
2.12.7 Add Activity Content
fun addBabyActivity(
babyId: String,
tag: ArrayList<String>?,
description: String?,
timestamp: String?,
callback: IAIResultCallBack<AIActivityUiBean>?
)
Parameters:
babyId
: Baby IDtag
: List of activity tags (optional)description
: Activity description (optional)timestamp
: Timestamp (optional)callback
: Result listener that returns the added activity information
Return Result:
- Returns
AIActivityUiBean
object throughcallback
with the following fields:
Field Name | Type | Description |
---|---|---|
type |
int |
Type (3: Image, 4: Time) |
time |
String |
Time |
activityId |
String |
Activity ID |
babyId |
String |
Baby ID |
mediaBean |
AIBabyAlbumMediaBean |
Media information (optional) |
content |
ArrayList<AiBabyEventItem> |
Activity content list |
AIBabyAlbumMediaBean fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Media ID |
startTime |
String |
Start time |
endTime |
String |
End time |
fileURL |
String |
File URL |
previewURL |
String |
Preview URL |
model |
String |
Media type (IMAGE, AUDIO, VIDEO) |
source |
String |
Source type (MOTION, SOUND) |
AiBabyEventItem fields:
Field Name | Type | Description |
---|---|---|
timestamp |
String |
Event timestamp |
description |
String |
Event description |
activity |
String |
Activity type |
events |
ArrayList<AiBabyEventTagItem> |
Event tag list |
AiBabyEventTagItem fields:
Field Name | Type | Description |
---|---|---|
tag |
String |
Tag name |
source |
String |
Tag source |
{
"type": 3,
"time": "132323232323232",
"activityId": "activity123",
"babyId": "baby123",
"mediaBean": {
"id": "media123",
"startTime": "3231231231232",
"endTime": "132323232323232",
"fileURL": "https://example.com/media/file.jpg",
"previewURL": "https://example.com/media/preview.jpg",
"model": "IMAGE",
"source": "MOTION"
},
"content": [
{
"timestamp": "1232131232132323232",
"description": "Baby is playing with toys",
"activity": "playing",
"events": [
{
"tag": "playing",
"source": "user_input"
}
]
}
]
}
Usage Example:
val activityTags = arrayListOf("feeding", "playing")
CopilotSdk.getBabyCareApi().addBabyActivity(
babyId = "baby123",
tag = activityTags,
description = "Baby had a great time playing today",
timestamp = "2023-01-01 10:00:00",
object : IAIResultCallBack<AIActivityUiBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIActivityUiBean?) {
// Handle success, new activity information received
}
}
)
2.12.8 Update Activity Content
Method Name:
fun updateBabyActivity(
babyId: String,
id: String,
tag: ArrayList<String>?,
description: String?,
callback: IAIResultCallBack<AIActivityUiBean>?
)
Parameters:
babyId
: Baby IDid
: Activity IDtag
: List of activity tags (optional)description
: Activity description (optional)callback
: Result listener that returns the updated activity information
Return Result:
- Returns
AIActivityUiBean
object throughcallback
with fields as described in section 2.12.7
Usage Example:
val updatedTags = arrayListOf("playing", "happy")
CopilotSdk.getBabyCareApi().updateBabyActivity(
babyId = "baby123",
id = "activity123",
tag = updatedTags,
description = "Baby is playing with toys and is very happy",
object : IAIResultCallBack<AIActivityUiBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIActivityUiBean?) {
// Handle success, updated activity information received
}
}
)
2.12.9 Get Activity Details
Method Name:
fun getBabyActivityDetail(
id: String,
callback: IAIResultCallBack<AIActivityUiBean>?
)
Parameters:
id
: Activity IDcallback
: Result listener that returns activity details
Return Result:
- Returns
AIActivityUiBean
object throughcallback
with fields as described in section 2.12.7
Usage Example:
CopilotSdk.getBabyCareApi().getBabyActivityDetail(
id = "activity123",
object : IAIResultCallBack<AIActivityUiBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIActivityUiBean?) {
// Handle success, activity details received
}
}
)
2.12.10 Delete Activity
Method Name:
fun deleteBabyActivity(
id: String,
callback: IAIResultCallBack<String>?
)
Parameters:
id
: Activity IDcallback
: Result listener that returns the deletion result
Return Result:
- Returns
String
throughcallback
indicating the result of the deletion operation
Usage Example:
CopilotSdk.getBabyCareApi().deleteBabyActivity(
id = "activity123",
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
}
}
)
2.12.11 Get Activity List
Method Name:
fun getBabyActivityList(
babyIdList: ArrayList<String>,
source: String,
startTime: String?,
endTime: String?,
pageSize: Int,
pageNo: Int,
callback: IAIResultCallBack<ArrayList<AIActivityUiBean>>?
)
Parameters:
babyIdList
: List of baby IDssource
: Data source (e.g., "MOTION" or "SOUND" or "")startTime
: Start time (optional) timestamp in millisecondsendTime
: End time (optional) timestamp in millisecondspageSize
: Number of items per pagepageNo
: Current page numbercallback
: Result listener that returns activity list data
Return Result:
- Returns
ArrayList<AIActivityUiBean>
throughcallback
, with object structure as described in section 2.12.7
Usage Example:
val babyIds = arrayListOf("baby123", "baby456")
CopilotSdk.getBabyCareApi().getBabyActivityList(
babyIdList = babyIds,
source = "USER",
startTime = "timestamp in milliseconds",
endTime = "timestamp in milliseconds",
pageSize = 10,
pageNo = 1,
object : IAIResultCallBack<ArrayList<AIActivityUiBean>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AIActivityUiBean>?) {
// Handle success, activity list data received
}
}
)
2.12.12 Get IPC Device List
Method Name:
fun getIpcDeviceList(listener: IAIResultCallBack<ArrayList<AIBabyCameraBean>?>?)
Parameters:
listener
: Result listener that returns IPC device list data
Return Result:
- Returns
ArrayList<AIBabyCameraBean>
object throughlistener
containing detailed IPC device information
AIBabyCameraBean fields:
Field Name | Type | Description |
---|---|---|
category |
String |
Device category |
icon |
String |
Device icon URL |
name |
String |
Device name |
online |
boolean |
Whether device is online |
bind |
boolean |
Whether device is bound |
ownerId |
String |
Device owner's family ID |
ownerName |
String |
Device owner's family name |
productId |
String |
Product ID |
productName |
String |
Product name |
uid |
String |
User ID |
uuid |
String |
Device unique identifier |
deviceId |
String |
Device ID |
[
{
"category": "IPC",
"icon": "https://example.com/icon.png",
"name": "Baby Room Camera",
"online": true,
"bind": true,
"ownerId": "owner123",
"ownerName": "John Smith",
"productId": "product123",
"productName": "Smart Camera",
"uid": "user123",
"uuid": "uuid-12345",
"deviceId": "camera123"
}
]
Usage Example:
CopilotSdk.getBabyCareApi().getIpcDeviceList(
object : IAIResultCallBack<ArrayList<AIBabyCameraBean>?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AIBabyCameraBean>?) {
// Handle success, IPC device list data received
}
}
)
2.12.13 Get Statistics Data
Method Name:
fun getStatisticsData(
babyId: String,
days: Int,
callback: IAIResultCallBack<AiBabyStatisticsBean>?
)
Parameters:
babyId
: Baby IDdays
: Number of days for statistics datacallback
: Result listener that returns statistics data
Return Result:
- Returns
AiBabyStatisticsBean
object throughcallback
containing detailed statistics information
AiBabyStatisticsBean fields:
Field Name | Type | Description |
---|---|---|
longestSleepingTime |
AiBabySleepTimeBean |
Longest sleep time information |
positions |
AiBabyPositionBean |
Baby position information |
activities |
List<AiBabyActivityBean> |
Activity list |
days |
int |
Number of days in statistics |
babyId |
String |
Baby ID |
AiBabySleepTimeBean fields:
Field Name | Type | Description |
---|---|---|
duration |
String |
Sleep duration |
start |
String |
Sleep start time |
end |
String |
Sleep end time |
AiBabyPositionBean fields:
Field Name | Type | Description |
---|---|---|
body |
List<AiBabyActivityBean> |
Body position activity list |
head |
List<AiBabyActivityBean> |
Head position activity list |
AiBabyActivityBean fields:
Field Name | Type | Description |
---|---|---|
tag |
String |
Activity tag |
count |
int |
Activity count |
Usage Example:
CopilotSdk.getBabyCareApi().getStatisticsData(
babyId = "baby123",
days = 7,
object : IAIResultCallBack<AiBabyStatisticsBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AiBabyStatisticsBean?) {
// Handle success, statistics data received
}
}
)
2.12.14 Get Voice Recognition Sample
Method Name:
fun getVoiceRecognitionSample(callback: IAIResultCallBack<AIBabyStorytellingVoiceSampleBean>)
Parameters:
callback
: Result listener that returns voice recognition sample data
Return Result:
- Returns
AIBabyStorytellingVoiceSampleBean
object throughcallback
containing detailed sample information
AIBabyStorytellingVoiceSampleBean fields:
Field Name | Type | Description |
---|---|---|
text |
String |
Sample content |
Usage Example:
CopilotSdk.getBabyCareApi().getVoiceRecognitionSample(
object : IAIResultCallBack<AIBabyStorytellingVoiceSampleBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AIBabyStorytellingVoiceSampleBean?) {
// Handle success, voice recognition sample received
result?.let { sample ->
val text = sample.text
// Use the sample content
}
}
}
)
2.12.15 Update Storytelling
Method Name:
fun updateStorytelling(id: String, playTime: String, babyId: String, callback: IAIResultErrorCodeCallBack<String>)
Parameters:
id
: Story IDplayTime
: Play time (timestamp in milliseconds)babyId
: Baby IDcallback
: Result listener that returns the update operation result
Return Result:
- Returns
String
throughcallback
indicating the result of the update operation
Usage Example:
CopilotSdk.getBabyCareApi().updateStorytelling(
id = "story123",
playTime = "2023-01-01 10:00:00",
babyId = "baby123",
object : IAIResultErrorCodeCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
}
}
)
2.12.16 Delete Storytelling
Method Name:
fun deleteStorytelling(id: String, callback: IAIResultCallBack<String>)
Parameters:
id
: Story IDcallback
: Result listener that returns the deletion result
Return Result:
- Returns
String
throughcallback
indicating the result of the deletion operation
Usage Example:
CopilotSdk.getBabyCareApi().deleteStorytelling(
id = "story123",
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
}
}
)
2.12.17 Get Story List
Method Name:
fun getStoryList(callback: IAIResultCallBack<ArrayList<AiBabyStorytellingStoryListItem>>)
Parameters:
callback
: Result listener that returns story list data
Return Result:
- Returns
ArrayList<AiBabyStorytellingStoryListItem>
object throughcallback
containing detailed story information
AiBabyStorytellingStoryListItem fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Story ID |
title |
String |
Story title |
content |
String |
Story content |
voiceId |
String |
Voice ID |
babyId |
String |
Baby ID |
status |
int |
Story status (0: analyze, 1: ready) |
createTime |
String |
Creation time (timestamp in ms) |
playTime |
String |
Play time |
babyAvatar |
String |
Baby's avatar |
babyName |
String |
Baby's name |
voiceName |
String |
Voice name |
babyGender |
String |
Baby's gender |
[
{
"id": "story123",
"title": "Little Red Riding Hood",
"content": "A story about Little Red Riding Hood",
"voiceId": "voice123",
"babyId": "baby123",
"status": 1,
"createTime": "1633036800000",
"playTime": "5 minutes",
"babyAvatar": "https://example.com/avatar/baby123.png",
"babyName": "Tommy",
"voiceName": "Gentle Voice",
"babyGender": "male"
}
]
Usage Example:
CopilotSdk.getBabyCareApi().getStoryList(
object : IAIResultCallBack<ArrayList<AiBabyStorytellingStoryListItem>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiBabyStorytellingStoryListItem>?) {
// Handle success, story list data received
}
}
)
2.12.18 Create Storytelling
Method Name:
fun createStorytelling(title: String, content: String, voiceId: String, playTime: String, babyId: String, callback: IAIResultErrorCodeCallBack<String>)
Parameters:
title
: Story titlecontent
: Story contentvoiceId
: Voice IDplayTime
: Play time (timestamp in milliseconds)babyId
: Baby IDcallback
: Result listener that returns the creation result
Return Result:
- Returns
String
throughcallback
indicating the result of the creation operation
Usage Example:
CopilotSdk.getBabyCareApi().createStorytelling(
title = "Little Red Riding Hood",
content = "A story about Little Red Riding Hood",
voiceId = "voice123",
playTime = "timestamp in milliseconds",
babyId = "baby123",
object : IAIResultErrorCodeCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
result?.let { response ->
// Creation successful, update UI accordingly
}
}
}
)
2.12.19 Delete Story Voice
Method Name:
fun deleteStoryVoice(id: String, callback: IAIResultCallBack<String>)
Parameters:
id
: Story voice IDcallback
: Result listener that returns the deletion result
Return Result:
- Returns
String
throughcallback
indicating the result of the deletion operation
Usage Example:
CopilotSdk.getBabyCareApi().deleteStoryVoice(
id = "voice123",
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
}
}
)
2.12.20 Get Voice List
Method Name:
fun getVoiceList(callback: IAIResultCallBack<ArrayList<AiBabyStorytellingSoundItem>>)
Parameters:
callback
: Result listener that returns voice list data
Return Result:
- Returns
ArrayList<AiBabyStorytellingSoundItem>
object throughcallback
containing detailed voice information
AiBabyStorytellingSoundItem fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Audio ID |
status |
int |
Audio status (0: analyzing, 1: ready, 2: un_upload) |
url |
String |
Audio file URL |
name |
String |
Audio name |
expireTime |
String |
Expiration time |
httpMethod |
String |
HTTP method |
[
{
"id": "voice123",
"status": 1,
"url": "https://example.com/audio/voice123.mp3",
"name": "Gentle Voice",
"expireTime": "2023-12-31T23:59:59Z",
"httpMethod": "GET"
}
]
Usage Example:
CopilotSdk.getBabyCareApi().getVoiceList(
object : IAIResultCallBack<ArrayList<AiBabyStorytellingSoundItem>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<AiBabyStorytellingSoundItem>?) {
// Handle success, voice list data received
}
}
)
2.12.21 Get Voice Upload Path
Method Name:
fun getVoiceUploadPath(name: String, callback: IAIResultCallBack<AiBabyStorytellingSoundUploadBean>)
Parameters:
name
: Voice file namecallback
: Result listener that returns voice upload path data
Return Result:
- Returns
AiBabyStorytellingSoundUploadBean
object throughcallback
containing detailed upload information
AiBabyStorytellingSoundUploadBean fields:
Field Name | Type | Description |
---|---|---|
id |
String |
Voice ID |
httpMethod |
String |
Pre-signed URL request method (GET: read auth; PUT: upload auth) |
uploadSignUrl |
String |
Pre-signed upload file URL |
{
"id": "voice123",
"httpMethod": "PUT",
"uploadSignUrl": "https://example.com/upload/voice123"
}
Usage Example:
CopilotSdk.getBabyCareApi().getVoiceUploadPath(
name = "Gentle Voice",
object : IAIResultCallBack<AiBabyStorytellingSoundUploadBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: AiBabyStorytellingSoundUploadBean?) {
// Handle success, voice upload path received
result?.let { uploadInfo ->
val uploadUrl = uploadInfo.uploadSignUrl
val httpMethod = uploadInfo.httpMethod
}
}
}
)
2.12.22 Complete Voice Upload
Method Name:
fun updateFinishUploadVoice(id: String, callback: IAIResultCallBack<String>)
Parameters:
id
: Audio IDcallback
: Result listener that returns the completion result
Return Result:
- Returns
String
throughcallback
indicating the result of the upload completion operation
Usage Example:
CopilotSdk.getBabyCareApi().updateFinishUploadVoice(
id = "voice123",
object : IAIResultCallBack<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
}
}
)
2.13 Home Security
2.13.1 Get Bound Device List
Method Name:
fun getBoundDeviceList(
requestBody: AiHomSecurityListRequest,
listener: Business.ResultListener<ArrayList<String>>
)
Parameters:
requestBody
: Request body containing parameters needed for getting bound device listcopilotId
: Copilot ID (optional)copilotVersion
: Copilot version (optional)copilotSrc
: Copilot source (optional)homeId
: Home ID (optional)
listener
: Result listener that returns list of bound device IDs
Return Result:
- Returns
ArrayList<String>
throughlistener
, containing list of bound device IDs
[
"device123",
"device456",
"device789"
]
Usage Example:
val request = AiHomSecurityListRequest().apply {
copilotId = "your_copilot_id"
copilotVersion = "1.0"
copilotSrc = "source"
homeId = "your_home_id"
}
CopilotSdk.getHomeSecurityApi().getBoundDeviceList(
requestBody = request,
listener = object : Business.ResultListener<ArrayList<String>> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: ArrayList<String>?) {
// Handle success, bound device ID list received
}
}
)
2.13.2 Create Security Task
Method Name:
fun createSecurityTask(
requestBody: SecurityTaskBean,
listener: Business.ResultListener<String>
)
Parameters:
requestBody
: Request body containing parameters needed for creating security taskid
: Task ID (optional)imgFileId
: Image file ID (optional)imgUrl
: Image URL (optional)maskedImgFileId
: Masked image file ID (optional)maskedImgUrl
: Masked image URL (optional)homeId
: Home ID (optional)copilotId
: Copilot ID (optional)copilotVersion
: Copilot version (optional)copilotSrc
: Copilot source (optional)deviceId
: Device ID (optional)deviceName
: Device name (optional)status
: Task status (optional)createTime
: Creation time (timestamp in milliseconds)masks
: Mask list (optional, typeList<MaskBean>
)detTargets
: Detection target list (optional)schedule
: Task scheduling information (optional, typeSecurityScheduleBean
)imgWidth
: Image width (optional)imgHeight
: Image height (optional)shouldRun
: Whether should run (optional)
MaskBean fields:
Field Name | Type | Description |
---|---|---|
left |
int |
Left boundary of mask area |
top |
int |
Top boundary of mask area |
right |
int |
Right boundary of mask area |
bottom |
int |
Bottom boundary of mask area |
SecurityScheduleBean fields:
Field Name | Type | Description |
---|---|---|
enable |
Boolean |
Whether scheduling is enabled |
week |
List<String> |
Days of week (e.g., "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") |
period |
SecurityPeriodBean? |
Schedule period information (optional) |
SecurityPeriodBean fields:
Field Name | Type | Description |
---|---|---|
allTime |
Boolean? |
Whether to monitor all day |
startTime |
String? |
Format: "hour:minute" in 24-hour format. e.g., "14:03" |
endTime |
String? |
Format: "hour:minute" in 24-hour format. e.g., "14:03" |
timezone |
String? |
e.g., Asia/Shanghai |
Return Result:
- Returns
String
throughlistener
indicating the result of creation operation (Task ID)
Usage Example:
val request = SecurityTaskBean().apply {
// Initialize request parameters
homeId = "your_home_id"
deviceId = "your_device_id"
schedule = SecurityScheduleBean().apply {
enable = true
week = listOf("MON", "WED", "FRI")
period = SecurityPeriodBean().apply {
allTime = false
startTime = ""
endTime = ""
timezone = "Asia/Shanghai"
}
}
// Other parameters...
}
CopilotSdk.getHomeSecurityApi().createSecurityTask(
requestBody = request,
listener = object : Business.ResultListener<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
result?.let { response ->
// Creation successful, update UI accordingly
}
}
}
)
2.13.3 Get Security Task List
Method Name:
fun getSecurityTaskList(
requestBody: AiHomSecurityListRequest,
listener: Business.ResultListener<SecurityTaskListBean>
)
Parameters:
requestBody
: Request body containing parameters needed for getting security task listcopilotId
: Copilot ID (optional)copilotVersion
: Copilot version (optional)copilotSrc
: Copilot source (optional)homeId
: Home ID (optional)
listener
: Result listener that returns security task list data
Return Result:
- Returns
SecurityTaskListBean
object throughlistener
containing detailed task information
SecurityTaskListBean fields:
| Field Name | Type | Description |
|-------------------|-----------|------------------------------------------------------|
| total
| Long
| Total number of security tasks |
| historyTotal
| Long
| Total number of historical security tasks |
| items
| ArrayList<SecurityTaskBean>?
| List of security tasks with detailed information |
SecurityTaskBean fields:
| Field Name | Type | Description |
|-------------------|-----------|------------------------------------------------------|
| id
| String?
| Task ID |
| imgFileId
| String?
| Image file ID |
| imgUrl
| String?
| Image URL |
| maskedImgFileId
| String?
| Masked image file ID |
| maskedImgUrl
| String?
| Masked image URL |
| homeId
| String?
| Home ID |
| copilotId
| String?
| Copilot ID |
| copilotVersion
| String?
| Copilot version |
| copilotSrc
| String?
| Copilot source |
| deviceId
| String?
| Device ID |
| deviceName
| String?
| Device name |
| status
| String?
| Task status |
| createTime
| Long
| Creation time (timestamp) |
| masks
| List<MaskBean>?
| Mask list (optional) |
| detTargets
| List<String>?
| Detection target list (optional) |
| schedule
| SecurityScheduleBean?
| Task scheduling information (optional) |
| imgWidth
| Int?
| Image width (optional) |
| imgHeight
| Int?
| Image height (optional) |
| shouldRun
| Boolean?
| Whether should run (optional) |
SecurityScheduleBean fields:
Field Name | Type | Description |
---|---|---|
enable |
Boolean |
Whether scheduling is enabled |
week |
List<String> |
Days of week (e.g., "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") |
period |
SecurityPeriodBean? |
Schedule period information (optional) |
SecurityPeriodBean fields:
Field Name | Type | Description |
---|---|---|
allTime |
Boolean? |
Whether to monitor all day |
startTime |
String? |
Format: "hour:minute" in 24-hour format. e.g., "14:03" |
endTime |
String? |
Format: "hour:minute" in 24-hour format. e.g., "14:03" |
timezone |
String? |
e.g., Asia/Shanghai |
Usage Example:
val request = AiHomSecurityListRequest().apply {
homeId = "your_home_id"
// Other parameters...
}
CopilotSdk.getHomeSecurityApi().getSecurityTaskList(
requestBody = request,
listener = object : Business.ResultListener<SecurityTaskListBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: SecurityTaskListBean?) {
// Handle success, security task list data received
result?.let { taskList ->
val totalTasks = taskList.total
val historyTotalTasks = taskList.historyTotal
taskList.items?.forEach { task ->
val id = task.id
val status = task.status
// Update UI with task information
}
}
}
}
)
2.13.4 Delete Security Task
Method Name:
fun deleteSecurityTask(id: String, listener: Business.ResultListener<String>)
Parameters:
id
: Security task IDlistener
: Result listener that returns the deletion result
Return Result:
- Returns
String
throughlistener
indicating the result of deletion operation
Usage Example:
CopilotSdk.getHomeSecurityApi().deleteSecurityTask(
id = "task123",
listener = object : Business.ResultListener<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success
result?.let { response ->
// Deletion successful, update UI accordingly
}
}
}
)
2.13.5 Update Task Enable Status
Method Name:
fun updateSecurityTaskEnableStatus(
id: String,
enable: Boolean,
listener: Business.ResultListener<SecurityTaskBean>
)
Parameters:
id
: Security task IDenable
: Enable status (true
for enabled,false
for disabled)listener
: Result listener that returns the update result
Return Result:
- Returns
SecurityTaskBean
object throughlistener
as described in section 2.13.3
Usage Example:
CopilotSdk.getHomeSecurityApi().updateSecurityTaskEnableStatus(
id = "task123",
enable = true,
listener = object : Business.ResultListener<SecurityTaskBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: SecurityTaskBean?) {
// Handle success, updated security task information received
result?.let { task ->
// Update UI with task status
}
}
}
)
2.13.6 Update Task Schedule
Method Name:
fun updateSecurityTaskSchedule(
id: String,
schedule: SecurityScheduleBean,
listener: Business.ResultListener<SecurityTaskBean>
)
Parameters:
id
: Security task IDschedule
: Schedule information, typeSecurityScheduleBean
with fields as described in section 2.13.3listener
: Result listener that returns the update result
Return Result:
- Returns
SecurityTaskBean
object throughlistener
containing updated security task information
{
"id": "task123",
"schedule": {
"enable": true,
"week": ["MON", "WED", "FRI"],
"period": {
"allTime": false,
"startTime": "08:00",
"endTime": "18:00",
"timezone": "Asia/Shanghai"
}
}
}
Usage Example:
val newSchedule = SecurityScheduleBean().apply {
enable = true
week = listOf("MON", "WED", "FRI")
period = SecurityPeriodBean().apply {
allTime = false
startTime = "08:00"
endTime = "18:00"
timezone = "Asia/Shanghai"
}
}
CopilotSdk.getHomeSecurityApi().updateSecurityTaskSchedule(
id = "task123",
schedule = newSchedule,
listener = object : Business.ResultListener<SecurityTaskBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: SecurityTaskBean?) {
// Handle success, updated security task information received
}
}
)
2.13.7 Get Daily Security Record Detail List
Method Name:
fun getDailySecurityRecordDetailList(
copilotId: String,
copilotVersion: String,
copilotSrc: String,
date: String,
homeId: String,
listener: Business.ResultListener<HomeSecurityGuardingRecordDetailBean>
)
Parameters:
copilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot sourcedate
: Query date (format: "YYYY-MM-DD")homeId
: Home IDlistener
: Result listener that returns alarm event detail list
Return Result:
- Returns
HomeSecurityGuardingRecordDetailBean
object throughlistener
containing detailed alarm event information
HomeSecurityGuardingRecordDetailBean fields:
| Field Name | Type | Description |
|-------------------|-----------|------------------------------------------------------|
| items
| ArrayList<HomeSecurityGuardingRecordDetailItemBean>
| Detailed list of alarm events |
| total
| int
| Total number of event records |
| timezone
| String
| Timezone information |
HomeSecurityGuardingRecordDetailItemBean fields:
| Field Name | Type | Description |
|-------------------|-----------|------------------------------------------------------|
| createTime
| long
| Event timestamp |
| desc
| String
| Event description |
| deviceId
| String
| Device ID |
| deviceName
| String
| Device name |
| homeId
| String
| Home ID |
| imgFileId
| String
| Image file ID |
| imgUrl
| String
| Image URL |
| title
| String
| Event title |
Usage Example:
CopilotSdk.getHomeSecurityApi().getDailySecurityRecordDetailList(
copilotId = "your_copilot_id",
copilotVersion = "1.0",
copilotSrc = "source",
date = "2023-01-01",
homeId = "your_home_id",
listener = object : Business.ResultListener<HomeSecurityGuardingRecordDetailBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: HomeSecurityGuardingRecordDetailBean?) {
// Handle success, alarm event detail list received
}
}
)
2.13.8 Get Earliest Task Creation Time
Method Name:
fun getSecurityRecordEarliestTime(
copilotId: String,
copilotVersion: String,
copilotSrc: String,
homeId: String,
listener: Business.ResultListener<String>
)
Parameters:
copilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot sourcehomeId
: Home IDlistener
: Result listener that returns the earliest task creation timestamp
Return Result:
- Returns
String
throughlistener
representing the earliest task creation timestamp (in milliseconds)
Usage Example:
CopilotSdk.getHomeSecurityApi().getSecurityRecordEarliestTime(
copilotId = "your_copilot_id",
copilotVersion = "1.0",
copilotSrc = "source",
homeId = "your_home_id",
listener = object : Business.ResultListener<String> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: String?) {
// Handle success, earliest task creation timestamp received
}
}
)
2.13.9 Get Alarm Records
Method Name:
fun getSecurityRecordList(
copilotId: String,
copilotVersion: String,
copilotSrc: String,
startDate: String,
endDate: String,
homeId: String,
listener: Business.ResultListener<HomeSecurityGuardingRecordListBean>
)
Parameters:
copilotId
: Copilot IDcopilotVersion
: Copilot versioncopilotSrc
: Copilot sourcestartDate
: Start date for query (format: "YYYY-MM-DD")endDate
: End date for query (format: "YYYY-MM-DD")homeId
: Home IDlistener
: Result listener that returns alarm record list
Return Result:
- Returns
HomeSecurityGuardingRecordListBean
object throughlistener
with the following fields:
Field Name | Type | Description |
---|---|---|
items | ArrayList |
List of alarm record items |
total | int | Total number of alarm records |
HomeSecurityGuardingRecordItemBean fields:
Field Name | Type | Description |
---|---|---|
date | String | Alarm record date (format: 2024-03-14) |
count | int | Number of alarms on that date |
Usage Example:
CopilotSdk.getHomeSecurityApi().getSecurityRecordList(
copilotId = "your_copilot_id",
copilotVersion = "1.0",
copilotSrc = "source",
startDate = "2023-01-01",
endDate = "2023-01-31",
homeId = "your_home_id",
listener = object : Business.ResultListener<HomeSecurityGuardingRecordListBean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: HomeSecurityGuardingRecordListBean?) {
// Handle success, alarm records received
}
}
)
2.13.10 Search Alarm Messages
Method Name:
fun searchSecurityRecordMsgList(
searchName: String,
pageNo: Int,
pageSize: Int,
startTime: Long,
endTime: Long,
listener: Business.ResultListener<HomeSecuritySearchListBean>
)
Parameters:
searchName
: Search keywordpageNo
: Current page numberpageSize
: Number of records per pagestartTime
: Start time for search (timestamp)endTime
: End time for search (timestamp)listener
: Result listener that returns search results
Return Result:
- Returns
HomeSecuritySearchListBean
object throughlistener
containing the list of alarm messages.
HomeSecuritySearchListBean fields:
Field Name | Type | Description |
---|---|---|
data | ArrayList |
Message list |
total | int | Total number of messages |
HomeSecuritySearchItemBean fields:
Field Name | Type | Description |
---|---|---|
msgCategory | int | Message category (1: AI) |
id | String | Message ID |
msgType | int | Message type (1: copilot) |
msgSrcId | String | Message source ID/group ID |
msgTitle | String | Message title |
msgContent | String | Message content |
actionUrl | String | Action URL in message list |
attachs | ArrayList | Attachment list |
uid | String | User ID |
appId | String | Application ID |
tenantId | String | Tenant ID |
deleted | int | Status (0: normal, 1: deleted) |
gmtCreate | Long | Creation time |
gmtModified | Long | Modification time |
pushTime | Long | Message push time |
sourceType | int | Source type (0: device) |
sourceId | String | Source ID (e.g., device ID) |
sourceName | String | Source name (e.g., device name) |
{
"data": [
{
"msgCategory": 1,
"id": "msg123",
"msgType": 1,
"msgSrcId": "src123",
"msgTitle": "Alarm Notification",
"msgContent": "Abnormal activity detected",
"actionUrl": "https://example.com/action",
"attachs": [],
"uid": "user123",
"appId": "app123",
"tenantId": "tenant123",
"deleted": 0,
"gmtCreate": 1672537600000,
"gmtModified": 1672537600000,
"pushTime": 1672537600000,
"sourceType": 0,
"sourceId": "device123",
"sourceName": "Baby Monitor Camera"
}
],
"total": 1
}
2.14.1 File Upload Pre-signed URL V1
Method Name:
fun fileUploadSignV1(
fileName: String,
fileType: String,
callback: IAIResultCallBack<FileBean?>
)
Parameters:
fileName
: File name (png, mp4)fileType
: File typecallback
: Result callback that returns pre-signed upload result (FileBean?
)
Return Result:
- Returns
FileBean?
throughcallback
containing detailed pre-signed upload information.
Field Name | Type | Description |
---|---|---|
expireTime | Long | File expiration time (timestamp) |
fileId | String | File ID |
httpMethod | String | HTTP method (e.g., GET or PUT) |
uploadSignUrl | String | Pre-signed URL for file upload |
{
"expireTime": 1672537600000,
"fileId": "file123",
"httpMethod": "PUT",
"uploadSignUrl": "https://example.com/upload/file123"
}
Usage Example:
CopilotSdk.getFileApi().fileUploadSignV1(
fileName = "example.mp4",
fileType = "video/mp4",
callback = object : IAIResultCallBack<FileBean?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: FileBean?) {
// Handle success, pre-signed upload information received
}
}
)
2.14.2 File Upload Pre-signed URL V2
Method Name:
fun fileUploadSignV2(
copilotId: String,
fileType: String,
callback: IAIResultCallBack<FileBean?>
)
Parameters:
copilotId
: Copilot IDfileType
: File type (e.g., image/png)callback
: Result callback that returns pre-signed upload result (FileBean?
)
Return Result:
- Returns
FileBean?
throughcallback
containing detailed pre-signed upload information, as described in section 2.14.1
Usage Example:
CopilotSdk.getFileApi().fileUploadSignV2(
copilotId = "your_copilot_id",
fileType = "image/png",
callback = object : IAIResultCallBack<FileBean?> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: FileBean?) {
// Handle success, pre-signed upload information received
}
}
)
2.14.3 Upload File
Method Name:
fun uploadFile(
filePath: String,
fileBean: FileBean,
callback: IAIResultCallBack<Boolean>
)
Parameters:
filePath
: Path to the filefileBean
: File information, typeFileBean
as described in section 2.14.1callback
: Result callback that returns the upload operation result (Boolean
)
Return Result:
- Returns
Boolean
throughcallback
indicating whether the upload operation was successful.
Usage Example:
CopilotSdk.getFileApi().uploadFile(
filePath = "path/to/your/file.txt",
fileBean = FileBean(/* initialize file information */),
callback = object : IAIResultCallBack<Boolean> {
override fun onError(errorCode: String?, error: String?) {
// Handle error
}
override fun onSuccess(result: Boolean?) {
// Handle success, upload result received
}
}
)