📌 海康威视 SADP SDK_IOS - Super-Module-HKWS
SunSeekerX ... 2022-11-28 大约 4 分钟
# 📌 海康威视 SADP SDK_IOS - Super-Module-HKWS
# ⚠️ 警告
插件市场的文档解析有问题!方法名解析有丢失,例如 on start 放在一起就不见了
查看在线文档:https://doc.yoouu.cn/front-end/uni-app/nativeplugins/super-module-hkws-sadp (opens new window)
# 简介
Github: ~
更多插件:https://doc.yoouu.cn/front-end/uni-app/nativeplugins/ (opens new window)
海康威视 SADP SDK_IOS。
基于私有搜索在线设备协议开发的 SDK,动态库形式提供,适用于"硬件与客户端处于同一个子网"的网络环境,主要功能包括搜索在线设备、激活设备、修改设备网络参数、重置设备密码等。
# 平台兼容性
Android | iOS |
---|---|
~ | >=11.0 |
# 使用示例
# @/utils/index.js
工具方法
// Toast 提示
export function toast(title, val) {
try {
if (typeof val === 'object') {
val = JSON.stringify(val)
} else {
val = String(val)
}
} catch (e) {
val = e.message
} finally {
uni.showToast({
icon: 'none',
title: `${title}: ${val}`,
duration: 3000,
})
}
}
// 安全运行
export function safeRunning(name, fun) {
try {
fun()
} catch (e) {
toast(name, e.message)
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 测试 uni-app .vue 文件
<template>
<view class="content">
<!-- 海康威视 -->
<view class="gap"><text>📌 海康威视 - SADP</text></view>
<button type="primary" @click="onStart">开始搜索设备: onStart</button>
<button type="primary" @click="onSetFindDeviceCallback"
>设置设备回调监听: onSetFindDeviceCallback</button
>
<button type="primary" @click="onRefresh">刷新: onRefresh</button>
<view class="wd-py-10">
<text>iDS-2CD6810F/C20171215AAWR156541444</text>
</view>
<view class="input">
<input v-model="sDevSerialNO" type="text" placeholder="请输入 sDevSerialNO" />
</view>
<view class="wd-py-10">
<text>hik12345</text>
</view>
<view class="input">
<input v-model="sCommand" type="text" placeholder="请输入 sCommand" />
</view>
<button type="primary" @click="onActivate">激活: onActivate</button>
<button type="primary" @click="onSadpStop">停止: onSadpStop</button>
</view>
</template>
<script>
import { toast, safeRunning } from '@/utils'
// #ifdef APP-PLUS
const superModuleHkwsSadp = uni.requireNativePlugin('super-module-hkws-sadp')
// #endif
export default {
name: 'SuperModulesIosHKWS',
data() {
return {
sDevSerialNO: null,
sCommand: null,
}
},
methods: {
// 寻找到设备设备信息回调
onFindDeviceCallback(res) {
toast('onFindDeviceCallback', res)
},
// 开始搜索设备
onStart() {
safeRunning('onStart', () => {
superModuleHkwsSadp.onStart((result) => {
toast('onStart', result)
})
})
},
// 设置设备回调监听
onSetFindDeviceCallback() {
safeRunning('onSetFindDeviceCallback', () => {
const result = superModuleHkwsSadp.onSetFindDeviceCallback(this.onFindDeviceCallback)
toast('onSetFindDeviceCallback', result)
})
},
// 刷新
onRefresh() {
safeRunning('onRefresh', () => {
superModuleHkwsSadp.onRefresh((result) => {
toast('onRefresh', result)
})
})
},
// 激活
onActivate() {
safeRunning('onActivate', () => {
if (!this.sDevSerialNO) {
return toast('onActivate', '请输入 sDevSerialNO')
}
if (!this.sCommand) {
return toast('onActivate', '请输入 sCommand')
}
superModuleHkwsSadp.onActivate(
{
sDevSerialNO: this.sDevSerialNO,
sCommand: this.sCommand,
},
(result) => {
toast('onActivate', result)
}
)
})
},
// 停止
onSadpStop() {
safeRunning('onSadpStop', () => {
superModuleHkwsSadp.onSadpStop((result) => {
toast('onSadpStop', result)
})
})
},
},
}
</script>
<style lang="scss" scoped>
.content {
padding: 12px 24rpx;
button {
margin-top: 6px;
font-size: 16px;
}
.gap {
margin-top: 18px;
text {
font-size: 18px;
}
&:first-child {
margin-top: 0;
}
}
.input {
// margin-top: 12px;
padding: 12rpx 24rpx;
border: 1px solid #eee;
color: #333;
&:first-child {
margin-top: 0;
}
}
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 模块方法
# onSetFindDeviceCallback(callback): result
设置设备回调监听
callback
<Function> 结果回调函数result
<Object> 执行返回信息success
<Boolean> 操作是否成功code
<Number> 状态码200
设置设备监听成功400
请传入监听函数
msg
<String> 请求信息
# onStart(callback):void
开始搜索设备
callback
<Function> 结果回调函数
回调结果
success
<Boolean> 操作是否成功code
<Number> 状态码200
SADP_Start_V40 success400
错误信息
msg
<String> 请求信息
# onRefresh:void
刷新
callback
<Function> 结果回调函数
回调结果
success
<Boolean> 操作是否成功code
<Number> 状态码200
SADP_SendInquiry success400
错误信息
msg
<String> 请求信息
# onActivate:void
激活
callback
<Function> 结果回调函数
回调结果
success
<Boolean> 操作是否成功code
<Number> 状态码200
SADP_SendInquiry success400
错误信息421
请传入 sDevSerialNO422
请传入 sCommand
msg
<String> 请求信息
# onSadpStop:void
停止
callback
<Function> 结果回调函数
回调结果
success
<Boolean> 操作是否成功code
<Number> 状态码200
SADP_Stop success400
错误信息
msg
<String> 请求信息
# 全局事件
# 权限列表
ios
无
Android
1
1
# 演示截图
Ios
开始搜索设备 | 开始搜索设备 | 刷新 | 停止 |
---|---|---|---|
Android
# 更新日志
# 1.0.0
功能(Features)
- SADP SDK_IOS V4.2.8.10_build20220517
Bug 修复 (Bug Fixes)
技术预研(Research)
# 问题反馈
虽然插件已经经过开发者测试和使用,但不排除某些场景下产生问题的可能性,如遇到 Bug
可以
- 在评论区留言,收到通知邮件我会第一次时间查看
- 或添加
微信: sunseekerx
进行反馈 - 或添加
QQ: 1647800606
进行反馈
# 更多插件
如有插件定制需求,也可以联系我哦。