KY_startDownload
功能描述:開始文件下載。使用 KY_registerSDKListener 獲取下載進(jìn)度。需要在 KY_Connect 連線成功之后進(jìn)行調(diào)用。
接口定義
public abstract void KY_startDownload(KYCamera.KYTransferType type, String filePath, int channel);
注:根據(jù)函數(shù)名 `KY_startDownload` 推測(cè),此接口用于開始下載。原始文檔中提供的接口定義函數(shù)名為 `KY_startUpload`,這似乎是一個(gè)文檔錯(cuò)誤,已根據(jù)函數(shù)名進(jìn)行修正。參數(shù)說(shuō)明
| 參數(shù) | 類型 | 說(shuō)明 |
|---|---|---|
| type | KYCamera.KYTransferType | 傳輸方式(枚舉類型) |
| filePath | String | 文件完整沙盒路徑(下載后保存的位置) |
| channel | int | 進(jìn)行下載的通道,默認(rèn)0 |
回調(diào)說(shuō)明
暫無(wú)
返回碼
暫無(wú)
代碼示例
暫無(wú)
KY_stopDownload
功能描述:停止文件下載。
接口定義
public abstract void KY_stopDownload(KYCamera.KYTransferType type, int channel);
注:此接口定義是根據(jù) `KY_startDownload` 和 `KY_stopUpload` 的命名習(xí)慣推測(cè)的,原始文檔中未提供。參數(shù)說(shuō)明
| 參數(shù) | 類型 | 說(shuō)明 |
|---|---|---|
| type | KYCamera.KYTransferType | 傳輸方式(需與開始下載時(shí)一致) |
| channel | int | 進(jìn)行下載的通道,默認(rèn)0 |
回調(diào)說(shuō)明
暫無(wú)
返回碼
暫無(wú)
代碼示例
暫無(wú)
KY_startUpload
功能描述:開始文件上傳。使用 KY_registerSDKListener 獲取上傳進(jìn)度。需要在 KY_Connect 連線成功之后進(jìn)行調(diào)用。
接口定義
public abstract void KY_startUpload(KYCamera.KYTransferType type, String filePath, int channel);
參數(shù)說(shuō)明
| 參數(shù) | 類型 | 說(shuō)明 |
|---|---|---|
| type | KYCamera.KYTransferType | 傳輸方式(枚舉類型) |
| filePath | String | 待上傳文件的完整路徑 |
| channel | int | 進(jìn)行上傳的通道,默認(rèn)0 |
回調(diào)說(shuō)明
暫無(wú)
返回碼
暫無(wú)
代碼示例
//文件上傳
public void upload() {
//這里以上傳沙盒文件test.mp4為例
File file = new File("/sdcard/Android/data/com.tutk.kalay1/test.mp4");
List fileNameList = new ArrayList<>();
fileNameList.add(file.getName());
//發(fā)送command,告知設(shè)備,app需要上傳文件。 0x9027是psc定義的下載指令,上層可自定義
CommandUploadFile command = new CommandUploadFile();
byte[] bytes = command.request(AVIOCTRLDEFs.TKTransferType_AVAPI, fileNameList);
int type = command.getRequestType();//0x9027
mKYCamera.KY_SendIOCtrlToChannel(KYCamera.DEFAULT_AV_CHANNEL, type, bytes);
//在收到設(shè)備回復(fù)后,即可使用KY_startUpload開始上傳。請(qǐng)注意,設(shè)備需要提前對(duì)接好上傳功能
}
//......省略代碼
public void KY_DidReceiveIOCtrlWithUid(String uid, int avChannel, int type, byte[] data, int dataSize) {
if (type == AVIOCTRLDEFs.IOTYPE_USER_IPCAM_UPLOAD_FILE_RESP) {
//收到設(shè)備回復(fù)的上傳指令,開始上傳
CommandUploadFile command = new CommandUploadFile();
command.response(data);
//目前是測(cè)試單個(gè)上傳,所以command.list 只有一個(gè)
if (command.list.isEmpty()) {
return;
}
int uploadAvChannel = command.list.get(0);
String filePath = "/sdcard/Android/data/com.tutk.kalay1/test.mp4";
mKYCamera.KY_startUpload(KYCamera.KYTransferType.AVAPI, filePath, uploadAvChannel);
}
}
KY_stopUpload
功能描述:停止文件上傳。
接口定義
public abstract void KY_stopUpload(KYCamera.KYTransferType type, int channel);
參數(shù)說(shuō)明
| 參數(shù) | 類型 | 說(shuō)明 |
|---|---|---|
| type | KYCamera.KYTransferType | 傳輸方式 |
| channel | int | 進(jìn)行上傳的通道,默認(rèn)0 |
回調(diào)說(shuō)明
暫無(wú)
返回碼
暫無(wú)
代碼示例
暫無(wú)
