public class Infrared
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
close()
关闭红外模块
|
java.lang.String |
getIDAndPowerWithWattmeter()
获取电表ID和电能值,97标准
|
java.lang.String |
getIDAndPowerWithWattmeter(int protocol)
获取电表ID和电能值
|
static Infrared |
getInstance()
获取红外模块操作实例
|
boolean |
isPowerOn()
判断设备是否上电
|
boolean |
open()
打开红外模块,默认1200波特率
|
boolean |
open(int baudrate)
打开红外模块
|
boolean |
open(int baudrate,
int check)
打开红外模块
|
byte[] |
receive()
接收数据
|
boolean |
send(byte[] data)
发送数据
|
public boolean close()
public java.lang.String getIDAndPowerWithWattmeter()
public java.lang.String getIDAndPowerWithWattmeter(int protocol)
protocol
- 97,DL/T 645—1997标准;07,DL/T 645—2007标准public static Infrared getInstance() throws ConfigurationException
ConfigurationException
- 配置错误异常public boolean open()
public boolean open(int baudrate)
baudrate
- 波特率,如:1200、4800、2400public boolean open(int baudrate, int check)
baudrate
- 波特率,如:1200、4800、2400check
- 0,不校验;1,奇校验;2,偶校验public byte[] receive()
public boolean send(byte[] data)
data
- 数据public boolean isPowerOn()