| 1 |
package cmd |
| 2 |
|
| 3 |
import ( |
| 4 |
"bytes" |
| 5 |
"errors" |
| 6 |
"fmt" |
| 7 |
"io" |
| 8 |
"log" |
| 9 |
|
| 10 |
"github.com/bettercap/gatt/linux/evt" |
| 11 |
"github.com/bettercap/gatt/linux/util" |
| 12 |
) |
| 13 |
|
| 14 |
type CmdParam interface { |
| 15 |
Marshal([]byte) |
| 16 |
Opcode() int |
| 17 |
Len() int |
| 18 |
} |
| 19 |
|
| 20 |
func NewCmd(d io.Writer) *Cmd { |
| 21 |
c := &Cmd{ |
| 22 |
dev: d, |
| 23 |
sent: []*cmdPkt{}, |
| 24 |
compc: make(chan evt.CommandCompleteEP), |
| 25 |
statusc: make(chan evt.CommandStatusEP), |
| 26 |
} |
| 27 |
go c.processCmdEvents() |
| 28 |
return c |
| 29 |
} |
| 30 |
|
| 31 |
type cmdPkt struct { |
| 32 |
op int |
| 33 |
cp CmdParam |
| 34 |
done chan []byte |
| 35 |
} |
| 36 |
|
| 37 |
func (c cmdPkt) Marshal() []byte { |
| 38 |
b := make([]byte, 1+2+1+c.cp.Len()) |
| 39 |
b[0] = byte(0x1) |
| 40 |
b[1] = byte(c.op) |
| 41 |
b[2] = byte(c.op >> 8) |
| 42 |
b[3] = byte(c.cp.Len()) |
| 43 |
c.cp.Marshal(b[4:]) |
| 44 |
return b |
| 45 |
} |
| 46 |
|
| 47 |
type Cmd struct { |
| 48 |
dev io.Writer |
| 49 |
sent []*cmdPkt |
| 50 |
compc chan evt.CommandCompleteEP |
| 51 |
statusc chan evt.CommandStatusEP |
| 52 |
} |
| 53 |
|
| 54 |
func (c Cmd) trace(fmt string, v ...interface{}) {} |
| 55 |
|
| 56 |
func (c *Cmd) HandleComplete(b []byte) error { |
| 57 |
var e evt.CommandCompleteEP |
| 58 |
if err := e.Unmarshal(b); err != nil { |
| 59 |
return err |
| 60 |
} |
| 61 |
c.compc <- e |
| 62 |
return nil |
| 63 |
} |
| 64 |
|
| 65 |
func (c *Cmd) HandleStatus(b []byte) error { |
| 66 |
var e evt.CommandStatusEP |
| 67 |
if err := e.Unmarshal(b); err != nil { |
| 68 |
return err |
| 69 |
} |
| 70 |
c.statusc <- e |
| 71 |
return nil |
| 72 |
} |
| 73 |
|
| 74 |
func (c *Cmd) Send(cp CmdParam) ([]byte, error) { |
| 75 |
op := cp.Opcode() |
| 76 |
p := &cmdPkt{op: op, cp: cp, done: make(chan []byte)} |
| 77 |
raw := p.Marshal() |
| 78 |
|
| 79 |
c.sent = append(c.sent, p) |
| 80 |
if n, err := c.dev.Write(raw); err != nil { |
| 81 |
return nil, err |
| 82 |
} else if n != len(raw) { |
| 83 |
return nil, errors.New("Failed to send whole Cmd pkt to HCI socket") |
| 84 |
} |
| 85 |
return <-p.done, nil |
| 86 |
} |
| 87 |
|
| 88 |
func (c *Cmd) SendAndCheckResp(cp CmdParam, exp []byte) error { |
| 89 |
rsp, err := c.Send(cp) |
| 90 |
if err != nil { |
| 91 |
return err |
| 92 |
} |
| 93 |
|
| 94 |
if len(exp) == 0 { |
| 95 |
return nil |
| 96 |
} |
| 97 |
|
| 98 |
if !bytes.Contains(exp, rsp[0:1]) { |
| 99 |
return fmt.Errorf("HCI command: '0x%04x' return 0x%02X, expect: [%X] ", cp.Opcode(), rsp[0], exp) |
| 100 |
} |
| 101 |
return nil |
| 102 |
} |
| 103 |
|
| 104 |
func (c *Cmd) processCmdEvents() { |
| 105 |
for { |
| 106 |
select { |
| 107 |
case status := <-c.statusc: |
| 108 |
found := false |
| 109 |
for i, p := range c.sent { |
| 110 |
if uint16(p.op) == status.CommandOpcode { |
| 111 |
found = true |
| 112 |
c.sent = append(c.sent[:i], c.sent[i+1:]...) |
| 113 |
close(p.done) |
| 114 |
break |
| 115 |
} |
| 116 |
} |
| 117 |
if !found { |
| 118 |
log.Printf("Can't find the cmdPkt for this CommandStatusEP: %v", status) |
| 119 |
} |
| 120 |
case comp := <-c.compc: |
| 121 |
found := false |
| 122 |
for i, p := range c.sent { |
| 123 |
if uint16(p.op) == comp.CommandOPCode { |
| 124 |
found = true |
| 125 |
c.sent = append(c.sent[:i], c.sent[i+1:]...) |
| 126 |
p.done <- comp.ReturnParameters |
| 127 |
break |
| 128 |
} |
| 129 |
} |
| 130 |
if !found { |
| 131 |
log.Printf("Can't find the cmdPkt for this CommandCompleteEP: %v", comp) |
| 132 |
} |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
const ( |
| 138 |
linkCtl = 0x01 |
| 139 |
linkPolicy = 0x02 |
| 140 |
hostCtl = 0x03 |
| 141 |
infoParam = 0x04 |
| 142 |
statusParam = 0x05 |
| 143 |
testingCmd = 0X3E |
| 144 |
leCtl = 0x08 |
| 145 |
vendorCmd = 0X3F |
| 146 |
) |
| 147 |
|
| 148 |
const ( |
| 149 |
opInquiry = linkCtl<<10 | 0x0001 |
| 150 |
opInquiryCancel = linkCtl<<10 | 0x0002 |
| 151 |
opPeriodicInquiry = linkCtl<<10 | 0x0003 |
| 152 |
opExitPeriodicInquiry = linkCtl<<10 | 0x0004 |
| 153 |
opCreateConn = linkCtl<<10 | 0x0005 |
| 154 |
opDisconnect = linkCtl<<10 | 0x0006 |
| 155 |
opCreateConnCancel = linkCtl<<10 | 0x0008 |
| 156 |
opAcceptConnReq = linkCtl<<10 | 0x0009 |
| 157 |
opRejectConnReq = linkCtl<<10 | 0x000A |
| 158 |
opLinkKeyReply = linkCtl<<10 | 0x000B |
| 159 |
opLinkKeyNegReply = linkCtl<<10 | 0x000C |
| 160 |
opPinCodeReply = linkCtl<<10 | 0x000D |
| 161 |
opPinCodeNegReply = linkCtl<<10 | 0x000E |
| 162 |
opSetConnPtype = linkCtl<<10 | 0x000F |
| 163 |
opAuthRequested = linkCtl<<10 | 0x0011 |
| 164 |
opSetConnEncrypt = linkCtl<<10 | 0x0013 |
| 165 |
opChangeConnLinkKey = linkCtl<<10 | 0x0015 |
| 166 |
opMasterLinkKey = linkCtl<<10 | 0x0017 |
| 167 |
opRemoteNameReq = linkCtl<<10 | 0x0019 |
| 168 |
opRemoteNameReqCancel = linkCtl<<10 | 0x001A |
| 169 |
opReadRemoteFeatures = linkCtl<<10 | 0x001B |
| 170 |
opReadRemoteExtFeatures = linkCtl<<10 | 0x001C |
| 171 |
opReadRemoteVersion = linkCtl<<10 | 0x001D |
| 172 |
opReadClockOffset = linkCtl<<10 | 0x001F |
| 173 |
opReadLMPHandle = linkCtl<<10 | 0x0020 |
| 174 |
opSetupSyncConn = linkCtl<<10 | 0x0028 |
| 175 |
opAcceptSyncConnReq = linkCtl<<10 | 0x0029 |
| 176 |
opRejectSyncConnReq = linkCtl<<10 | 0x002A |
| 177 |
opIOCapabilityReply = linkCtl<<10 | 0x002B |
| 178 |
opUserConfirmReply = linkCtl<<10 | 0x002C |
| 179 |
opUserConfirmNegReply = linkCtl<<10 | 0x002D |
| 180 |
opUserPasskeyReply = linkCtl<<10 | 0x002E |
| 181 |
opUserPasskeyNegReply = linkCtl<<10 | 0x002F |
| 182 |
opRemoteOOBDataReply = linkCtl<<10 | 0x0030 |
| 183 |
opRemoteOOBDataNegReply = linkCtl<<10 | 0x0033 |
| 184 |
opIOCapabilityNegReply = linkCtl<<10 | 0x0034 |
| 185 |
opCreatePhysicalLink = linkCtl<<10 | 0x0035 |
| 186 |
opAcceptPhysicalLink = linkCtl<<10 | 0x0036 |
| 187 |
opDisconnectPhysicalLink = linkCtl<<10 | 0x0037 |
| 188 |
opCreateLogicalLink = linkCtl<<10 | 0x0038 |
| 189 |
opAcceptLogicalLink = linkCtl<<10 | 0x0039 |
| 190 |
opDisconnectLogicalLink = linkCtl<<10 | 0x003A |
| 191 |
opLogicalLinkCancel = linkCtl<<10 | 0x003B |
| 192 |
opFlowSpecModify = linkCtl<<10 | 0x003C |
| 193 |
) |
| 194 |
|
| 195 |
const ( |
| 196 |
opHoldMode = linkPolicy<<10 | 0x0001 |
| 197 |
opSniffMode = linkPolicy<<10 | 0x0003 |
| 198 |
opExitSniffMode = linkPolicy<<10 | 0x0004 |
| 199 |
opParkMode = linkPolicy<<10 | 0x0005 |
| 200 |
opExitParkMode = linkPolicy<<10 | 0x0006 |
| 201 |
opQoSSetup = linkPolicy<<10 | 0x0007 |
| 202 |
opRoleDiscovery = linkPolicy<<10 | 0x0009 |
| 203 |
opSwitchRole = linkPolicy<<10 | 0x000B |
| 204 |
opReadLinkPolicy = linkPolicy<<10 | 0x000C |
| 205 |
opWriteLinkPolicy = linkPolicy<<10 | 0x000D |
| 206 |
opReadDefaultLinkPolicy = linkPolicy<<10 | 0x000E |
| 207 |
opWriteDefaultLinkPolicy = linkPolicy<<10 | 0x000F |
| 208 |
opFlowSpecification = linkPolicy<<10 | 0x0010 |
| 209 |
opSniffSubrating = linkPolicy<<10 | 0x0011 |
| 210 |
) |
| 211 |
|
| 212 |
const ( |
| 213 |
opSetEventMask = hostCtl<<10 | 0x0001 |
| 214 |
opReset = hostCtl<<10 | 0x0003 |
| 215 |
opSetEventFlt = hostCtl<<10 | 0x0005 |
| 216 |
opFlush = hostCtl<<10 | 0x0008 |
| 217 |
opReadPinType = hostCtl<<10 | 0x0009 |
| 218 |
opWritePinType = hostCtl<<10 | 0x000A |
| 219 |
opCreateNewUnitKey = hostCtl<<10 | 0x000B |
| 220 |
opReadStoredLinkKey = hostCtl<<10 | 0x000D |
| 221 |
opWriteStoredLinkKey = hostCtl<<10 | 0x0011 |
| 222 |
opDeleteStoredLinkKey = hostCtl<<10 | 0x0012 |
| 223 |
opWriteLocalName = hostCtl<<10 | 0x0013 |
| 224 |
opReadLocalName = hostCtl<<10 | 0x0014 |
| 225 |
opReadConnAcceptTimeout = hostCtl<<10 | 0x0015 |
| 226 |
opWriteConnAcceptTimeout = hostCtl<<10 | 0x0016 |
| 227 |
opReadPageTimeout = hostCtl<<10 | 0x0017 |
| 228 |
opWritePageTimeout = hostCtl<<10 | 0x0018 |
| 229 |
opReadScanEnable = hostCtl<<10 | 0x0019 |
| 230 |
opWriteScanEnable = hostCtl<<10 | 0x001A |
| 231 |
opReadPageActivity = hostCtl<<10 | 0x001B |
| 232 |
opWritePageActivity = hostCtl<<10 | 0x001C |
| 233 |
opReadInqActivity = hostCtl<<10 | 0x001D |
| 234 |
opWriteInqActivity = hostCtl<<10 | 0x001E |
| 235 |
opReadAuthEnable = hostCtl<<10 | 0x001F |
| 236 |
opWriteAuthEnable = hostCtl<<10 | 0x0020 |
| 237 |
opReadEncryptMode = hostCtl<<10 | 0x0021 |
| 238 |
opWriteEncryptMode = hostCtl<<10 | 0x0022 |
| 239 |
opReadClassOfDev = hostCtl<<10 | 0x0023 |
| 240 |
opWriteClassOfDevice = hostCtl<<10 | 0x0024 |
| 241 |
opReadVoiceSetting = hostCtl<<10 | 0x0025 |
| 242 |
opWriteVoiceSetting = hostCtl<<10 | 0x0026 |
| 243 |
opReadAutomaticFlushTimeout = hostCtl<<10 | 0x0027 |
| 244 |
opWriteAutomaticFlushTimeout = hostCtl<<10 | 0x0028 |
| 245 |
opReadNumBroadcastRetrans = hostCtl<<10 | 0x0029 |
| 246 |
opWriteNumBroadcastRetrans = hostCtl<<10 | 0x002A |
| 247 |
opReadHoldModeActivity = hostCtl<<10 | 0x002B |
| 248 |
opWriteHoldModeActivity = hostCtl<<10 | 0x002C |
| 249 |
opReadTransmitPowerLevel = hostCtl<<10 | 0x002D |
| 250 |
opReadSyncFlowEnable = hostCtl<<10 | 0x002E |
| 251 |
opWriteSyncFlowEnable = hostCtl<<10 | 0x002F |
| 252 |
opSetControllerToHostFC = hostCtl<<10 | 0x0031 |
| 253 |
opHostBufferSize = hostCtl<<10 | 0x0033 |
| 254 |
opHostNumCompPkts = hostCtl<<10 | 0x0035 |
| 255 |
opReadLinkSupervisionTimeout = hostCtl<<10 | 0x0036 |
| 256 |
opWriteLinkSupervisionTimeout = hostCtl<<10 | 0x0037 |
| 257 |
opReadNumSupportedIAC = hostCtl<<10 | 0x0038 |
| 258 |
opReadCurrentIACLAP = hostCtl<<10 | 0x0039 |
| 259 |
opWriteCurrentIACLAP = hostCtl<<10 | 0x003A |
| 260 |
opReadPageScanPeriodMode = hostCtl<<10 | 0x003B |
| 261 |
opWritePageScanPeriodMode = hostCtl<<10 | 0x003C |
| 262 |
opReadPageScanMode = hostCtl<<10 | 0x003D |
| 263 |
opWritePageScanMode = hostCtl<<10 | 0x003E |
| 264 |
opSetAFHClassification = hostCtl<<10 | 0x003F |
| 265 |
opReadInquiryScanType = hostCtl<<10 | 0x0042 |
| 266 |
opWriteInquiryScanType = hostCtl<<10 | 0x0043 |
| 267 |
opReadInquiryMode = hostCtl<<10 | 0x0044 |
| 268 |
opWriteInquiryMode = hostCtl<<10 | 0x0045 |
| 269 |
opReadPageScanType = hostCtl<<10 | 0x0046 |
| 270 |
opWritePageScanType = hostCtl<<10 | 0x0047 |
| 271 |
opReadAFHMode = hostCtl<<10 | 0x0048 |
| 272 |
opWriteAFHMode = hostCtl<<10 | 0x0049 |
| 273 |
opReadExtInquiryResponse = hostCtl<<10 | 0x0051 |
| 274 |
opWriteExtInquiryResponse = hostCtl<<10 | 0x0052 |
| 275 |
opRefreshEncryptionKey = hostCtl<<10 | 0x0053 |
| 276 |
opReadSimplePairingMode = hostCtl<<10 | 0x0055 |
| 277 |
opWriteSimplePairingMode = hostCtl<<10 | 0x0056 |
| 278 |
opReadLocalOobData = hostCtl<<10 | 0x0057 |
| 279 |
opReadInqResponseTransmitPowerLevel = hostCtl<<10 | 0x0058 |
| 280 |
opWriteInquiryTransmitPowerLevel = hostCtl<<10 | 0x0059 |
| 281 |
opReadDefaultErrorDataReporting = hostCtl<<10 | 0x005A |
| 282 |
opWriteDefaultErrorDataReporting = hostCtl<<10 | 0x005B |
| 283 |
opEnhancedFlush = hostCtl<<10 | 0x005F |
| 284 |
opSendKeypressNotify = hostCtl<<10 | 0x0060 |
| 285 |
opReadLogicalLinkAcceptTimeout = hostCtl<<10 | 0x0061 |
| 286 |
opWriteLogicalLinkAcceptTimeout = hostCtl<<10 | 0x0062 |
| 287 |
opSetEventMaskPage2 = hostCtl<<10 | 0x0063 |
| 288 |
opReadLocationData = hostCtl<<10 | 0x0064 |
| 289 |
opWriteLocationData = hostCtl<<10 | 0x0065 |
| 290 |
opReadFlowControlMode = hostCtl<<10 | 0x0066 |
| 291 |
opWriteFlowControlMode = hostCtl<<10 | 0x0067 |
| 292 |
opReadEnhancedTransmitpowerLevel = hostCtl<<10 | 0x0068 |
| 293 |
opReadBestEffortFlushTimeout = hostCtl<<10 | 0x0069 |
| 294 |
opWriteBestEffortFlushTimeout = hostCtl<<10 | 0x006A |
| 295 |
opReadLEHostSupported = hostCtl<<10 | 0x006C |
| 296 |
opWriteLEHostSupported = hostCtl<<10 | 0x006D |
| 297 |
) |
| 298 |
const ( |
| 299 |
opReadLocalVersionInformation = infoParam<<10 | 0x0001 |
| 300 |
opReadLocalSupportedCommands = infoParam<<10 | 0x0002 |
| 301 |
opReadLocalSupportedFeatures = infoParam<<10 | 0x0003 |
| 302 |
opReadLocalExtendedFeatures = infoParam<<10 | 0x0004 |
| 303 |
opReadBufferSize = infoParam<<10 | 0x0005 |
| 304 |
opReadBDADDR = infoParam<<10 | 0x0009 |
| 305 |
opReadDataBlockSize = infoParam<<10 | 0x000A |
| 306 |
opReadLocalSupportedCodecs = infoParam<<10 | 0x000B |
| 307 |
) |
| 308 |
const ( |
| 309 |
opLESetEventMask = leCtl<<10 | 0x0001 |
| 310 |
opLEReadBufferSize = leCtl<<10 | 0x0002 |
| 311 |
opLEReadLocalSupportedFeatures = leCtl<<10 | 0x0003 |
| 312 |
opLESetRandomAddress = leCtl<<10 | 0x0005 |
| 313 |
opLESetAdvertisingParameters = leCtl<<10 | 0x0006 |
| 314 |
opLEReadAdvertisingChannelTxPower = leCtl<<10 | 0x0007 |
| 315 |
opLESetAdvertisingData = leCtl<<10 | 0x0008 |
| 316 |
opLESetScanResponseData = leCtl<<10 | 0x0009 |
| 317 |
opLESetAdvertiseEnable = leCtl<<10 | 0x000a |
| 318 |
opLESetScanParameters = leCtl<<10 | 0x000b |
| 319 |
opLESetScanEnable = leCtl<<10 | 0x000c |
| 320 |
opLECreateConn = leCtl<<10 | 0x000d |
| 321 |
opLECreateConnCancel = leCtl<<10 | 0x000e |
| 322 |
opLEReadWhiteListSize = leCtl<<10 | 0x000f |
| 323 |
opLEClearWhiteList = leCtl<<10 | 0x0010 |
| 324 |
opLEAddDeviceToWhiteList = leCtl<<10 | 0x0011 |
| 325 |
opLERemoveDeviceFromWhiteList = leCtl<<10 | 0x0012 |
| 326 |
opLEConnUpdate = leCtl<<10 | 0x0013 |
| 327 |
opLESetHostChannelClassification = leCtl<<10 | 0x0014 |
| 328 |
opLEReadChannelMap = leCtl<<10 | 0x0015 |
| 329 |
opLEReadRemoteUsedFeatures = leCtl<<10 | 0x0016 |
| 330 |
opLEEncrypt = leCtl<<10 | 0x0017 |
| 331 |
opLERand = leCtl<<10 | 0x0018 |
| 332 |
opLEStartEncryption = leCtl<<10 | 0x0019 |
| 333 |
opLELTKReply = leCtl<<10 | 0x001a |
| 334 |
opLELTKNegReply = leCtl<<10 | 0x001b |
| 335 |
opLEReadSupportedStates = leCtl<<10 | 0x001c |
| 336 |
opLEReceiverTest = leCtl<<10 | 0x001d |
| 337 |
opLETransmitterTest = leCtl<<10 | 0x001e |
| 338 |
opLETestEnd = leCtl<<10 | 0x001f |
| 339 |
opLERemoteConnectionParameterReply = leCtl<<10 | 0x0020 |
| 340 |
opLERemoteConnectionParameterNegReply = leCtl<<10 | 0x0021 |
| 341 |
) |
| 342 |
|
| 343 |
var o = util.Order |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
type Disconnect struct { |
| 349 |
ConnectionHandle uint16 |
| 350 |
Reason uint8 |
| 351 |
} |
| 352 |
|
| 353 |
func (c Disconnect) Opcode() int { return opDisconnect } |
| 354 |
func (c Disconnect) Len() int { return 3 } |
| 355 |
func (c Disconnect) Marshal(b []byte) { |
| 356 |
o.PutUint16(b[0:], c.ConnectionHandle) |
| 357 |
b[2] = c.Reason |
| 358 |
} |
| 359 |
|
| 360 |
|
| 361 |
type DisconnectRP struct{} |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
type WriteDefaultLinkPolicy struct{ DefaultLinkPolicySettings uint16 } |
| 367 |
|
| 368 |
func (c WriteDefaultLinkPolicy) Opcode() int { return opWriteDefaultLinkPolicy } |
| 369 |
func (c WriteDefaultLinkPolicy) Len() int { return 2 } |
| 370 |
func (c WriteDefaultLinkPolicy) Marshal(b []byte) { o.PutUint16(b, c.DefaultLinkPolicySettings) } |
| 371 |
|
| 372 |
type WriteDefaultLinkPolicyRP struct{ Status uint8 } |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
type SetEventMask struct{ EventMask uint64 } |
| 378 |
|
| 379 |
func (c SetEventMask) Opcode() int { return opSetEventMask } |
| 380 |
func (c SetEventMask) Len() int { return 8 } |
| 381 |
func (c SetEventMask) Marshal(b []byte) { o.PutUint64(b, c.EventMask) } |
| 382 |
|
| 383 |
type SetEventMaskRP struct{ Status uint8 } |
| 384 |
|
| 385 |
|
| 386 |
type Reset struct{} |
| 387 |
|
| 388 |
func (c Reset) Opcode() int { return opReset } |
| 389 |
func (c Reset) Len() int { return 0 } |
| 390 |
func (c Reset) Marshal(b []byte) {} |
| 391 |
|
| 392 |
type ResetRP struct{ Status uint8 } |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
type SetEventFltRP struct{ Status uint8 } |
| 409 |
|
| 410 |
|
| 411 |
type Flush struct{ ConnectionHandle uint16 } |
| 412 |
|
| 413 |
func (c Flush) Opcode() int { return opFlush } |
| 414 |
func (c Flush) Len() int { return 2 } |
| 415 |
func (c Flush) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) } |
| 416 |
|
| 417 |
type flushRP struct{ status uint8 } |
| 418 |
|
| 419 |
|
| 420 |
type WritePageTimeout struct{ PageTimeout uint16 } |
| 421 |
|
| 422 |
func (c WritePageTimeout) Opcode() int { return opWritePageTimeout } |
| 423 |
func (c WritePageTimeout) Len() int { return 2 } |
| 424 |
func (c WritePageTimeout) Marshal(b []byte) { o.PutUint16(b, c.PageTimeout) } |
| 425 |
|
| 426 |
type WritePageTimeoutRP struct{} |
| 427 |
|
| 428 |
|
| 429 |
type WriteClassOfDevice struct{ ClassOfDevice [3]byte } |
| 430 |
|
| 431 |
func (c WriteClassOfDevice) Opcode() int { return opWriteClassOfDevice } |
| 432 |
func (c WriteClassOfDevice) Len() int { return 3 } |
| 433 |
func (c WriteClassOfDevice) Marshal(b []byte) { copy(b, c.ClassOfDevice[:]) } |
| 434 |
|
| 435 |
type WriteClassOfDevRP struct{ status uint8 } |
| 436 |
|
| 437 |
|
| 438 |
type HostBufferSize struct { |
| 439 |
HostACLDataPacketLength uint16 |
| 440 |
HostSynchronousDataPacketLength uint8 |
| 441 |
HostTotalNumACLDataPackets uint16 |
| 442 |
HostTotalNumSynchronousDataPackets uint16 |
| 443 |
} |
| 444 |
|
| 445 |
func (c HostBufferSize) Opcode() int { return opHostBufferSize } |
| 446 |
func (c HostBufferSize) Len() int { return 7 } |
| 447 |
func (c HostBufferSize) Marshal(b []byte) { |
| 448 |
o.PutUint16(b[0:], c.HostACLDataPacketLength) |
| 449 |
o.PutUint8(b[2:], c.HostSynchronousDataPacketLength) |
| 450 |
o.PutUint16(b[3:], c.HostTotalNumACLDataPackets) |
| 451 |
o.PutUint16(b[5:], c.HostTotalNumSynchronousDataPackets) |
| 452 |
} |
| 453 |
|
| 454 |
type HostBufferSizeRP struct{ Status uint8 } |
| 455 |
|
| 456 |
|
| 457 |
type WriteInquiryScanType struct{ ScanType uint8 } |
| 458 |
|
| 459 |
func (c WriteInquiryScanType) Opcode() int { return opWriteInquiryScanType } |
| 460 |
func (c WriteInquiryScanType) Len() int { return 1 } |
| 461 |
func (c WriteInquiryScanType) Marshal(b []byte) { b[0] = c.ScanType } |
| 462 |
|
| 463 |
type WriteInquiryScanTypeRP struct{ Status uint8 } |
| 464 |
|
| 465 |
|
| 466 |
type WriteInquiryMode struct { |
| 467 |
InquiryMode uint8 |
| 468 |
} |
| 469 |
|
| 470 |
func (c WriteInquiryMode) Opcode() int { return opWriteInquiryMode } |
| 471 |
func (c WriteInquiryMode) Len() int { return 1 } |
| 472 |
func (c WriteInquiryMode) Marshal(b []byte) { b[0] = c.InquiryMode } |
| 473 |
|
| 474 |
type WriteInquiryModeRP struct{ Status uint8 } |
| 475 |
|
| 476 |
|
| 477 |
type WritePageScanType struct{ PageScanType uint8 } |
| 478 |
|
| 479 |
func (c WritePageScanType) Opcode() int { return opWritePageScanType } |
| 480 |
func (c WritePageScanType) Len() int { return 1 } |
| 481 |
func (c WritePageScanType) Marshal(b []byte) { b[0] = c.PageScanType } |
| 482 |
|
| 483 |
type WritePageScanTypeRP struct{ Status uint8 } |
| 484 |
|
| 485 |
|
| 486 |
type WriteSimplePairingMode struct{ SimplePairingMode uint8 } |
| 487 |
|
| 488 |
func (c WriteSimplePairingMode) Opcode() int { return opWriteSimplePairingMode } |
| 489 |
func (c WriteSimplePairingMode) Len() int { return 1 } |
| 490 |
func (c WriteSimplePairingMode) Marshal(b []byte) { b[0] = c.SimplePairingMode } |
| 491 |
|
| 492 |
type WriteSimplePairingModeRP struct{} |
| 493 |
|
| 494 |
|
| 495 |
type SetEventMaskPage2 struct{ EventMaskPage2 uint64 } |
| 496 |
|
| 497 |
func (c SetEventMaskPage2) Opcode() int { return opSetEventMaskPage2 } |
| 498 |
func (c SetEventMaskPage2) Len() int { return 8 } |
| 499 |
func (c SetEventMaskPage2) Marshal(b []byte) { o.PutUint64(b, c.EventMaskPage2) } |
| 500 |
|
| 501 |
type SetEventMaskPage2RP struct{ Status uint8 } |
| 502 |
|
| 503 |
|
| 504 |
type WriteLEHostSupported struct { |
| 505 |
LESupportedHost uint8 |
| 506 |
SimultaneousLEHost uint8 |
| 507 |
} |
| 508 |
|
| 509 |
func (c WriteLEHostSupported) Opcode() int { return opWriteLEHostSupported } |
| 510 |
func (c WriteLEHostSupported) Len() int { return 2 } |
| 511 |
func (c WriteLEHostSupported) Marshal(b []byte) { b[0], b[1] = c.LESupportedHost, c.SimultaneousLEHost } |
| 512 |
|
| 513 |
type WriteLeHostSupportedRP struct{ Status uint8 } |
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
type LESetEventMask struct{ LEEventMask uint64 } |
| 519 |
|
| 520 |
func (c LESetEventMask) Opcode() int { return opLESetEventMask } |
| 521 |
func (c LESetEventMask) Len() int { return 8 } |
| 522 |
func (c LESetEventMask) Marshal(b []byte) { o.PutUint64(b, c.LEEventMask) } |
| 523 |
|
| 524 |
type LESetEventMaskRP struct{ Status uint8 } |
| 525 |
|
| 526 |
|
| 527 |
type LEReadBufferSize struct{} |
| 528 |
|
| 529 |
func (c LEReadBufferSize) Opcode() int { return opLEReadBufferSize } |
| 530 |
func (c LEReadBufferSize) Len() int { return 1 } |
| 531 |
func (c LEReadBufferSize) Marshal(b []byte) {} |
| 532 |
|
| 533 |
type LEReadBufferSizeRP struct { |
| 534 |
Status uint8 |
| 535 |
HCLEACLDataPacketLength uint16 |
| 536 |
HCTotalNumLEACLDataPackets uint8 |
| 537 |
} |
| 538 |
|
| 539 |
|
| 540 |
type LEReadLocalSupportedFeatures struct{} |
| 541 |
|
| 542 |
func (c LEReadLocalSupportedFeatures) Opcode() int { return opLEReadLocalSupportedFeatures } |
| 543 |
func (c LEReadLocalSupportedFeatures) Len() int { return 0 } |
| 544 |
func (c LEReadLocalSupportedFeatures) Marshal(b []byte) {} |
| 545 |
|
| 546 |
type LEReadLocalSupportedFeaturesRP struct { |
| 547 |
Status uint8 |
| 548 |
LEFeatures uint64 |
| 549 |
} |
| 550 |
|
| 551 |
|
| 552 |
type LESetRandomAddress struct{ RandomAddress [6]byte } |
| 553 |
|
| 554 |
func (c LESetRandomAddress) Opcode() int { return opLESetRandomAddress } |
| 555 |
func (c LESetRandomAddress) Len() int { return 6 } |
| 556 |
func (c LESetRandomAddress) Marshal(b []byte) { o.PutMAC(b, c.RandomAddress) } |
| 557 |
|
| 558 |
type LESetRandomAddressRP struct{ Status uint8 } |
| 559 |
|
| 560 |
|
| 561 |
type LESetAdvertisingParameters struct { |
| 562 |
AdvertisingIntervalMin uint16 |
| 563 |
AdvertisingIntervalMax uint16 |
| 564 |
AdvertisingType uint8 |
| 565 |
OwnAddressType uint8 |
| 566 |
DirectAddressType uint8 |
| 567 |
DirectAddress [6]byte |
| 568 |
AdvertisingChannelMap uint8 |
| 569 |
AdvertisingFilterPolicy uint8 |
| 570 |
} |
| 571 |
|
| 572 |
func (c LESetAdvertisingParameters) Opcode() int { return opLESetAdvertisingParameters } |
| 573 |
func (c LESetAdvertisingParameters) Len() int { return 15 } |
| 574 |
func (c LESetAdvertisingParameters) Marshal(b []byte) { |
| 575 |
o.PutUint16(b[0:], c.AdvertisingIntervalMin) |
| 576 |
o.PutUint16(b[2:], c.AdvertisingIntervalMax) |
| 577 |
o.PutUint8(b[4:], c.AdvertisingType) |
| 578 |
o.PutUint8(b[5:], c.OwnAddressType) |
| 579 |
o.PutUint8(b[6:], c.DirectAddressType) |
| 580 |
o.PutMAC(b[7:], c.DirectAddress) |
| 581 |
o.PutUint8(b[13:], c.AdvertisingChannelMap) |
| 582 |
o.PutUint8(b[14:], c.AdvertisingFilterPolicy) |
| 583 |
} |
| 584 |
|
| 585 |
type LESetAdvertisingParametersRP struct{ Status uint8 } |
| 586 |
|
| 587 |
|
| 588 |
type LEReadAdvertisingChannelTxPower struct{} |
| 589 |
|
| 590 |
func (c LEReadAdvertisingChannelTxPower) Opcode() int { return opLEReadAdvertisingChannelTxPower } |
| 591 |
func (c LEReadAdvertisingChannelTxPower) Len() int { return 0 } |
| 592 |
func (c LEReadAdvertisingChannelTxPower) Marshal(b []byte) {} |
| 593 |
|
| 594 |
type LEReadAdvertisingChannelTxPowerRP struct { |
| 595 |
Status uint8 |
| 596 |
TransmitPowerLevel uint8 |
| 597 |
} |
| 598 |
|
| 599 |
|
| 600 |
type LESetAdvertisingData struct { |
| 601 |
AdvertisingDataLength uint8 |
| 602 |
AdvertisingData [31]byte |
| 603 |
} |
| 604 |
|
| 605 |
func (c LESetAdvertisingData) Opcode() int { return opLESetAdvertisingData } |
| 606 |
func (c LESetAdvertisingData) Len() int { return 32 } |
| 607 |
func (c LESetAdvertisingData) Marshal(b []byte) { |
| 608 |
b[0] = c.AdvertisingDataLength |
| 609 |
copy(b[1:], c.AdvertisingData[:c.AdvertisingDataLength]) |
| 610 |
} |
| 611 |
|
| 612 |
type LESetAdvertisingDataRP struct{ Status uint8 } |
| 613 |
|
| 614 |
|
| 615 |
type LESetScanResponseData struct { |
| 616 |
ScanResponseDataLength uint8 |
| 617 |
ScanResponseData [31]byte |
| 618 |
} |
| 619 |
|
| 620 |
func (c LESetScanResponseData) Opcode() int { return opLESetScanResponseData } |
| 621 |
func (c LESetScanResponseData) Len() int { return 32 } |
| 622 |
func (c LESetScanResponseData) Marshal(b []byte) { |
| 623 |
b[0] = c.ScanResponseDataLength |
| 624 |
copy(b[1:], c.ScanResponseData[:c.ScanResponseDataLength]) |
| 625 |
} |
| 626 |
|
| 627 |
type LESetScanResponseDataRP struct{ Status uint8 } |
| 628 |
|
| 629 |
|
| 630 |
type LESetAdvertiseEnable struct{ AdvertisingEnable uint8 } |
| 631 |
|
| 632 |
func (c LESetAdvertiseEnable) Opcode() int { return opLESetAdvertiseEnable } |
| 633 |
func (c LESetAdvertiseEnable) Len() int { return 1 } |
| 634 |
func (c LESetAdvertiseEnable) Marshal(b []byte) { b[0] = c.AdvertisingEnable } |
| 635 |
|
| 636 |
type LESetAdvertiseEnableRP struct{ Status uint8 } |
| 637 |
|
| 638 |
|
| 639 |
type LESetScanParameters struct { |
| 640 |
LEScanType uint8 |
| 641 |
LEScanInterval uint16 |
| 642 |
LEScanWindow uint16 |
| 643 |
OwnAddressType uint8 |
| 644 |
ScanningFilterPolicy uint8 |
| 645 |
} |
| 646 |
|
| 647 |
func (c LESetScanParameters) Opcode() int { return opLESetScanParameters } |
| 648 |
func (c LESetScanParameters) Len() int { return 7 } |
| 649 |
func (c LESetScanParameters) Marshal(b []byte) { |
| 650 |
o.PutUint8(b[0:], c.LEScanType) |
| 651 |
o.PutUint16(b[1:], c.LEScanInterval) |
| 652 |
o.PutUint16(b[3:], c.LEScanWindow) |
| 653 |
o.PutUint8(b[5:], c.OwnAddressType) |
| 654 |
o.PutUint8(b[6:], c.ScanningFilterPolicy) |
| 655 |
} |
| 656 |
|
| 657 |
type LESetScanParametersRP struct{ Status uint8 } |
| 658 |
|
| 659 |
|
| 660 |
type LESetScanEnable struct { |
| 661 |
LEScanEnable uint8 |
| 662 |
FilterDuplicates uint8 |
| 663 |
} |
| 664 |
|
| 665 |
func (c LESetScanEnable) Opcode() int { return opLESetScanEnable } |
| 666 |
func (c LESetScanEnable) Len() int { return 2 } |
| 667 |
func (c LESetScanEnable) Marshal(b []byte) { b[0], b[1] = c.LEScanEnable, c.FilterDuplicates } |
| 668 |
|
| 669 |
type LESetScanEnableRP struct{ Status uint8 } |
| 670 |
|
| 671 |
|
| 672 |
type LECreateConn struct { |
| 673 |
LEScanInterval uint16 |
| 674 |
LEScanWindow uint16 |
| 675 |
InitiatorFilterPolicy uint8 |
| 676 |
PeerAddressType uint8 |
| 677 |
PeerAddress [6]byte |
| 678 |
OwnAddressType uint8 |
| 679 |
ConnIntervalMin uint16 |
| 680 |
ConnIntervalMax uint16 |
| 681 |
ConnLatency uint16 |
| 682 |
SupervisionTimeout uint16 |
| 683 |
MinimumCELength uint16 |
| 684 |
MaximumCELength uint16 |
| 685 |
} |
| 686 |
|
| 687 |
func (c LECreateConn) Opcode() int { return opLECreateConn } |
| 688 |
func (c LECreateConn) Len() int { return 25 } |
| 689 |
func (c LECreateConn) Marshal(b []byte) { |
| 690 |
o.PutUint16(b[0:], c.LEScanInterval) |
| 691 |
o.PutUint16(b[2:], c.LEScanWindow) |
| 692 |
o.PutUint8(b[4:], c.InitiatorFilterPolicy) |
| 693 |
o.PutUint8(b[5:], c.PeerAddressType) |
| 694 |
o.PutMAC(b[6:], c.PeerAddress) |
| 695 |
o.PutUint8(b[12:], c.OwnAddressType) |
| 696 |
o.PutUint16(b[13:], c.ConnIntervalMin) |
| 697 |
o.PutUint16(b[15:], c.ConnIntervalMax) |
| 698 |
o.PutUint16(b[17:], c.ConnLatency) |
| 699 |
o.PutUint16(b[19:], c.SupervisionTimeout) |
| 700 |
o.PutUint16(b[21:], c.MinimumCELength) |
| 701 |
o.PutUint16(b[23:], c.MaximumCELength) |
| 702 |
} |
| 703 |
|
| 704 |
type LECreateConnRP struct{} |
| 705 |
|
| 706 |
|
| 707 |
type LECreateConnCancel struct{} |
| 708 |
|
| 709 |
func (c LECreateConnCancel) Opcode() int { return opLECreateConnCancel } |
| 710 |
func (c LECreateConnCancel) Len() int { return 0 } |
| 711 |
func (c LECreateConnCancel) Marshal(b []byte) {} |
| 712 |
|
| 713 |
type LECreateConnCancelRP struct{ Status uint8 } |
| 714 |
|
| 715 |
|
| 716 |
type LEReadWhiteListSize struct{} |
| 717 |
|
| 718 |
func (c LEReadWhiteListSize) Opcode() int { return opLEReadWhiteListSize } |
| 719 |
func (c LEReadWhiteListSize) Len() int { return 0 } |
| 720 |
func (c LEReadWhiteListSize) Marshal(b []byte) {} |
| 721 |
|
| 722 |
type LEReadWhiteListSizeRP struct { |
| 723 |
Status uint8 |
| 724 |
WhiteListSize uint8 |
| 725 |
} |
| 726 |
|
| 727 |
|
| 728 |
type LEClearWhiteList struct{} |
| 729 |
|
| 730 |
func (c LEClearWhiteList) Opcode() int { return opLEClearWhiteList } |
| 731 |
func (c LEClearWhiteList) Len() int { return 0 } |
| 732 |
func (c LEClearWhiteList) Marshal(b []byte) {} |
| 733 |
|
| 734 |
type LEClearWhiteListRP struct{ Status uint8 } |
| 735 |
|
| 736 |
|
| 737 |
type LEAddDeviceToWhiteList struct { |
| 738 |
AddressType uint8 |
| 739 |
Address [6]byte |
| 740 |
} |
| 741 |
|
| 742 |
func (c LEAddDeviceToWhiteList) Opcode() int { return opLEAddDeviceToWhiteList } |
| 743 |
func (c LEAddDeviceToWhiteList) Len() int { return 7 } |
| 744 |
func (c LEAddDeviceToWhiteList) Marshal(b []byte) { |
| 745 |
b[0] = c.AddressType |
| 746 |
o.PutMAC(b[1:], c.Address) |
| 747 |
} |
| 748 |
|
| 749 |
type LEAddDeviceToWhiteListRP struct{ Status uint8 } |
| 750 |
|
| 751 |
|
| 752 |
type LERemoveDeviceFromWhiteList struct { |
| 753 |
AddressType uint8 |
| 754 |
Address [6]byte |
| 755 |
} |
| 756 |
|
| 757 |
func (c LERemoveDeviceFromWhiteList) Opcode() int { return opLERemoveDeviceFromWhiteList } |
| 758 |
func (c LERemoveDeviceFromWhiteList) Len() int { return 7 } |
| 759 |
func (c LERemoveDeviceFromWhiteList) Marshal(b []byte) { |
| 760 |
b[0] = c.AddressType |
| 761 |
o.PutMAC(b[1:], c.Address) |
| 762 |
} |
| 763 |
|
| 764 |
type LERemoveDeviceFromWhiteListRP struct{ Status uint8 } |
| 765 |
|
| 766 |
|
| 767 |
type LEConnUpdate struct { |
| 768 |
ConnectionHandle uint16 |
| 769 |
ConnIntervalMin uint16 |
| 770 |
ConnIntervalMax uint16 |
| 771 |
ConnLatency uint16 |
| 772 |
SupervisionTimeout uint16 |
| 773 |
MinimumCELength uint16 |
| 774 |
MaximumCELength uint16 |
| 775 |
} |
| 776 |
|
| 777 |
func (c LEConnUpdate) Opcode() int { return opLEConnUpdate } |
| 778 |
func (c LEConnUpdate) Len() int { return 14 } |
| 779 |
func (c LEConnUpdate) Marshal(b []byte) { |
| 780 |
o.PutUint16(b[0:], c.ConnectionHandle) |
| 781 |
o.PutUint16(b[2:], c.ConnIntervalMin) |
| 782 |
o.PutUint16(b[4:], c.ConnIntervalMax) |
| 783 |
o.PutUint16(b[6:], c.ConnLatency) |
| 784 |
o.PutUint16(b[8:], c.SupervisionTimeout) |
| 785 |
o.PutUint16(b[10:], c.MinimumCELength) |
| 786 |
o.PutUint16(b[12:], c.MaximumCELength) |
| 787 |
} |
| 788 |
|
| 789 |
type LEConnUpdateRP struct{} |
| 790 |
|
| 791 |
|
| 792 |
type LESetHostChannelClassification struct{ ChannelMap [5]byte } |
| 793 |
|
| 794 |
func (c LESetHostChannelClassification) Opcode() int { return opLESetHostChannelClassification } |
| 795 |
func (c LESetHostChannelClassification) Len() int { return 5 } |
| 796 |
func (c LESetHostChannelClassification) Marshal(b []byte) { copy(b, c.ChannelMap[:]) } |
| 797 |
|
| 798 |
type LESetHostChannelClassificationRP struct{ Status uint8 } |
| 799 |
|
| 800 |
|
| 801 |
type LEReadChannelMap struct{ ConnectionHandle uint16 } |
| 802 |
|
| 803 |
func (c LEReadChannelMap) Opcode() int { return opLEReadChannelMap } |
| 804 |
func (c LEReadChannelMap) Len() int { return 2 } |
| 805 |
func (c LEReadChannelMap) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) } |
| 806 |
|
| 807 |
type LEReadChannelMapRP struct { |
| 808 |
Status uint8 |
| 809 |
ConnectionHandle uint16 |
| 810 |
ChannelMap [5]byte |
| 811 |
} |
| 812 |
|
| 813 |
|
| 814 |
type LEReadRemoteUsedFeatures struct{ ConnectionHandle uint16 } |
| 815 |
|
| 816 |
func (c LEReadRemoteUsedFeatures) Opcode() int { return opLEReadRemoteUsedFeatures } |
| 817 |
func (c LEReadRemoteUsedFeatures) Len() int { return 8 } |
| 818 |
func (c LEReadRemoteUsedFeatures) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) } |
| 819 |
|
| 820 |
type LEReadRemoteUsedFeaturesRP struct{} |
| 821 |
|
| 822 |
|
| 823 |
type LEEncrypt struct { |
| 824 |
Key [16]byte |
| 825 |
PlaintextData [16]byte |
| 826 |
} |
| 827 |
|
| 828 |
func (c LEEncrypt) Opcode() int { return opLEEncrypt } |
| 829 |
func (c LEEncrypt) Len() int { return 32 } |
| 830 |
func (c LEEncrypt) Marshal(b []byte) { |
| 831 |
copy(b[0:], c.Key[:]) |
| 832 |
copy(b[16:], c.PlaintextData[:]) |
| 833 |
} |
| 834 |
|
| 835 |
type LEEncryptRP struct { |
| 836 |
Stauts uint8 |
| 837 |
EncryptedData [16]byte |
| 838 |
} |
| 839 |
|
| 840 |
|
| 841 |
type LERand struct{} |
| 842 |
|
| 843 |
func (c LERand) Opcode() int { return opLERand } |
| 844 |
func (c LERand) Len() int { return 0 } |
| 845 |
func (c LERand) Marshal(b []byte) {} |
| 846 |
|
| 847 |
type LERandRP struct { |
| 848 |
Status uint8 |
| 849 |
RandomNumber uint64 |
| 850 |
} |
| 851 |
|
| 852 |
|
| 853 |
type LEStartEncryption struct { |
| 854 |
ConnectionHandle uint16 |
| 855 |
RandomNumber uint64 |
| 856 |
EncryptedDiversifier uint16 |
| 857 |
LongTermKey [16]byte |
| 858 |
} |
| 859 |
|
| 860 |
func (c LEStartEncryption) Opcode() int { return opLEStartEncryption } |
| 861 |
func (c LEStartEncryption) Len() int { return 28 } |
| 862 |
func (c LEStartEncryption) Marshal(b []byte) { |
| 863 |
o.PutUint16(b[0:], c.ConnectionHandle) |
| 864 |
o.PutUint64(b[2:], c.RandomNumber) |
| 865 |
o.PutUint16(b[10:], c.EncryptedDiversifier) |
| 866 |
copy(b[12:], c.LongTermKey[:]) |
| 867 |
} |
| 868 |
|
| 869 |
type LEStartEncryptionRP struct{} |
| 870 |
|
| 871 |
|
| 872 |
type LELTKReply struct { |
| 873 |
ConnectionHandle uint16 |
| 874 |
LongTermKey [16]byte |
| 875 |
} |
| 876 |
|
| 877 |
func (c LELTKReply) Opcode() int { return opLELTKReply } |
| 878 |
func (c LELTKReply) Len() int { return 18 } |
| 879 |
func (c LELTKReply) Marshal(b []byte) { |
| 880 |
o.PutUint16(b[0:], c.ConnectionHandle) |
| 881 |
copy(b[2:], c.LongTermKey[:]) |
| 882 |
} |
| 883 |
|
| 884 |
type LELTKReplyRP struct { |
| 885 |
Status uint8 |
| 886 |
ConnectionHandle uint16 |
| 887 |
} |
| 888 |
|
| 889 |
|
| 890 |
type LELTKNegReply struct{ ConnectionHandle uint16 } |
| 891 |
|
| 892 |
func (c LELTKNegReply) Opcode() int { return opLELTKNegReply } |
| 893 |
func (c LELTKNegReply) Len() int { return 2 } |
| 894 |
func (c LELTKNegReply) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) } |
| 895 |
|
| 896 |
type LELTKNegReplyRP struct { |
| 897 |
Status uint8 |
| 898 |
ConnectionHandle uint16 |
| 899 |
} |
| 900 |
|
| 901 |
|
| 902 |
type LEReadSupportedStates struct{} |
| 903 |
|
| 904 |
func (c LEReadSupportedStates) Opcode() int { return opLEReadSupportedStates } |
| 905 |
func (c LEReadSupportedStates) Len() int { return 0 } |
| 906 |
func (c LEReadSupportedStates) Marshal(b []byte) {} |
| 907 |
|
| 908 |
type LEReadSupportedStatesRP struct { |
| 909 |
Status uint8 |
| 910 |
LEStates [8]byte |
| 911 |
} |
| 912 |
|
| 913 |
|
| 914 |
type LEReceiverTest struct{ RxChannel uint8 } |
| 915 |
|
| 916 |
func (c LEReceiverTest) Opcode() int { return opLEReceiverTest } |
| 917 |
func (c LEReceiverTest) Len() int { return 1 } |
| 918 |
func (c LEReceiverTest) Marshal(b []byte) { b[0] = c.RxChannel } |
| 919 |
|
| 920 |
type LEReceiverTestRP struct{ Status uint8 } |
| 921 |
|
| 922 |
|
| 923 |
type LETransmitterTest struct { |
| 924 |
TxChannel uint8 |
| 925 |
LengthOfTestData uint8 |
| 926 |
PacketPayload uint8 |
| 927 |
} |
| 928 |
|
| 929 |
func (c LETransmitterTest) Opcode() int { return opLETransmitterTest } |
| 930 |
func (c LETransmitterTest) Len() int { return 3 } |
| 931 |
func (c LETransmitterTest) Marshal(b []byte) { |
| 932 |
b[0], b[1], b[2] = c.TxChannel, c.LengthOfTestData, c.PacketPayload |
| 933 |
} |
| 934 |
|
| 935 |
type LETransmitterTestRP struct{ Status uint8 } |
| 936 |
|
| 937 |
|
| 938 |
type LETestEnd struct{} |
| 939 |
|
| 940 |
func (c LETestEnd) Opcode() int { return opLETestEnd } |
| 941 |
func (c LETestEnd) Len() int { return 0 } |
| 942 |
func (c LETestEnd) Marshal(b []byte) {} |
| 943 |
|
| 944 |
type LETestEndRP struct { |
| 945 |
Status uint8 |
| 946 |
NumberOfPackets uint16 |
| 947 |
} |
| 948 |
|
| 949 |
|
| 950 |
type LERemoteConnectionParameterReply struct { |
| 951 |
ConnectionHandle uint16 |
| 952 |
IntervalMin uint16 |
| 953 |
IntervalMax uint16 |
| 954 |
Latency uint16 |
| 955 |
Timeout uint16 |
| 956 |
MinimumCELength uint16 |
| 957 |
MaximumCELength uint16 |
| 958 |
} |
| 959 |
|
| 960 |
func (c LERemoteConnectionParameterReply) Opcode() int { return opLERemoteConnectionParameterReply } |
| 961 |
func (c LERemoteConnectionParameterReply) Len() int { return 14 } |
| 962 |
func (c LERemoteConnectionParameterReply) Marshal(b []byte) { |
| 963 |
o.PutUint16(b[0:], c.ConnectionHandle) |
| 964 |
o.PutUint16(b[2:], c.IntervalMin) |
| 965 |
o.PutUint16(b[4:], c.IntervalMax) |
| 966 |
o.PutUint16(b[6:], c.Latency) |
| 967 |
o.PutUint16(b[8:], c.Timeout) |
| 968 |
o.PutUint16(b[10:], c.MinimumCELength) |
| 969 |
o.PutUint16(b[12:], c.MaximumCELength) |
| 970 |
} |
| 971 |
|
| 972 |
type LERemoteConnectionParameterReplyRP struct { |
| 973 |
Status uint8 |
| 974 |
ConnectionHandle uint16 |
| 975 |
} |
| 976 |
|
| 977 |
|
| 978 |
type LERemoteConnectionParameterNegReply struct { |
| 979 |
ConnectionHandle uint16 |
| 980 |
Reason uint8 |
| 981 |
} |
| 982 |
|
| 983 |
func (c LERemoteConnectionParameterNegReply) Opcode() int { |
| 984 |
return opLERemoteConnectionParameterNegReply |
| 985 |
} |
| 986 |
func (c LERemoteConnectionParameterNegReply) Len() int { return 3 } |
| 987 |
func (c LERemoteConnectionParameterNegReply) Marshal(b []byte) { |
| 988 |
o.PutUint16(b[0:], c.ConnectionHandle) |
| 989 |
b[2] = c.Reason |
| 990 |
} |
| 991 |
|
| 992 |
type LERemoteConnectionParameterNegReplyRP struct { |
| 993 |
Status uint8 |
| 994 |
ConnectionHandle uint16 |
| 995 |
} |