Documentation ¶
Index ¶
- Constants
- Variables
- func BuildNestedPacket(cmd byte, body []byte) (packet []byte)
- func BuildNestedSubPacket(cmd byte, body []byte) (packet []byte)
- func BuildPacket(cmd byte, data []byte) (packet []byte)
- func Crc(payload []byte) (crc byte)
- func ReadUint16(p []byte) int
- type Channel
- type ChannelInfo
- type Client
- type Packet
- type UidResult
Constants ¶
View Source
const ( PacketHead = 0x68 PacketTail = 0x16 DefaultScThreshold = 7000 // 默认短路阈值 )
View Source
const ( CmdReqNested = 0x01 // 嵌套命令请求 CmdRespNested = 0x11 // 嵌套命令回复 CmdBusReq = 0x02 // 总线请求 CmdBusResp = 0x12 // 总线回复 NestCmdUIDReq = 0x35 // 查询UID与Passwd NestCmdUIDResp = 0xb5 // UID&Passwd回复 NestCmdWriteReq = 0x34 // 写入请求 NestSubCmdUIDReq = 0x00 // 写UID NestSubCmdPasswdReq = 0x07 // 写密码 NestSubCmdDelayReq = 0x11 // 写延时 NestSubCmdCodeReq = 0x1A // 写管壳码 )
View Source
const (
ChannelSize = 4 * 8
)
Variables ¶
Functions ¶
func BuildNestedPacket ¶ added in v0.0.2
func BuildNestedSubPacket ¶ added in v0.0.2
func BuildPacket ¶ added in v0.0.2
func ReadUint16 ¶ added in v0.0.2
Types ¶
type ChannelInfo ¶ added in v0.0.2
type Client ¶
type Client interface { OpenAll() (ci ChannelInfo, err error) // 打开所有通道 err: ErrShortCircuit CloseAll() (err error) // 关闭所有通道 GetInfo() (uid []byte, password []byte, err error) // 读uid err: ErrBrokenCircuit ChannelState(ch *Channel) (ci ChannelInfo, err error) // 读总线状态 WriteUID(uid []byte) (err error) // 写UID WritePsw(password []byte) (err error) // 写密码 WriteDelayTime(delay []byte) (err error) // 写延时 WriteCode(code []byte) (err error) // 写管壳码: code需要压缩一个字节 }
Click to show internal directories.
Click to hide internal directories.