Appearance
方法事件
注意
方法事件为组件方法调用后异步回调事件
用法示例
js
function onEventMethod(e : JSONObject) {
console.log("onEvent:" + e.toJSONString())
}js
//事件
onEventMethod(e) {
console.log(e.detail)
}回调示例
json
{
"type": "onClose",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onOpen",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onStopPreview",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onStartPreview",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onStartRecording",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onStopRecording",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onTakePicture",
"data": {
"message": "",
"code": 0,
"data": {
"base64": "",
"path": "/storage/emulated/0/Pictures/LevenUvcCamera/1765987541706.jpg"
}
}
}json
{
"type": "onGetDeviceList",
"data": {
"message": "",
"code": 0,
"data": {
"deviceList": [
{
"productId": 12337,
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"deviceName": "/dev/bus/usb/003/003",
"vendorId": 3034,
"deviceId": 3003
}
]
}
}
}json
{
"type": "onSwitchCamera",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onFullScreen",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onGetBrightnessPercent",
"data": {
"message": "",
"code": 0,
"data": {
"percent": 50
}
}
}json
{
"type": "onSetBrightnessPercent",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onGetContrastPercent",
"data": {
"message": "",
"code": 0,
"data": {
"percent": 50
}
}
}json
{
"type": "onSetContrastPercent",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onSetMirror",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"type": "onGetPreviewSize",
"data": {
"message": "",
"code": 0,
"data": {
"type": 7,
"fps": 30,
"height": 600,
"width": 800,
"fpsList": [
30
]
}
}
}json
{
"type": "onGetSupportedSizeList",
"data": {
"message": "",
"code": 0,
"data": {
"list": [
{
"type": 7,
"fps": 30,
"height": 720,
"width": 1280,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 120,
"width": 160,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 144,
"width": 176,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 240,
"width": 320,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 288,
"width": 352,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 480,
"width": 848,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 600,
"width": 800,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 540,
"width": 960,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 720,
"width": 1280,
"fpsList": [
30
]
},
{
"type": 7,
"fps": 30,
"height": 480,
"width": 640,
"fpsList": [
30
]
}
]
}
}
}json
{
"type": "onSetButtonCallback",
"data": {
"message": "",
"code": 0,
"data": {
"type": "onButton",
"button": 1,
"status": 1
}
}
}回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| type | String | 事件类型,请参考下方说明 |
| data | Object | 事件数据 |
| data.code | Integer | 事件结果类型,0.成功,其他:失败 |
| data.data | Integer | 事件结果数据 |
| data.message | String | 事件结果消息 |
回调事件类型说明
关闭摄像头
类型名称
onClose
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
打开摄像头
类型名称
onOpen
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
关闭预览
类型名称
onStopPreview
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
开启预览
类型名称
onStartPreview
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
开始录像
类型名称
onStartRecording
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
结束录像
类型名称
onStopRecording
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
拍照
类型名称
onTakePicture
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.path | String | 拍照保存路径 |
| data.base64 | String | 拍照的base64数据 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取摄像头列表
类型名称
onGetDeviceList
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.deviceList | Array[Object] | 摄像头数据集合 |
| data.deviceList.productId | Integer | 产品id |
| data.deviceList.productName | String | 产品名称 |
| data.deviceList.serialNumber | String | 串口号 |
| data.deviceList.deviceName | String | 设备名称 |
| data.deviceList.vendorId | Integer | 厂家id |
| data.deviceList.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
切换摄像头
类型名称
onSwitchCamera
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
全屏
类型名称
onFullScreen
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取摄像头亮度百分比
类型名称
onGetBrightnessPercent
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.percent | Integer | 亮度,范围:[0,100] |
| code | Integer | 返回类型,0.成功,其他:失败 |
设置摄像头亮度百分比
类型名称
onSetBrightnessPercent
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取摄像头的对比度百分比
类型名称
onGetContrastPercent
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.percent | Integer | 亮度,范围:[0,100] |
| code | Integer | 返回类型,0.成功,其他:失败 |
设置摄像头对比度百分比
类型名称
onSetContrastPercent
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
设置镜像
类型名称
onSetMirror
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取预览分辨率
类型名称
onGetPreviewSize
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.type | Integer | 类型 |
| data.fps | Integer | 帧率 |
| data.height | Integer | 高度 |
| data.width | Integer | 宽度 |
| data.fpsList | Array[Integer] | 帧率列表 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取支持的分辨率
类型名称
onGetSupportedSizeList
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.list | Array[Object] | 列表 |
| data.list.type | Integer | 类型 |
| data.list.fps | Integer | 帧率 |
| data.height | Integer | 高度 |
| data.list.width | Integer | 宽度 |
| data.list.fpsList | Array[Integer] | 帧率列表 |
| code | Integer | 返回类型,0.成功,其他:失败 |
监听按钮
类型名称
onSetButtonCallback
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.type | String | 类型onSetCallback:监听成功onButton:按钮被点击 |
| data.button | Integer | 按钮标识 |
| data.status | Integer | 状态 |
| code | Integer | 返回类型,0.成功,其他:失败 |
