# 设置输出IO模式 setOutPoint

● 接口函数

zwexplorer.Light.setOutPoint

● 接口说明

设置当前终端的所有IO设备的输出IO模式

● Typescript 类型参考


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

● 接口函数

zwexplorer.Light.getInPointSync

● 接口说明

单次获取当前终端的所有IO设备的状态

● Typescript 类型参考


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

● 接口函数

zwexplorer.Light.startGetInput

● 接口说明

启用当前终端的所有IO设备

● Typescript 类型参考


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

● 接口函数

zwexplorer.Light.onInput

● 接口说明

监听当前终端的所有IO设备

● Typescript 类型参考


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

● 接口函数

zwexplorer.Light.cancelGetInput

● 接口说明

关闭当前终端的所有IO设备

● Typescript 类型参考


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)=>{
  // 返回数据
})

● 监听灯控IO设备接口的示例

zwexplorer.Light.startGetInput(data, (res) => {
    // 已打开
    zwexplorer.Light.onInput({}, (res) => {
        // 信息返回,正确返回或超时返回
        zwexplorer.Light.cancelGetInput(data, (res) => {
            // 已关闭
        });
    });
});