# 设置输出IO模式 setOutPoint
设置当前终端的所有IO设备的输出IO模式
type ReqBody = {
ioMode: number,
ioPoint: number
}
type ResBody = {
resultCode: number, resultMessage: string
}
zwexplorer.Light.setOutPoint(
data: ReqBody,
callback?: (res: ResBody)=>void
): Promise<ResBody>
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
data.ioPoint | Number | 是 | 输出IO口号,从1开始 |
data.ioMode | Number | 是 | 输出IO口的模式:0-关闭 1-常亮 2-闪烁(周期为1秒)3-闪烁(周期为0.5秒)闪烁(周期为2秒) |
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | Number | 是 | 状态码,0 为正常,其它为异常 [状态码参考] |
res.data | Object | 否 | 接口返回的详细数据 |
res.resultMessage | String | 否 | 接口消息 |
zwexplorer.Light.setOutPoint({
ioPoint: 1,
ioMode: 1
},(res)=>{
// 返回数据
})
# 单次获取IO状态 getInPointSync
单次获取当前终端的所有IO设备的状态
type ResBody = {
resultCode: number, resultMessage: string
}
zwexplorer.Light.getInPointSync(
data: {},
callback?: (res: ResBody)=>void
): Promise<ResBody>
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | Number | 是 | 状态码,0 为正常,其它为异常 [状态码参考] |
res.resultMessage | String | 否 | 接口消息 |
res.data | Object | 否 | 接口返回的详细数据 |
res.data.ioPoint | Number | 是 | 返回状态的输入IO口号 |
res.data.ioState | Number | 是 | 返回该IO的状态,0或者1 |
zwexplorer.Light.getInPointSync({},(res)=>{
// 返回数据
})
# 打开IO设备 startGetInput
启用当前终端的所有IO设备
type ResBody = {
resultCode: number, resultMessage: string
}
zwexplorer.Light.startGetInput(
data: {},
callback?: (res: ResBody)=>void
): Promise<ResBody>
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | Number | 是 | 状态码,0 为正常,其它为异常 [状态码参考] |
res.data | Object | 否 | 接口返回的详细数据 |
res.resultMessage | String | 否 | 接口消息 |
zwexplorer.Light.startGetInput({},(res)=>{
// 返回数据
})
# 监听IO设备输入 onInput
监听当前终端的所有IO设备
type ResBody = {
resultCode: number, resultMessage: string, data: string
}
zwexplorer.Light.onInput(
data: {},
callback?: (res: ResBody)=>void
): Promise<ResBody>
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | Number | 是 | 状态码,0 为正常,其它为异常 [状态码参考] |
res.data | Object | 否 | 接口返回的详细数据 |
res.data.ioPoint | Number | 是 | 返回状态的输入IO口号 |
res.data.ioState | Number | 是 | 返回该IO的状态,0或者1 |
res.resultMessage | String | 否 | 接口消息 |
zwexplorer.Light.onInput(data,(res)=>{
// 返回数据
})
# 关闭IO设备 cancelGetInput
关闭当前终端的所有IO设备
type ResBody = {
resultCode: number, resultMessage: string
}
zwexplorer.Light.cancelGetInput(
data: ReqBody,
callback?: (res: ResBody)=>void
): Promise<ResBody>
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | Number | 是 | 状态码,0 为正常,其它为异常 [状态码参考] |
res.data | Object | 否 | 接口返回的详细数据 |
res.resultMessage | String | 否 | 接口消息 |
zwexplorer.Light.cancelGetInput(data,(res)=>{
// 返回数据
})
zwexplorer.Light.startGetInput(data, (res) => {
// 已打开
zwexplorer.Light.onInput({}, (res) => {
// 信息返回,正确返回或超时返回
zwexplorer.Light.cancelGetInput(data, (res) => {
// 已关闭
});
});
});