tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/rtl8720dn/rpc.go (about) 1 // Automatically generated file. DO NOT EDIT. 2 // Generated by github.com/sago35/go-erpcgen. 3 4 package rtl8720dn 5 6 import ( 7 "encoding/binary" 8 "fmt" 9 ) 10 11 func (r *rtl8720dn) rpc_system_version() string { 12 if r.debug { 13 fmt.Printf("rpc_system_version()\r\n") 14 } 15 msg := startWriteMessage(0x00, 0x01, 0x01, uint32(r.seq)) 16 17 r.performRequest(msg) 18 19 r.read() 20 widx := 8 21 var result string 22 result_length := binary.LittleEndian.Uint32(payload[widx:]) 23 widx += 4 24 result = string(payload[widx : widx+int(result_length)]) 25 26 r.seq++ 27 return result 28 } 29 30 func (r *rtl8720dn) rpc_system_ack(c uint8) uint8 { 31 if r.debug { 32 fmt.Printf("rpc_system_ack()\r\n") 33 } 34 msg := startWriteMessage(0x00, 0x01, 0x02, uint32(r.seq)) 35 36 // c : in uint8 37 msg = append(msg, byte(c>>0)) 38 39 r.performRequest(msg) 40 41 r.read() 42 widx := 8 43 44 var result uint8 45 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 46 47 r.seq++ 48 return result 49 } 50 51 func (r *rtl8720dn) rpc_ble_init() bool { 52 if r.debug { 53 fmt.Printf("rpc_ble_init()\r\n") 54 } 55 msg := startWriteMessage(0x00, 0x02, 0x01, uint32(r.seq)) 56 57 r.performRequest(msg) 58 59 r.read() 60 widx := 8 61 var result bool 62 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 63 64 r.seq++ 65 return result 66 } 67 68 func (r *rtl8720dn) rpc_ble_start() { 69 if r.debug { 70 fmt.Printf("rpc_ble_start()\r\n") 71 } 72 msg := startWriteMessage(0x00, 0x02, 0x02, uint32(r.seq)) 73 74 r.performRequest(msg) 75 76 r.read() 77 78 r.seq++ 79 return 80 } 81 82 func (r *rtl8720dn) rpc_ble_deinit() { 83 if r.debug { 84 fmt.Printf("rpc_ble_deinit()\r\n") 85 } 86 msg := startWriteMessage(0x00, 0x02, 0x03, uint32(r.seq)) 87 88 r.performRequest(msg) 89 90 r.read() 91 92 r.seq++ 93 return 94 } 95 96 func (r *rtl8720dn) rpc_gap_set_param(param RPC_T_GAP_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 97 if r.debug { 98 fmt.Printf("rpc_gap_set_param()\r\n") 99 } 100 msg := startWriteMessage(0x00, 0x03, 0x01, uint32(r.seq)) 101 102 // param : in RPC_T_GAP_PARAM_TYPE 103 msg = append(msg, byte(param>>0)) 104 msg = append(msg, byte(param>>8)) 105 msg = append(msg, byte(param>>16)) 106 msg = append(msg, byte(param>>24)) 107 // value : in []byte 108 msg = append(msg, byte(len(value)), byte(len(value)>>8), byte(len(value)>>16), byte(len(value)>>24)) 109 msg = append(msg, []byte(value)...) 110 111 r.performRequest(msg) 112 113 r.read() 114 widx := 8 115 116 var result RPC_T_GAP_CAUSE 117 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 118 119 r.seq++ 120 return result 121 } 122 123 func (r *rtl8720dn) rpc_gap_get_param(param RPC_T_GAP_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 124 if r.debug { 125 fmt.Printf("rpc_gap_get_param()\r\n") 126 } 127 msg := startWriteMessage(0x00, 0x03, 0x02, uint32(r.seq)) 128 129 // param : in RPC_T_GAP_PARAM_TYPE 130 msg = append(msg, byte(param>>0)) 131 msg = append(msg, byte(param>>8)) 132 msg = append(msg, byte(param>>16)) 133 msg = append(msg, byte(param>>24)) 134 135 r.performRequest(msg) 136 137 r.read() 138 widx := 8 139 // value : out []byte 140 value_length := binary.LittleEndian.Uint32(payload[widx:]) 141 widx += 4 142 if value_length > 0 { 143 copy(value, payload[widx:widx+int(value_length)]) 144 widx += int(value_length) 145 } 146 147 var result RPC_T_GAP_CAUSE 148 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 149 150 r.seq++ 151 return result 152 } 153 154 func (r *rtl8720dn) rpc_gap_set_pairable_mode() RPC_T_GAP_CAUSE { 155 if r.debug { 156 fmt.Printf("rpc_gap_set_pairable_mode()\r\n") 157 } 158 msg := startWriteMessage(0x00, 0x03, 0x03, uint32(r.seq)) 159 160 r.performRequest(msg) 161 162 r.read() 163 widx := 8 164 var result RPC_T_GAP_CAUSE 165 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 166 167 r.seq++ 168 return result 169 } 170 171 func (r *rtl8720dn) rpc_le_bond_set_param(param RPC_T_LE_BOND_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 172 if r.debug { 173 fmt.Printf("rpc_le_bond_set_param()\r\n") 174 } 175 msg := startWriteMessage(0x00, 0x04, 0x01, uint32(r.seq)) 176 177 // param : in RPC_T_LE_BOND_PARAM_TYPE 178 msg = append(msg, byte(param>>0)) 179 msg = append(msg, byte(param>>8)) 180 msg = append(msg, byte(param>>16)) 181 msg = append(msg, byte(param>>24)) 182 // value : in []byte 183 msg = append(msg, byte(len(value)), byte(len(value)>>8), byte(len(value)>>16), byte(len(value)>>24)) 184 msg = append(msg, []byte(value)...) 185 186 r.performRequest(msg) 187 188 r.read() 189 widx := 8 190 191 var result RPC_T_GAP_CAUSE 192 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 193 194 r.seq++ 195 return result 196 } 197 198 func (r *rtl8720dn) rpc_le_bond_get_param(param RPC_T_LE_BOND_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 199 if r.debug { 200 fmt.Printf("rpc_le_bond_get_param()\r\n") 201 } 202 msg := startWriteMessage(0x00, 0x04, 0x02, uint32(r.seq)) 203 204 // param : in RPC_T_LE_BOND_PARAM_TYPE 205 msg = append(msg, byte(param>>0)) 206 msg = append(msg, byte(param>>8)) 207 msg = append(msg, byte(param>>16)) 208 msg = append(msg, byte(param>>24)) 209 210 r.performRequest(msg) 211 212 r.read() 213 widx := 8 214 // value : out []byte 215 value_length := binary.LittleEndian.Uint32(payload[widx:]) 216 widx += 4 217 if value_length > 0 { 218 copy(value, payload[widx:widx+int(value_length)]) 219 widx += int(value_length) 220 } 221 222 var result RPC_T_GAP_CAUSE 223 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 224 225 r.seq++ 226 return result 227 } 228 229 func (r *rtl8720dn) rpc_le_bond_pair(conn_id uint8) RPC_T_GAP_CAUSE { 230 if r.debug { 231 fmt.Printf("rpc_le_bond_pair()\r\n") 232 } 233 msg := startWriteMessage(0x00, 0x04, 0x03, uint32(r.seq)) 234 235 // conn_id : in uint8 236 msg = append(msg, byte(conn_id>>0)) 237 238 r.performRequest(msg) 239 240 r.read() 241 widx := 8 242 243 var result RPC_T_GAP_CAUSE 244 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 245 246 r.seq++ 247 return result 248 } 249 250 func (r *rtl8720dn) rpc_le_bond_get_display_key(conn_id uint8, key *uint32) RPC_T_GAP_CAUSE { 251 if r.debug { 252 fmt.Printf("rpc_le_bond_get_display_key()\r\n") 253 } 254 msg := startWriteMessage(0x00, 0x04, 0x04, uint32(r.seq)) 255 256 // conn_id : in uint8 257 msg = append(msg, byte(conn_id>>0)) 258 259 r.performRequest(msg) 260 261 r.read() 262 widx := 8 263 // key : out uint32 264 *key = binary.LittleEndian.Uint32(payload[widx:]) 265 widx += 4 266 267 var result RPC_T_GAP_CAUSE 268 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 269 270 r.seq++ 271 return result 272 } 273 274 func (r *rtl8720dn) rpc_le_bond_passkey_input_confirm(conn_id uint8, passcode uint32, cause RPC_T_GAP_CFM_CAUSE) RPC_T_GAP_CAUSE { 275 if r.debug { 276 fmt.Printf("rpc_le_bond_passkey_input_confirm()\r\n") 277 } 278 msg := startWriteMessage(0x00, 0x04, 0x05, uint32(r.seq)) 279 280 // conn_id : in uint8 281 msg = append(msg, byte(conn_id>>0)) 282 // passcode : in uint32 283 msg = append(msg, byte(passcode>>0)) 284 msg = append(msg, byte(passcode>>8)) 285 msg = append(msg, byte(passcode>>16)) 286 msg = append(msg, byte(passcode>>24)) 287 // cause : in RPC_T_GAP_CFM_CAUSE 288 msg = append(msg, byte(cause>>0)) 289 msg = append(msg, byte(cause>>8)) 290 msg = append(msg, byte(cause>>16)) 291 msg = append(msg, byte(cause>>24)) 292 293 r.performRequest(msg) 294 295 r.read() 296 widx := 8 297 298 var result RPC_T_GAP_CAUSE 299 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 300 301 r.seq++ 302 return result 303 } 304 305 func (r *rtl8720dn) rpc_le_bond_oob_input_confirm(conn_id uint8, cause RPC_T_GAP_CFM_CAUSE) RPC_T_GAP_CAUSE { 306 if r.debug { 307 fmt.Printf("rpc_le_bond_oob_input_confirm()\r\n") 308 } 309 msg := startWriteMessage(0x00, 0x04, 0x06, uint32(r.seq)) 310 311 // conn_id : in uint8 312 msg = append(msg, byte(conn_id>>0)) 313 // cause : in RPC_T_GAP_CFM_CAUSE 314 msg = append(msg, byte(cause>>0)) 315 msg = append(msg, byte(cause>>8)) 316 msg = append(msg, byte(cause>>16)) 317 msg = append(msg, byte(cause>>24)) 318 319 r.performRequest(msg) 320 321 r.read() 322 widx := 8 323 324 var result RPC_T_GAP_CAUSE 325 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 326 327 r.seq++ 328 return result 329 } 330 331 func (r *rtl8720dn) rpc_le_bond_just_work_confirm(conn_id uint8, cause RPC_T_GAP_CFM_CAUSE) RPC_T_GAP_CAUSE { 332 if r.debug { 333 fmt.Printf("rpc_le_bond_just_work_confirm()\r\n") 334 } 335 msg := startWriteMessage(0x00, 0x04, 0x07, uint32(r.seq)) 336 337 // conn_id : in uint8 338 msg = append(msg, byte(conn_id>>0)) 339 // cause : in RPC_T_GAP_CFM_CAUSE 340 msg = append(msg, byte(cause>>0)) 341 msg = append(msg, byte(cause>>8)) 342 msg = append(msg, byte(cause>>16)) 343 msg = append(msg, byte(cause>>24)) 344 345 r.performRequest(msg) 346 347 r.read() 348 widx := 8 349 350 var result RPC_T_GAP_CAUSE 351 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 352 353 r.seq++ 354 return result 355 } 356 357 func (r *rtl8720dn) rpc_le_bond_passkey_display_confirm(conn_id uint8, cause RPC_T_GAP_CFM_CAUSE) RPC_T_GAP_CAUSE { 358 if r.debug { 359 fmt.Printf("rpc_le_bond_passkey_display_confirm()\r\n") 360 } 361 msg := startWriteMessage(0x00, 0x04, 0x08, uint32(r.seq)) 362 363 // conn_id : in uint8 364 msg = append(msg, byte(conn_id>>0)) 365 // cause : in RPC_T_GAP_CFM_CAUSE 366 msg = append(msg, byte(cause>>0)) 367 msg = append(msg, byte(cause>>8)) 368 msg = append(msg, byte(cause>>16)) 369 msg = append(msg, byte(cause>>24)) 370 371 r.performRequest(msg) 372 373 r.read() 374 widx := 8 375 376 var result RPC_T_GAP_CAUSE 377 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 378 379 r.seq++ 380 return result 381 } 382 383 func (r *rtl8720dn) rpc_le_bond_user_confirm(conn_id uint8, cause RPC_T_GAP_CFM_CAUSE) RPC_T_GAP_CAUSE { 384 if r.debug { 385 fmt.Printf("rpc_le_bond_user_confirm()\r\n") 386 } 387 msg := startWriteMessage(0x00, 0x04, 0x09, uint32(r.seq)) 388 389 // conn_id : in uint8 390 msg = append(msg, byte(conn_id>>0)) 391 // cause : in RPC_T_GAP_CFM_CAUSE 392 msg = append(msg, byte(cause>>0)) 393 msg = append(msg, byte(cause>>8)) 394 msg = append(msg, byte(cause>>16)) 395 msg = append(msg, byte(cause>>24)) 396 397 r.performRequest(msg) 398 399 r.read() 400 widx := 8 401 402 var result RPC_T_GAP_CAUSE 403 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 404 405 r.seq++ 406 return result 407 } 408 409 func (r *rtl8720dn) rpc_le_bond_cfg_local_key_distribute(init_dist uint8, rsp_dist uint8) RPC_T_GAP_CAUSE { 410 if r.debug { 411 fmt.Printf("rpc_le_bond_cfg_local_key_distribute()\r\n") 412 } 413 msg := startWriteMessage(0x00, 0x04, 0x0A, uint32(r.seq)) 414 415 // init_dist : in uint8 416 msg = append(msg, byte(init_dist>>0)) 417 // rsp_dist : in uint8 418 msg = append(msg, byte(rsp_dist>>0)) 419 420 r.performRequest(msg) 421 422 r.read() 423 widx := 8 424 425 var result RPC_T_GAP_CAUSE 426 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 427 428 r.seq++ 429 return result 430 } 431 432 func (r *rtl8720dn) rpc_le_bond_clear_all_keys() { 433 if r.debug { 434 fmt.Printf("rpc_le_bond_clear_all_keys()\r\n") 435 } 436 msg := startWriteMessage(0x00, 0x04, 0x0B, uint32(r.seq)) 437 438 r.performRequest(msg) 439 440 r.read() 441 442 r.seq++ 443 return 444 } 445 446 func (r *rtl8720dn) rpc_le_bond_delete_by_idx(idx uint8) RPC_T_GAP_CAUSE { 447 if r.debug { 448 fmt.Printf("rpc_le_bond_delete_by_idx()\r\n") 449 } 450 msg := startWriteMessage(0x00, 0x04, 0x0C, uint32(r.seq)) 451 452 // idx : in uint8 453 msg = append(msg, byte(idx>>0)) 454 455 r.performRequest(msg) 456 457 r.read() 458 widx := 8 459 460 var result RPC_T_GAP_CAUSE 461 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 462 463 r.seq++ 464 return result 465 } 466 467 func (r *rtl8720dn) rpc_le_bond_delete_by_bd(bd_addr []uint8, bd_type RPC_T_GAP_REMOTE_ADDR_TYPE) RPC_T_GAP_CAUSE { 468 if r.debug { 469 fmt.Printf("rpc_le_bond_delete_by_bd()\r\n") 470 } 471 msg := startWriteMessage(0x00, 0x04, 0x0D, uint32(r.seq)) 472 473 // bd_addr : in []uint8 (6) 474 msg = append(msg, bd_addr...) 475 // bd_type : in RPC_T_GAP_REMOTE_ADDR_TYPE 476 msg = append(msg, byte(bd_type>>0)) 477 msg = append(msg, byte(bd_type>>8)) 478 msg = append(msg, byte(bd_type>>16)) 479 msg = append(msg, byte(bd_type>>24)) 480 481 r.performRequest(msg) 482 483 r.read() 484 widx := 8 485 486 var result RPC_T_GAP_CAUSE 487 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 488 489 r.seq++ 490 return result 491 } 492 493 func (r *rtl8720dn) rpc_le_bond_get_sec_level(conn_id uint8, sec_type RPC_T_GAP_SEC_LEVEL) RPC_T_GAP_CAUSE { 494 if r.debug { 495 fmt.Printf("rpc_le_bond_get_sec_level()\r\n") 496 } 497 msg := startWriteMessage(0x00, 0x04, 0x0E, uint32(r.seq)) 498 499 // conn_id : in uint8 500 msg = append(msg, byte(conn_id>>0)) 501 502 r.performRequest(msg) 503 504 r.read() 505 widx := 8 506 // sec_type : out RPC_T_GAP_SEC_LEVEL 507 // not impl (a.Size() > 0) 508 509 var result RPC_T_GAP_CAUSE 510 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 511 512 r.seq++ 513 return result 514 } 515 516 func (r *rtl8720dn) rpc_le_gap_init(link_num uint8) bool { 517 if r.debug { 518 fmt.Printf("rpc_le_gap_init()\r\n") 519 } 520 msg := startWriteMessage(0x00, 0x05, 0x01, uint32(r.seq)) 521 522 // link_num : in uint8 523 msg = append(msg, byte(link_num>>0)) 524 525 r.performRequest(msg) 526 527 r.read() 528 widx := 8 529 530 var result bool 531 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 532 533 r.seq++ 534 return result 535 } 536 537 func (r *rtl8720dn) rpc_le_gap_msg_info_way(use_msg bool) { 538 if r.debug { 539 fmt.Printf("rpc_le_gap_msg_info_way()\r\n") 540 } 541 msg := startWriteMessage(0x00, 0x05, 0x02, uint32(r.seq)) 542 543 // use_msg : in bool 544 if use_msg { 545 msg = append(msg, 1) 546 } else { 547 msg = append(msg, 0) 548 } 549 550 r.performRequest(msg) 551 552 r.read() 553 554 r.seq++ 555 return 556 } 557 558 func (r *rtl8720dn) rpc_le_get_max_link_num() uint8 { 559 if r.debug { 560 fmt.Printf("rpc_le_get_max_link_num()\r\n") 561 } 562 msg := startWriteMessage(0x00, 0x05, 0x03, uint32(r.seq)) 563 564 r.performRequest(msg) 565 566 r.read() 567 widx := 8 568 var result uint8 569 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 570 571 r.seq++ 572 return result 573 } 574 575 func (r *rtl8720dn) rpc_le_set_gap_param(param RPC_T_GAP_LE_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 576 if r.debug { 577 fmt.Printf("rpc_le_set_gap_param()\r\n") 578 } 579 msg := startWriteMessage(0x00, 0x05, 0x04, uint32(r.seq)) 580 581 // param : in RPC_T_GAP_LE_PARAM_TYPE 582 msg = append(msg, byte(param>>0)) 583 msg = append(msg, byte(param>>8)) 584 msg = append(msg, byte(param>>16)) 585 msg = append(msg, byte(param>>24)) 586 // value : in []byte 587 msg = append(msg, byte(len(value)), byte(len(value)>>8), byte(len(value)>>16), byte(len(value)>>24)) 588 msg = append(msg, []byte(value)...) 589 590 r.performRequest(msg) 591 592 r.read() 593 widx := 8 594 595 var result RPC_T_GAP_CAUSE 596 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 597 598 r.seq++ 599 return result 600 } 601 602 func (r *rtl8720dn) rpc_le_get_gap_param(param RPC_T_GAP_LE_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 603 if r.debug { 604 fmt.Printf("rpc_le_get_gap_param()\r\n") 605 } 606 msg := startWriteMessage(0x00, 0x05, 0x05, uint32(r.seq)) 607 608 // param : in RPC_T_GAP_LE_PARAM_TYPE 609 msg = append(msg, byte(param>>0)) 610 msg = append(msg, byte(param>>8)) 611 msg = append(msg, byte(param>>16)) 612 msg = append(msg, byte(param>>24)) 613 614 r.performRequest(msg) 615 616 r.read() 617 widx := 8 618 // value : out []byte 619 value_length := binary.LittleEndian.Uint32(payload[widx:]) 620 widx += 4 621 if value_length > 0 { 622 copy(value, payload[widx:widx+int(value_length)]) 623 widx += int(value_length) 624 } 625 626 var result RPC_T_GAP_CAUSE 627 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 628 629 r.seq++ 630 return result 631 } 632 633 func (r *rtl8720dn) rpc_le_modify_white_list(operation RPC_T_GAP_WHITE_LIST_OP, bd_addr []uint8, bd_type RPC_T_GAP_REMOTE_ADDR_TYPE) RPC_T_GAP_CAUSE { 634 if r.debug { 635 fmt.Printf("rpc_le_modify_white_list()\r\n") 636 } 637 msg := startWriteMessage(0x00, 0x05, 0x06, uint32(r.seq)) 638 639 // operation : in RPC_T_GAP_WHITE_LIST_OP 640 msg = append(msg, byte(operation>>0)) 641 msg = append(msg, byte(operation>>8)) 642 msg = append(msg, byte(operation>>16)) 643 msg = append(msg, byte(operation>>24)) 644 // bd_addr : in []uint8 (6) 645 msg = append(msg, bd_addr...) 646 // bd_type : in RPC_T_GAP_REMOTE_ADDR_TYPE 647 msg = append(msg, byte(bd_type>>0)) 648 msg = append(msg, byte(bd_type>>8)) 649 msg = append(msg, byte(bd_type>>16)) 650 msg = append(msg, byte(bd_type>>24)) 651 652 r.performRequest(msg) 653 654 r.read() 655 widx := 8 656 657 var result RPC_T_GAP_CAUSE 658 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 659 660 r.seq++ 661 return result 662 } 663 664 func (r *rtl8720dn) rpc_le_gen_rand_addr(rand_addr_type RPC_T_GAP_RAND_ADDR_TYPE, random_bd []uint8) RPC_T_GAP_CAUSE { 665 if r.debug { 666 fmt.Printf("rpc_le_gen_rand_addr()\r\n") 667 } 668 msg := startWriteMessage(0x00, 0x05, 0x07, uint32(r.seq)) 669 670 // rand_addr_type : in RPC_T_GAP_RAND_ADDR_TYPE 671 msg = append(msg, byte(rand_addr_type>>0)) 672 msg = append(msg, byte(rand_addr_type>>8)) 673 msg = append(msg, byte(rand_addr_type>>16)) 674 msg = append(msg, byte(rand_addr_type>>24)) 675 676 r.performRequest(msg) 677 678 r.read() 679 widx := 8 680 // random_bd : out []uint8 (6) 681 copy(random_bd, payload[widx:widx+6]) 682 widx += 6 683 684 var result RPC_T_GAP_CAUSE 685 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 686 687 r.seq++ 688 return result 689 } 690 691 func (r *rtl8720dn) rpc_le_set_rand_addr(random_bd []uint8) RPC_T_GAP_CAUSE { 692 if r.debug { 693 fmt.Printf("rpc_le_set_rand_addr()\r\n") 694 } 695 msg := startWriteMessage(0x00, 0x05, 0x08, uint32(r.seq)) 696 697 // random_bd : in []uint8 (6) 698 msg = append(msg, random_bd...) 699 700 r.performRequest(msg) 701 702 r.read() 703 widx := 8 704 705 var result RPC_T_GAP_CAUSE 706 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 707 708 r.seq++ 709 return result 710 } 711 712 func (r *rtl8720dn) rpc_le_cfg_local_identity_address(addr []uint8, ident_addr_type RPC_T_GAP_IDENT_ADDR_TYPE) RPC_T_GAP_CAUSE { 713 if r.debug { 714 fmt.Printf("rpc_le_cfg_local_identity_address()\r\n") 715 } 716 msg := startWriteMessage(0x00, 0x05, 0x09, uint32(r.seq)) 717 718 // addr : in []uint8 (6) 719 msg = append(msg, addr...) 720 // ident_addr_type : in RPC_T_GAP_IDENT_ADDR_TYPE 721 msg = append(msg, byte(ident_addr_type>>0)) 722 msg = append(msg, byte(ident_addr_type>>8)) 723 msg = append(msg, byte(ident_addr_type>>16)) 724 msg = append(msg, byte(ident_addr_type>>24)) 725 726 r.performRequest(msg) 727 728 r.read() 729 widx := 8 730 731 var result RPC_T_GAP_CAUSE 732 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 733 734 r.seq++ 735 return result 736 } 737 738 func (r *rtl8720dn) rpc_le_set_host_chann_classif(p_channel_map uint8) RPC_T_GAP_CAUSE { 739 if r.debug { 740 fmt.Printf("rpc_le_set_host_chann_classif()\r\n") 741 } 742 msg := startWriteMessage(0x00, 0x05, 0x0A, uint32(r.seq)) 743 744 // p_channel_map : in uint8 745 msg = append(msg, byte(p_channel_map>>0)) 746 747 r.performRequest(msg) 748 749 r.read() 750 widx := 8 751 752 var result RPC_T_GAP_CAUSE 753 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 754 755 r.seq++ 756 return result 757 } 758 759 func (r *rtl8720dn) rpc_le_write_default_data_len(tx_octets uint16, tx_time uint16) RPC_T_GAP_CAUSE { 760 if r.debug { 761 fmt.Printf("rpc_le_write_default_data_len()\r\n") 762 } 763 msg := startWriteMessage(0x00, 0x05, 0x0B, uint32(r.seq)) 764 765 // tx_octets : in uint16 766 msg = append(msg, byte(tx_octets>>0)) 767 msg = append(msg, byte(tx_octets>>8)) 768 // tx_time : in uint16 769 msg = append(msg, byte(tx_time>>0)) 770 msg = append(msg, byte(tx_time>>8)) 771 772 r.performRequest(msg) 773 774 r.read() 775 widx := 8 776 777 var result RPC_T_GAP_CAUSE 778 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 779 780 r.seq++ 781 return result 782 } 783 784 func (r *rtl8720dn) rpc_gap_config_cccd_not_check(cccd_not_check_flag RPC_T_GAP_CONFIG_GATT_CCCD_NOT_CHECK) { 785 if r.debug { 786 fmt.Printf("rpc_gap_config_cccd_not_check()\r\n") 787 } 788 msg := startWriteMessage(0x00, 0x06, 0x01, uint32(r.seq)) 789 790 // cccd_not_check_flag : in RPC_T_GAP_CONFIG_GATT_CCCD_NOT_CHECK 791 msg = append(msg, byte(cccd_not_check_flag>>0)) 792 msg = append(msg, byte(cccd_not_check_flag>>8)) 793 msg = append(msg, byte(cccd_not_check_flag>>16)) 794 msg = append(msg, byte(cccd_not_check_flag>>24)) 795 796 r.performRequest(msg) 797 798 r.read() 799 800 r.seq++ 801 return 802 } 803 804 func (r *rtl8720dn) rpc_gap_config_ccc_bits_count(gatt_server_ccc_bits_count uint8, gatt_storage_ccc_bits_count uint8) { 805 if r.debug { 806 fmt.Printf("rpc_gap_config_ccc_bits_count()\r\n") 807 } 808 msg := startWriteMessage(0x00, 0x06, 0x02, uint32(r.seq)) 809 810 // gatt_server_ccc_bits_count : in uint8 811 msg = append(msg, byte(gatt_server_ccc_bits_count>>0)) 812 // gatt_storage_ccc_bits_count : in uint8 813 msg = append(msg, byte(gatt_storage_ccc_bits_count>>0)) 814 815 r.performRequest(msg) 816 817 r.read() 818 819 r.seq++ 820 return 821 } 822 823 func (r *rtl8720dn) rpc_gap_config_max_attribute_table_count(gatt_max_attribute_table_count uint8) { 824 if r.debug { 825 fmt.Printf("rpc_gap_config_max_attribute_table_count()\r\n") 826 } 827 msg := startWriteMessage(0x00, 0x06, 0x03, uint32(r.seq)) 828 829 // gatt_max_attribute_table_count : in uint8 830 msg = append(msg, byte(gatt_max_attribute_table_count>>0)) 831 832 r.performRequest(msg) 833 834 r.read() 835 836 r.seq++ 837 return 838 } 839 840 func (r *rtl8720dn) rpc_gap_config_max_mtu_size(att_max_mtu_size uint16) { 841 if r.debug { 842 fmt.Printf("rpc_gap_config_max_mtu_size()\r\n") 843 } 844 msg := startWriteMessage(0x00, 0x06, 0x04, uint32(r.seq)) 845 846 // att_max_mtu_size : in uint16 847 msg = append(msg, byte(att_max_mtu_size>>0)) 848 msg = append(msg, byte(att_max_mtu_size>>8)) 849 850 r.performRequest(msg) 851 852 r.read() 853 854 r.seq++ 855 return 856 } 857 858 func (r *rtl8720dn) rpc_gap_config_bte_pool_size(bte_pool_size uint8) { 859 if r.debug { 860 fmt.Printf("rpc_gap_config_bte_pool_size()\r\n") 861 } 862 msg := startWriteMessage(0x00, 0x06, 0x05, uint32(r.seq)) 863 864 // bte_pool_size : in uint8 865 msg = append(msg, byte(bte_pool_size>>0)) 866 867 r.performRequest(msg) 868 869 r.read() 870 871 r.seq++ 872 return 873 } 874 875 func (r *rtl8720dn) rpc_gap_config_bt_report_buf_num(bt_report_buf_num uint8) { 876 if r.debug { 877 fmt.Printf("rpc_gap_config_bt_report_buf_num()\r\n") 878 } 879 msg := startWriteMessage(0x00, 0x06, 0x06, uint32(r.seq)) 880 881 // bt_report_buf_num : in uint8 882 msg = append(msg, byte(bt_report_buf_num>>0)) 883 884 r.performRequest(msg) 885 886 r.read() 887 888 r.seq++ 889 return 890 } 891 892 func (r *rtl8720dn) rpc_gap_config_le_key_storage_flag(le_key_storage_flag uint16) { 893 if r.debug { 894 fmt.Printf("rpc_gap_config_le_key_storage_flag()\r\n") 895 } 896 msg := startWriteMessage(0x00, 0x06, 0x07, uint32(r.seq)) 897 898 // le_key_storage_flag : in uint16 899 msg = append(msg, byte(le_key_storage_flag>>0)) 900 msg = append(msg, byte(le_key_storage_flag>>8)) 901 902 r.performRequest(msg) 903 904 r.read() 905 906 r.seq++ 907 return 908 } 909 910 func (r *rtl8720dn) rpc_gap_config_max_le_paired_device(max_le_paired_device uint8) { 911 if r.debug { 912 fmt.Printf("rpc_gap_config_max_le_paired_device()\r\n") 913 } 914 msg := startWriteMessage(0x00, 0x06, 0x08, uint32(r.seq)) 915 916 // max_le_paired_device : in uint8 917 msg = append(msg, byte(max_le_paired_device>>0)) 918 919 r.performRequest(msg) 920 921 r.read() 922 923 r.seq++ 924 return 925 } 926 927 func (r *rtl8720dn) rpc_gap_config_max_le_link_num(le_link_num uint8) { 928 if r.debug { 929 fmt.Printf("rpc_gap_config_max_le_link_num()\r\n") 930 } 931 msg := startWriteMessage(0x00, 0x06, 0x09, uint32(r.seq)) 932 933 // le_link_num : in uint8 934 msg = append(msg, byte(le_link_num>>0)) 935 936 r.performRequest(msg) 937 938 r.read() 939 940 r.seq++ 941 return 942 } 943 944 func (r *rtl8720dn) rpc_le_adv_set_param(param RPC_T_LE_ADV_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 945 if r.debug { 946 fmt.Printf("rpc_le_adv_set_param()\r\n") 947 } 948 msg := startWriteMessage(0x00, 0x07, 0x01, uint32(r.seq)) 949 950 // param : in RPC_T_LE_ADV_PARAM_TYPE 951 msg = append(msg, byte(param>>0)) 952 msg = append(msg, byte(param>>8)) 953 msg = append(msg, byte(param>>16)) 954 msg = append(msg, byte(param>>24)) 955 // value : in []byte 956 msg = append(msg, byte(len(value)), byte(len(value)>>8), byte(len(value)>>16), byte(len(value)>>24)) 957 msg = append(msg, []byte(value)...) 958 959 r.performRequest(msg) 960 961 r.read() 962 widx := 8 963 964 var result RPC_T_GAP_CAUSE 965 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 966 967 r.seq++ 968 return result 969 } 970 971 func (r *rtl8720dn) rpc_le_adv_get_param(param RPC_T_LE_ADV_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 972 if r.debug { 973 fmt.Printf("rpc_le_adv_get_param()\r\n") 974 } 975 msg := startWriteMessage(0x00, 0x07, 0x02, uint32(r.seq)) 976 977 // param : in RPC_T_LE_ADV_PARAM_TYPE 978 msg = append(msg, byte(param>>0)) 979 msg = append(msg, byte(param>>8)) 980 msg = append(msg, byte(param>>16)) 981 msg = append(msg, byte(param>>24)) 982 983 r.performRequest(msg) 984 985 r.read() 986 widx := 8 987 // value : out []byte 988 value_length := binary.LittleEndian.Uint32(payload[widx:]) 989 widx += 4 990 if value_length > 0 { 991 copy(value, payload[widx:widx+int(value_length)]) 992 widx += int(value_length) 993 } 994 995 var result RPC_T_GAP_CAUSE 996 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 997 998 r.seq++ 999 return result 1000 } 1001 1002 func (r *rtl8720dn) rpc_le_adv_start() RPC_T_GAP_CAUSE { 1003 if r.debug { 1004 fmt.Printf("rpc_le_adv_start()\r\n") 1005 } 1006 msg := startWriteMessage(0x00, 0x07, 0x03, uint32(r.seq)) 1007 1008 r.performRequest(msg) 1009 1010 r.read() 1011 widx := 8 1012 var result RPC_T_GAP_CAUSE 1013 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1014 1015 r.seq++ 1016 return result 1017 } 1018 1019 func (r *rtl8720dn) rpc_le_adv_stop() RPC_T_GAP_CAUSE { 1020 if r.debug { 1021 fmt.Printf("rpc_le_adv_stop()\r\n") 1022 } 1023 msg := startWriteMessage(0x00, 0x07, 0x04, uint32(r.seq)) 1024 1025 r.performRequest(msg) 1026 1027 r.read() 1028 widx := 8 1029 var result RPC_T_GAP_CAUSE 1030 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1031 1032 r.seq++ 1033 return result 1034 } 1035 1036 func (r *rtl8720dn) rpc_le_adv_update_param() RPC_T_GAP_CAUSE { 1037 if r.debug { 1038 fmt.Printf("rpc_le_adv_update_param()\r\n") 1039 } 1040 msg := startWriteMessage(0x00, 0x07, 0x05, uint32(r.seq)) 1041 1042 r.performRequest(msg) 1043 1044 r.read() 1045 widx := 8 1046 var result RPC_T_GAP_CAUSE 1047 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1048 1049 r.seq++ 1050 return result 1051 } 1052 1053 func (r *rtl8720dn) rpc_le_scan_set_param(param RPC_T_LE_SCAN_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 1054 if r.debug { 1055 fmt.Printf("rpc_le_scan_set_param()\r\n") 1056 } 1057 msg := startWriteMessage(0x00, 0x08, 0x01, uint32(r.seq)) 1058 1059 // param : in RPC_T_LE_SCAN_PARAM_TYPE 1060 msg = append(msg, byte(param>>0)) 1061 msg = append(msg, byte(param>>8)) 1062 msg = append(msg, byte(param>>16)) 1063 msg = append(msg, byte(param>>24)) 1064 // value : in []byte 1065 msg = append(msg, byte(len(value)), byte(len(value)>>8), byte(len(value)>>16), byte(len(value)>>24)) 1066 msg = append(msg, []byte(value)...) 1067 1068 r.performRequest(msg) 1069 1070 r.read() 1071 widx := 8 1072 1073 var result RPC_T_GAP_CAUSE 1074 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1075 1076 r.seq++ 1077 return result 1078 } 1079 1080 func (r *rtl8720dn) rpc_le_scan_get_param(param RPC_T_LE_SCAN_PARAM_TYPE, value []byte) RPC_T_GAP_CAUSE { 1081 if r.debug { 1082 fmt.Printf("rpc_le_scan_get_param()\r\n") 1083 } 1084 msg := startWriteMessage(0x00, 0x08, 0x02, uint32(r.seq)) 1085 1086 // param : in RPC_T_LE_SCAN_PARAM_TYPE 1087 msg = append(msg, byte(param>>0)) 1088 msg = append(msg, byte(param>>8)) 1089 msg = append(msg, byte(param>>16)) 1090 msg = append(msg, byte(param>>24)) 1091 1092 r.performRequest(msg) 1093 1094 r.read() 1095 widx := 8 1096 // value : out []byte 1097 value_length := binary.LittleEndian.Uint32(payload[widx:]) 1098 widx += 4 1099 if value_length > 0 { 1100 copy(value, payload[widx:widx+int(value_length)]) 1101 widx += int(value_length) 1102 } 1103 1104 var result RPC_T_GAP_CAUSE 1105 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1106 1107 r.seq++ 1108 return result 1109 } 1110 1111 func (r *rtl8720dn) rpc_le_scan_start() RPC_T_GAP_CAUSE { 1112 if r.debug { 1113 fmt.Printf("rpc_le_scan_start()\r\n") 1114 } 1115 msg := startWriteMessage(0x00, 0x08, 0x03, uint32(r.seq)) 1116 1117 r.performRequest(msg) 1118 1119 r.read() 1120 widx := 8 1121 var result RPC_T_GAP_CAUSE 1122 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1123 1124 r.seq++ 1125 return result 1126 } 1127 1128 func (r *rtl8720dn) rpc_le_scan_timer_start(tick uint32) RPC_T_GAP_CAUSE { 1129 if r.debug { 1130 fmt.Printf("rpc_le_scan_timer_start()\r\n") 1131 } 1132 msg := startWriteMessage(0x00, 0x08, 0x04, uint32(r.seq)) 1133 1134 // tick : in uint32 1135 msg = append(msg, byte(tick>>0)) 1136 msg = append(msg, byte(tick>>8)) 1137 msg = append(msg, byte(tick>>16)) 1138 msg = append(msg, byte(tick>>24)) 1139 1140 r.performRequest(msg) 1141 1142 r.read() 1143 widx := 8 1144 1145 var result RPC_T_GAP_CAUSE 1146 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1147 1148 r.seq++ 1149 return result 1150 } 1151 1152 func (r *rtl8720dn) rpc_le_scan_stop() RPC_T_GAP_CAUSE { 1153 if r.debug { 1154 fmt.Printf("rpc_le_scan_stop()\r\n") 1155 } 1156 msg := startWriteMessage(0x00, 0x08, 0x05, uint32(r.seq)) 1157 1158 r.performRequest(msg) 1159 1160 r.read() 1161 widx := 8 1162 var result RPC_T_GAP_CAUSE 1163 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1164 1165 r.seq++ 1166 return result 1167 } 1168 1169 func (r *rtl8720dn) rpc_le_scan_info_filter(enable bool, offset uint8, length uint8, p_filter []uint8) bool { 1170 if r.debug { 1171 fmt.Printf("rpc_le_scan_info_filter()\r\n") 1172 } 1173 msg := startWriteMessage(0x00, 0x08, 0x06, uint32(r.seq)) 1174 1175 // enable : in bool 1176 if enable { 1177 msg = append(msg, 1) 1178 } else { 1179 msg = append(msg, 0) 1180 } 1181 // offset : in uint8 1182 msg = append(msg, byte(offset>>0)) 1183 // length : in uint8 1184 msg = append(msg, byte(length>>0)) 1185 // p_filter : in []uint8 (31) 1186 msg = append(msg, p_filter...) 1187 1188 r.performRequest(msg) 1189 1190 r.read() 1191 widx := 8 1192 1193 var result bool 1194 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1195 1196 r.seq++ 1197 return result 1198 } 1199 1200 func (r *rtl8720dn) rpc_le_get_conn_param(param RPC_T_LE_CONN_PARAM_TYPE, value []byte, conn_id uint8) RPC_T_GAP_CAUSE { 1201 if r.debug { 1202 fmt.Printf("rpc_le_get_conn_param()\r\n") 1203 } 1204 msg := startWriteMessage(0x00, 0x09, 0x01, uint32(r.seq)) 1205 1206 // param : in RPC_T_LE_CONN_PARAM_TYPE 1207 msg = append(msg, byte(param>>0)) 1208 msg = append(msg, byte(param>>8)) 1209 msg = append(msg, byte(param>>16)) 1210 msg = append(msg, byte(param>>24)) 1211 // conn_id : in uint8 1212 msg = append(msg, byte(conn_id>>0)) 1213 1214 r.performRequest(msg) 1215 1216 r.read() 1217 widx := 8 1218 // value : out []byte 1219 value_length := binary.LittleEndian.Uint32(payload[widx:]) 1220 widx += 4 1221 if value_length > 0 { 1222 copy(value, payload[widx:widx+int(value_length)]) 1223 widx += int(value_length) 1224 } 1225 1226 var result RPC_T_GAP_CAUSE 1227 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1228 1229 r.seq++ 1230 return result 1231 } 1232 1233 func (r *rtl8720dn) rpc_le_get_conn_info(conn_id uint8, p_conn_info RPC_T_GAP_CONN_INFO) bool { 1234 if r.debug { 1235 fmt.Printf("rpc_le_get_conn_info()\r\n") 1236 } 1237 msg := startWriteMessage(0x00, 0x09, 0x02, uint32(r.seq)) 1238 1239 // conn_id : in uint8 1240 msg = append(msg, byte(conn_id>>0)) 1241 1242 r.performRequest(msg) 1243 1244 r.read() 1245 widx := 8 1246 // p_conn_info : out RPC_T_GAP_CONN_INFO 1247 // not impl (a.Size() > 0) 1248 1249 var result bool 1250 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1251 1252 r.seq++ 1253 return result 1254 } 1255 1256 func (r *rtl8720dn) rpc_le_get_conn_addr(conn_id uint8, bd_addr []uint8, bd_type *uint8) bool { 1257 if r.debug { 1258 fmt.Printf("rpc_le_get_conn_addr()\r\n") 1259 } 1260 msg := startWriteMessage(0x00, 0x09, 0x03, uint32(r.seq)) 1261 1262 // conn_id : in uint8 1263 msg = append(msg, byte(conn_id>>0)) 1264 1265 r.performRequest(msg) 1266 1267 r.read() 1268 widx := 8 1269 // bd_addr : out []uint8 (6) 1270 copy(bd_addr, payload[widx:widx+6]) 1271 widx += 6 1272 // bd_type : out uint8 1273 *bd_type = payload[widx] 1274 widx += 1 1275 1276 var result bool 1277 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1278 1279 r.seq++ 1280 return result 1281 } 1282 1283 func (r *rtl8720dn) rpc_le_get_conn_id(bd_addr []uint8, bd_type uint8, p_conn_id *uint8) bool { 1284 if r.debug { 1285 fmt.Printf("rpc_le_get_conn_id()\r\n") 1286 } 1287 msg := startWriteMessage(0x00, 0x09, 0x04, uint32(r.seq)) 1288 1289 // bd_addr : in []uint8 (6) 1290 msg = append(msg, bd_addr...) 1291 // bd_type : in uint8 1292 msg = append(msg, byte(bd_type>>0)) 1293 1294 r.performRequest(msg) 1295 1296 r.read() 1297 widx := 8 1298 // p_conn_id : out uint8 1299 *p_conn_id = payload[widx] 1300 widx += 1 1301 1302 var result bool 1303 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1304 1305 r.seq++ 1306 return result 1307 } 1308 1309 func (r *rtl8720dn) rpc_le_get_active_link_num() uint8 { 1310 if r.debug { 1311 fmt.Printf("rpc_le_get_active_link_num()\r\n") 1312 } 1313 msg := startWriteMessage(0x00, 0x09, 0x05, uint32(r.seq)) 1314 1315 r.performRequest(msg) 1316 1317 r.read() 1318 widx := 8 1319 var result uint8 1320 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 1321 1322 r.seq++ 1323 return result 1324 } 1325 1326 func (r *rtl8720dn) rpc_le_get_idle_link_num() uint8 { 1327 if r.debug { 1328 fmt.Printf("rpc_le_get_idle_link_num()\r\n") 1329 } 1330 msg := startWriteMessage(0x00, 0x09, 0x06, uint32(r.seq)) 1331 1332 r.performRequest(msg) 1333 1334 r.read() 1335 widx := 8 1336 var result uint8 1337 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 1338 1339 r.seq++ 1340 return result 1341 } 1342 1343 func (r *rtl8720dn) rpc_le_disconnect(conn_id uint8) RPC_T_GAP_CAUSE { 1344 if r.debug { 1345 fmt.Printf("rpc_le_disconnect()\r\n") 1346 } 1347 msg := startWriteMessage(0x00, 0x09, 0x07, uint32(r.seq)) 1348 1349 // conn_id : in uint8 1350 msg = append(msg, byte(conn_id>>0)) 1351 1352 r.performRequest(msg) 1353 1354 r.read() 1355 widx := 8 1356 1357 var result RPC_T_GAP_CAUSE 1358 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1359 1360 r.seq++ 1361 return result 1362 } 1363 1364 func (r *rtl8720dn) rpc_le_read_rssi(conn_id uint8) RPC_T_GAP_CAUSE { 1365 if r.debug { 1366 fmt.Printf("rpc_le_read_rssi()\r\n") 1367 } 1368 msg := startWriteMessage(0x00, 0x09, 0x08, uint32(r.seq)) 1369 1370 // conn_id : in uint8 1371 msg = append(msg, byte(conn_id>>0)) 1372 1373 r.performRequest(msg) 1374 1375 r.read() 1376 widx := 8 1377 1378 var result RPC_T_GAP_CAUSE 1379 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1380 1381 r.seq++ 1382 return result 1383 } 1384 1385 func (r *rtl8720dn) rpc_le_set_data_len(conn_id uint8, tx_octets uint16, tx_time uint16) RPC_T_GAP_CAUSE { 1386 if r.debug { 1387 fmt.Printf("rpc_le_set_data_len()\r\n") 1388 } 1389 msg := startWriteMessage(0x00, 0x09, 0x09, uint32(r.seq)) 1390 1391 // conn_id : in uint8 1392 msg = append(msg, byte(conn_id>>0)) 1393 // tx_octets : in uint16 1394 msg = append(msg, byte(tx_octets>>0)) 1395 msg = append(msg, byte(tx_octets>>8)) 1396 // tx_time : in uint16 1397 msg = append(msg, byte(tx_time>>0)) 1398 msg = append(msg, byte(tx_time>>8)) 1399 1400 r.performRequest(msg) 1401 1402 r.read() 1403 widx := 8 1404 1405 var result RPC_T_GAP_CAUSE 1406 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1407 1408 r.seq++ 1409 return result 1410 } 1411 1412 func (r *rtl8720dn) rpc_le_set_phy(conn_id uint8, all_phys uint8, tx_phys uint8, rx_phys uint8, phy_options RPC_T_GAP_PHYS_OPTIONS) RPC_T_GAP_CAUSE { 1413 if r.debug { 1414 fmt.Printf("rpc_le_set_phy()\r\n") 1415 } 1416 msg := startWriteMessage(0x00, 0x09, 0x0A, uint32(r.seq)) 1417 1418 // conn_id : in uint8 1419 msg = append(msg, byte(conn_id>>0)) 1420 // all_phys : in uint8 1421 msg = append(msg, byte(all_phys>>0)) 1422 // tx_phys : in uint8 1423 msg = append(msg, byte(tx_phys>>0)) 1424 // rx_phys : in uint8 1425 msg = append(msg, byte(rx_phys>>0)) 1426 // phy_options : in RPC_T_GAP_PHYS_OPTIONS 1427 msg = append(msg, byte(phy_options>>0)) 1428 msg = append(msg, byte(phy_options>>8)) 1429 msg = append(msg, byte(phy_options>>16)) 1430 msg = append(msg, byte(phy_options>>24)) 1431 1432 r.performRequest(msg) 1433 1434 r.read() 1435 widx := 8 1436 1437 var result RPC_T_GAP_CAUSE 1438 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1439 1440 r.seq++ 1441 return result 1442 } 1443 1444 func (r *rtl8720dn) rpc_le_set_conn_param(conn_type RPC_T_GAP_CONN_PARAM_TYPE, p_conn_param RPC_T_GAP_LE_CONN_REQ_PARAM) RPC_T_GAP_CAUSE { 1445 if r.debug { 1446 fmt.Printf("rpc_le_set_conn_param()\r\n") 1447 } 1448 msg := startWriteMessage(0x00, 0x09, 0x0B, uint32(r.seq)) 1449 1450 // conn_type : in RPC_T_GAP_CONN_PARAM_TYPE 1451 msg = append(msg, byte(conn_type>>0)) 1452 msg = append(msg, byte(conn_type>>8)) 1453 msg = append(msg, byte(conn_type>>16)) 1454 msg = append(msg, byte(conn_type>>24)) 1455 // p_conn_param : in RPC_T_GAP_LE_CONN_REQ_PARAM 1456 msg = append(msg, byte(p_conn_param>>0)) 1457 msg = append(msg, byte(p_conn_param>>8)) 1458 msg = append(msg, byte(p_conn_param>>16)) 1459 msg = append(msg, byte(p_conn_param>>24)) 1460 1461 r.performRequest(msg) 1462 1463 r.read() 1464 widx := 8 1465 1466 var result RPC_T_GAP_CAUSE 1467 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1468 1469 r.seq++ 1470 return result 1471 } 1472 1473 func (r *rtl8720dn) rpc_le_connect(init_phys uint8, remote_bd []uint8, remote_bd_type RPC_T_GAP_REMOTE_ADDR_TYPE, local_bd_type RPC_T_GAP_LOCAL_ADDR_TYPE, scan_timeout uint16) RPC_T_GAP_CAUSE { 1474 if r.debug { 1475 fmt.Printf("rpc_le_connect()\r\n") 1476 } 1477 msg := startWriteMessage(0x00, 0x09, 0x0C, uint32(r.seq)) 1478 1479 // init_phys : in uint8 1480 msg = append(msg, byte(init_phys>>0)) 1481 // remote_bd : in []uint8 (6) 1482 msg = append(msg, remote_bd...) 1483 // remote_bd_type : in RPC_T_GAP_REMOTE_ADDR_TYPE 1484 msg = append(msg, byte(remote_bd_type>>0)) 1485 msg = append(msg, byte(remote_bd_type>>8)) 1486 msg = append(msg, byte(remote_bd_type>>16)) 1487 msg = append(msg, byte(remote_bd_type>>24)) 1488 // local_bd_type : in RPC_T_GAP_LOCAL_ADDR_TYPE 1489 msg = append(msg, byte(local_bd_type>>0)) 1490 msg = append(msg, byte(local_bd_type>>8)) 1491 msg = append(msg, byte(local_bd_type>>16)) 1492 msg = append(msg, byte(local_bd_type>>24)) 1493 // scan_timeout : in uint16 1494 msg = append(msg, byte(scan_timeout>>0)) 1495 msg = append(msg, byte(scan_timeout>>8)) 1496 1497 r.performRequest(msg) 1498 1499 r.read() 1500 widx := 8 1501 1502 var result RPC_T_GAP_CAUSE 1503 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1504 1505 r.seq++ 1506 return result 1507 } 1508 1509 func (r *rtl8720dn) rpc_le_update_conn_param(conn_id uint8, conn_interval_min uint16, conn_interval_max uint16, conn_latency uint16, supervision_timeout uint16, ce_length_min uint16, ce_length_max uint16) RPC_T_GAP_CAUSE { 1510 if r.debug { 1511 fmt.Printf("rpc_le_update_conn_param()\r\n") 1512 } 1513 msg := startWriteMessage(0x00, 0x09, 0x0D, uint32(r.seq)) 1514 1515 // conn_id : in uint8 1516 msg = append(msg, byte(conn_id>>0)) 1517 // conn_interval_min : in uint16 1518 msg = append(msg, byte(conn_interval_min>>0)) 1519 msg = append(msg, byte(conn_interval_min>>8)) 1520 // conn_interval_max : in uint16 1521 msg = append(msg, byte(conn_interval_max>>0)) 1522 msg = append(msg, byte(conn_interval_max>>8)) 1523 // conn_latency : in uint16 1524 msg = append(msg, byte(conn_latency>>0)) 1525 msg = append(msg, byte(conn_latency>>8)) 1526 // supervision_timeout : in uint16 1527 msg = append(msg, byte(supervision_timeout>>0)) 1528 msg = append(msg, byte(supervision_timeout>>8)) 1529 // ce_length_min : in uint16 1530 msg = append(msg, byte(ce_length_min>>0)) 1531 msg = append(msg, byte(ce_length_min>>8)) 1532 // ce_length_max : in uint16 1533 msg = append(msg, byte(ce_length_max>>0)) 1534 msg = append(msg, byte(ce_length_max>>8)) 1535 1536 r.performRequest(msg) 1537 1538 r.read() 1539 widx := 8 1540 1541 var result RPC_T_GAP_CAUSE 1542 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 1543 1544 r.seq++ 1545 return result 1546 } 1547 1548 func (r *rtl8720dn) rpc_flash_save_local_name(p_data RPC_T_LOCAL_NAME) uint32 { 1549 if r.debug { 1550 fmt.Printf("rpc_flash_save_local_name()\r\n") 1551 } 1552 msg := startWriteMessage(0x00, 0x0A, 0x01, uint32(r.seq)) 1553 1554 // p_data : in RPC_T_LOCAL_NAME 1555 msg = append(msg, byte(p_data>>0)) 1556 msg = append(msg, byte(p_data>>8)) 1557 msg = append(msg, byte(p_data>>16)) 1558 msg = append(msg, byte(p_data>>24)) 1559 1560 r.performRequest(msg) 1561 1562 r.read() 1563 widx := 8 1564 1565 var result uint32 1566 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 1567 1568 r.seq++ 1569 return result 1570 } 1571 1572 func (r *rtl8720dn) rpc_flash_load_local_name(p_data RPC_T_LOCAL_NAME) uint32 { 1573 if r.debug { 1574 fmt.Printf("rpc_flash_load_local_name()\r\n") 1575 } 1576 msg := startWriteMessage(0x00, 0x0A, 0x02, uint32(r.seq)) 1577 1578 r.performRequest(msg) 1579 1580 r.read() 1581 widx := 8 1582 // p_data : out RPC_T_LOCAL_NAME 1583 // not impl (a.Size() > 0) 1584 1585 var result uint32 1586 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 1587 1588 r.seq++ 1589 return result 1590 } 1591 1592 func (r *rtl8720dn) rpc_flash_save_local_appearance(p_data RPC_T_LOCAL_APPEARANCE) uint32 { 1593 if r.debug { 1594 fmt.Printf("rpc_flash_save_local_appearance()\r\n") 1595 } 1596 msg := startWriteMessage(0x00, 0x0A, 0x03, uint32(r.seq)) 1597 1598 // p_data : in RPC_T_LOCAL_APPEARANCE 1599 msg = append(msg, byte(p_data>>0)) 1600 msg = append(msg, byte(p_data>>8)) 1601 msg = append(msg, byte(p_data>>16)) 1602 msg = append(msg, byte(p_data>>24)) 1603 1604 r.performRequest(msg) 1605 1606 r.read() 1607 widx := 8 1608 1609 var result uint32 1610 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 1611 1612 r.seq++ 1613 return result 1614 } 1615 1616 func (r *rtl8720dn) rpc_flash_load_local_appearance(p_data RPC_T_LOCAL_APPEARANCE) uint32 { 1617 if r.debug { 1618 fmt.Printf("rpc_flash_load_local_appearance()\r\n") 1619 } 1620 msg := startWriteMessage(0x00, 0x0A, 0x04, uint32(r.seq)) 1621 1622 r.performRequest(msg) 1623 1624 r.read() 1625 widx := 8 1626 // p_data : out RPC_T_LOCAL_APPEARANCE 1627 // not impl (a.Size() > 0) 1628 1629 var result uint32 1630 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 1631 1632 r.seq++ 1633 return result 1634 } 1635 1636 func (r *rtl8720dn) rpc_le_find_key_entry(bd_addr []uint8, bd_type RPC_T_GAP_REMOTE_ADDR_TYPE) RPC_T_LE_KEY_ENTRY { 1637 if r.debug { 1638 fmt.Printf("rpc_le_find_key_entry()\r\n") 1639 } 1640 msg := startWriteMessage(0x00, 0x0A, 0x05, uint32(r.seq)) 1641 1642 // bd_addr : in []uint8 (6) 1643 msg = append(msg, bd_addr...) 1644 // bd_type : in RPC_T_GAP_REMOTE_ADDR_TYPE 1645 msg = append(msg, byte(bd_type>>0)) 1646 msg = append(msg, byte(bd_type>>8)) 1647 msg = append(msg, byte(bd_type>>16)) 1648 msg = append(msg, byte(bd_type>>24)) 1649 1650 r.performRequest(msg) 1651 1652 r.read() 1653 widx := 8 1654 1655 var result RPC_T_LE_KEY_ENTRY 1656 result = RPC_T_LE_KEY_ENTRY(binary.LittleEndian.Uint32(payload[widx:])) 1657 1658 r.seq++ 1659 return result 1660 } 1661 1662 func (r *rtl8720dn) rpc_le_find_key_entry_by_idx(idx uint8) RPC_T_LE_KEY_ENTRY { 1663 if r.debug { 1664 fmt.Printf("rpc_le_find_key_entry_by_idx()\r\n") 1665 } 1666 msg := startWriteMessage(0x00, 0x0A, 0x06, uint32(r.seq)) 1667 1668 // idx : in uint8 1669 msg = append(msg, byte(idx>>0)) 1670 1671 r.performRequest(msg) 1672 1673 r.read() 1674 widx := 8 1675 1676 var result RPC_T_LE_KEY_ENTRY 1677 result = RPC_T_LE_KEY_ENTRY(binary.LittleEndian.Uint32(payload[widx:])) 1678 1679 r.seq++ 1680 return result 1681 } 1682 1683 func (r *rtl8720dn) rpc_le_get_bond_dev_num() uint8 { 1684 if r.debug { 1685 fmt.Printf("rpc_le_get_bond_dev_num()\r\n") 1686 } 1687 msg := startWriteMessage(0x00, 0x0A, 0x07, uint32(r.seq)) 1688 1689 r.performRequest(msg) 1690 1691 r.read() 1692 widx := 8 1693 var result uint8 1694 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 1695 1696 r.seq++ 1697 return result 1698 } 1699 1700 func (r *rtl8720dn) rpc_le_get_low_priority_bond() RPC_T_LE_KEY_ENTRY { 1701 if r.debug { 1702 fmt.Printf("rpc_le_get_low_priority_bond()\r\n") 1703 } 1704 msg := startWriteMessage(0x00, 0x0A, 0x08, uint32(r.seq)) 1705 1706 r.performRequest(msg) 1707 1708 r.read() 1709 widx := 8 1710 var result RPC_T_LE_KEY_ENTRY 1711 result = RPC_T_LE_KEY_ENTRY(binary.LittleEndian.Uint32(payload[widx:])) 1712 1713 r.seq++ 1714 return result 1715 } 1716 1717 func (r *rtl8720dn) rpc_le_get_high_priority_bond() RPC_T_LE_KEY_ENTRY { 1718 if r.debug { 1719 fmt.Printf("rpc_le_get_high_priority_bond()\r\n") 1720 } 1721 msg := startWriteMessage(0x00, 0x0A, 0x09, uint32(r.seq)) 1722 1723 r.performRequest(msg) 1724 1725 r.read() 1726 widx := 8 1727 var result RPC_T_LE_KEY_ENTRY 1728 result = RPC_T_LE_KEY_ENTRY(binary.LittleEndian.Uint32(payload[widx:])) 1729 1730 r.seq++ 1731 return result 1732 } 1733 1734 func (r *rtl8720dn) rpc_le_set_high_priority_bond(bd_addr []uint8, bd_type RPC_T_GAP_REMOTE_ADDR_TYPE) bool { 1735 if r.debug { 1736 fmt.Printf("rpc_le_set_high_priority_bond()\r\n") 1737 } 1738 msg := startWriteMessage(0x00, 0x0A, 0x0A, uint32(r.seq)) 1739 1740 // bd_addr : in []uint8 (6) 1741 msg = append(msg, bd_addr...) 1742 // bd_type : in RPC_T_GAP_REMOTE_ADDR_TYPE 1743 msg = append(msg, byte(bd_type>>0)) 1744 msg = append(msg, byte(bd_type>>8)) 1745 msg = append(msg, byte(bd_type>>16)) 1746 msg = append(msg, byte(bd_type>>24)) 1747 1748 r.performRequest(msg) 1749 1750 r.read() 1751 widx := 8 1752 1753 var result bool 1754 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1755 1756 r.seq++ 1757 return result 1758 } 1759 1760 func (r *rtl8720dn) rpc_le_resolve_random_address(unresolved_addr []uint8, resolved_addr []uint8, resolved_addr_type RPC_T_GAP_IDENT_ADDR_TYPE) bool { 1761 if r.debug { 1762 fmt.Printf("rpc_le_resolve_random_address()\r\n") 1763 } 1764 msg := startWriteMessage(0x00, 0x0A, 0x0B, uint32(r.seq)) 1765 1766 // unresolved_addr : in []uint8 (6) 1767 msg = append(msg, unresolved_addr...) 1768 // resolved_addr : inout []uint8 (6) 1769 msg = append(msg, resolved_addr...) 1770 // resolved_addr_type : inout RPC_T_GAP_IDENT_ADDR_TYPE 1771 msg = append(msg, byte(resolved_addr_type>>0)) 1772 msg = append(msg, byte(resolved_addr_type>>8)) 1773 msg = append(msg, byte(resolved_addr_type>>16)) 1774 msg = append(msg, byte(resolved_addr_type>>24)) 1775 1776 r.performRequest(msg) 1777 1778 r.read() 1779 widx := 8 1780 // resolved_addr : inout []uint8 (6) 1781 copy(resolved_addr, payload[widx:widx+6]) 1782 widx += 6 1783 // resolved_addr_type : inout RPC_T_GAP_IDENT_ADDR_TYPE 1784 // not impl (a.Size() > 0) 1785 1786 var result bool 1787 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1788 1789 r.seq++ 1790 return result 1791 } 1792 1793 func (r *rtl8720dn) rpc_le_get_cccd_data(p_entry RPC_T_LE_KEY_ENTRY, p_data RPC_T_LE_CCCD) bool { 1794 if r.debug { 1795 fmt.Printf("rpc_le_get_cccd_data()\r\n") 1796 } 1797 msg := startWriteMessage(0x00, 0x0A, 0x0C, uint32(r.seq)) 1798 1799 // p_entry : in RPC_T_LE_KEY_ENTRY 1800 msg = append(msg, byte(p_entry>>0)) 1801 msg = append(msg, byte(p_entry>>8)) 1802 msg = append(msg, byte(p_entry>>16)) 1803 msg = append(msg, byte(p_entry>>24)) 1804 1805 r.performRequest(msg) 1806 1807 r.read() 1808 widx := 8 1809 // p_data : out RPC_T_LE_CCCD 1810 // not impl (a.Size() > 0) 1811 1812 var result bool 1813 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1814 1815 r.seq++ 1816 return result 1817 } 1818 1819 func (r *rtl8720dn) rpc_le_gen_bond_dev(bd_addr []uint8, bd_type RPC_T_GAP_REMOTE_ADDR_TYPE, local_bd_type RPC_T_GAP_LOCAL_ADDR_TYPE, local_ltk []byte, key_type RPC_T_LE_KEY_TYPE, p_cccd RPC_T_LE_CCCD) bool { 1820 if r.debug { 1821 fmt.Printf("rpc_le_gen_bond_dev()\r\n") 1822 } 1823 msg := startWriteMessage(0x00, 0x0A, 0x0D, uint32(r.seq)) 1824 1825 // bd_addr : in []uint8 (6) 1826 msg = append(msg, bd_addr...) 1827 // bd_type : in RPC_T_GAP_REMOTE_ADDR_TYPE 1828 msg = append(msg, byte(bd_type>>0)) 1829 msg = append(msg, byte(bd_type>>8)) 1830 msg = append(msg, byte(bd_type>>16)) 1831 msg = append(msg, byte(bd_type>>24)) 1832 // local_bd_type : in RPC_T_GAP_LOCAL_ADDR_TYPE 1833 msg = append(msg, byte(local_bd_type>>0)) 1834 msg = append(msg, byte(local_bd_type>>8)) 1835 msg = append(msg, byte(local_bd_type>>16)) 1836 msg = append(msg, byte(local_bd_type>>24)) 1837 // local_ltk : in []byte 1838 msg = append(msg, byte(len(local_ltk)), byte(len(local_ltk)>>8), byte(len(local_ltk)>>16), byte(len(local_ltk)>>24)) 1839 msg = append(msg, []byte(local_ltk)...) 1840 // key_type : in RPC_T_LE_KEY_TYPE 1841 msg = append(msg, byte(key_type>>0)) 1842 msg = append(msg, byte(key_type>>8)) 1843 msg = append(msg, byte(key_type>>16)) 1844 msg = append(msg, byte(key_type>>24)) 1845 // p_cccd : in RPC_T_LE_CCCD 1846 msg = append(msg, byte(p_cccd>>0)) 1847 msg = append(msg, byte(p_cccd>>8)) 1848 msg = append(msg, byte(p_cccd>>16)) 1849 msg = append(msg, byte(p_cccd>>24)) 1850 1851 r.performRequest(msg) 1852 1853 r.read() 1854 widx := 8 1855 1856 var result bool 1857 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1858 1859 r.seq++ 1860 return result 1861 } 1862 1863 func (r *rtl8720dn) rpc_le_get_dev_bond_info_len() uint16 { 1864 if r.debug { 1865 fmt.Printf("rpc_le_get_dev_bond_info_len()\r\n") 1866 } 1867 msg := startWriteMessage(0x00, 0x0A, 0x0E, uint32(r.seq)) 1868 1869 r.performRequest(msg) 1870 1871 r.read() 1872 widx := 8 1873 var result uint16 1874 result = uint16(binary.LittleEndian.Uint32(payload[widx:])) 1875 1876 r.seq++ 1877 return result 1878 } 1879 1880 func (r *rtl8720dn) rpc_le_set_dev_bond_info(p_data []byte, exist *bool) RPC_T_LE_KEY_ENTRY { 1881 if r.debug { 1882 fmt.Printf("rpc_le_set_dev_bond_info()\r\n") 1883 } 1884 msg := startWriteMessage(0x00, 0x0A, 0x0F, uint32(r.seq)) 1885 1886 // p_data : in []byte 1887 msg = append(msg, byte(len(p_data)), byte(len(p_data)>>8), byte(len(p_data)>>16), byte(len(p_data)>>24)) 1888 msg = append(msg, []byte(p_data)...) 1889 1890 r.performRequest(msg) 1891 1892 r.read() 1893 widx := 8 1894 // exist : out bool 1895 *exist = payload[widx] != 0 1896 widx += 1 1897 1898 var result RPC_T_LE_KEY_ENTRY 1899 result = RPC_T_LE_KEY_ENTRY(binary.LittleEndian.Uint32(payload[widx:])) 1900 1901 r.seq++ 1902 return result 1903 } 1904 1905 func (r *rtl8720dn) rpc_le_get_dev_bond_info(p_entry RPC_T_LE_KEY_ENTRY, p_data []byte) bool { 1906 if r.debug { 1907 fmt.Printf("rpc_le_get_dev_bond_info()\r\n") 1908 } 1909 msg := startWriteMessage(0x00, 0x0A, 0x10, uint32(r.seq)) 1910 1911 // p_entry : in RPC_T_LE_KEY_ENTRY 1912 msg = append(msg, byte(p_entry>>0)) 1913 msg = append(msg, byte(p_entry>>8)) 1914 msg = append(msg, byte(p_entry>>16)) 1915 msg = append(msg, byte(p_entry>>24)) 1916 1917 r.performRequest(msg) 1918 1919 r.read() 1920 widx := 8 1921 // p_data : out []byte 1922 p_data_length := binary.LittleEndian.Uint32(payload[widx:]) 1923 widx += 4 1924 if p_data_length > 0 { 1925 copy(p_data, payload[widx:widx+int(p_data_length)]) 1926 widx += int(p_data_length) 1927 } 1928 1929 var result bool 1930 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1931 1932 r.seq++ 1933 return result 1934 } 1935 1936 func (r *rtl8720dn) rpc_ble_client_init(num uint8) bool { 1937 if r.debug { 1938 fmt.Printf("rpc_ble_client_init()\r\n") 1939 } 1940 msg := startWriteMessage(0x00, 0x0B, 0x01, uint32(r.seq)) 1941 1942 // num : in uint8 1943 msg = append(msg, byte(num>>0)) 1944 1945 r.performRequest(msg) 1946 1947 r.read() 1948 widx := 8 1949 1950 var result bool 1951 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 1952 1953 r.seq++ 1954 return result 1955 } 1956 1957 func (r *rtl8720dn) rpc_ble_add_client(app_id uint8, link_num uint8) uint8 { 1958 if r.debug { 1959 fmt.Printf("rpc_ble_add_client()\r\n") 1960 } 1961 msg := startWriteMessage(0x00, 0x0B, 0x02, uint32(r.seq)) 1962 1963 // app_id : in uint8 1964 msg = append(msg, byte(app_id>>0)) 1965 // link_num : in uint8 1966 msg = append(msg, byte(link_num>>0)) 1967 1968 r.performRequest(msg) 1969 1970 r.read() 1971 widx := 8 1972 1973 var result uint8 1974 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 1975 1976 r.seq++ 1977 return result 1978 } 1979 1980 func (r *rtl8720dn) rpc_client_init(client_num uint8) { 1981 if r.debug { 1982 fmt.Printf("rpc_client_init()\r\n") 1983 } 1984 msg := startWriteMessage(0x00, 0x0B, 0x03, uint32(r.seq)) 1985 1986 // client_num : in uint8 1987 msg = append(msg, byte(client_num>>0)) 1988 1989 r.performRequest(msg) 1990 1991 r.read() 1992 1993 r.seq++ 1994 return 1995 } 1996 1997 func (r *rtl8720dn) rpc_client_all_primary_srv_discovery(conn_id uint8, client_id uint8) RPC_T_GAP_CAUSE { 1998 if r.debug { 1999 fmt.Printf("rpc_client_all_primary_srv_discovery()\r\n") 2000 } 2001 msg := startWriteMessage(0x00, 0x0B, 0x04, uint32(r.seq)) 2002 2003 // conn_id : in uint8 2004 msg = append(msg, byte(conn_id>>0)) 2005 // client_id : in uint8 2006 msg = append(msg, byte(client_id>>0)) 2007 2008 r.performRequest(msg) 2009 2010 r.read() 2011 widx := 8 2012 2013 var result RPC_T_GAP_CAUSE 2014 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2015 2016 r.seq++ 2017 return result 2018 } 2019 2020 func (r *rtl8720dn) rpc_client_by_uuid_srv_discovery(conn_id uint8, client_id uint8, uuid16 uint16) RPC_T_GAP_CAUSE { 2021 if r.debug { 2022 fmt.Printf("rpc_client_by_uuid_srv_discovery()\r\n") 2023 } 2024 msg := startWriteMessage(0x00, 0x0B, 0x05, uint32(r.seq)) 2025 2026 // conn_id : in uint8 2027 msg = append(msg, byte(conn_id>>0)) 2028 // client_id : in uint8 2029 msg = append(msg, byte(client_id>>0)) 2030 // uuid16 : in uint16 2031 msg = append(msg, byte(uuid16>>0)) 2032 msg = append(msg, byte(uuid16>>8)) 2033 2034 r.performRequest(msg) 2035 2036 r.read() 2037 widx := 8 2038 2039 var result RPC_T_GAP_CAUSE 2040 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2041 2042 r.seq++ 2043 return result 2044 } 2045 2046 func (r *rtl8720dn) rpc_client_by_uuid128_srv_discovery(conn_id uint8, client_id uint8, p_uuid128 []uint8) RPC_T_GAP_CAUSE { 2047 if r.debug { 2048 fmt.Printf("rpc_client_by_uuid128_srv_discovery()\r\n") 2049 } 2050 msg := startWriteMessage(0x00, 0x0B, 0x06, uint32(r.seq)) 2051 2052 // conn_id : in uint8 2053 msg = append(msg, byte(conn_id>>0)) 2054 // client_id : in uint8 2055 msg = append(msg, byte(client_id>>0)) 2056 // p_uuid128 : in []uint8 (16) 2057 msg = append(msg, p_uuid128...) 2058 2059 r.performRequest(msg) 2060 2061 r.read() 2062 widx := 8 2063 2064 var result RPC_T_GAP_CAUSE 2065 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2066 2067 r.seq++ 2068 return result 2069 } 2070 2071 func (r *rtl8720dn) rpc_client_relationship_discovery(conn_id uint8, client_id uint8, start_handle uint16, end_handle uint16) RPC_T_GAP_CAUSE { 2072 if r.debug { 2073 fmt.Printf("rpc_client_relationship_discovery()\r\n") 2074 } 2075 msg := startWriteMessage(0x00, 0x0B, 0x07, uint32(r.seq)) 2076 2077 // conn_id : in uint8 2078 msg = append(msg, byte(conn_id>>0)) 2079 // client_id : in uint8 2080 msg = append(msg, byte(client_id>>0)) 2081 // start_handle : in uint16 2082 msg = append(msg, byte(start_handle>>0)) 2083 msg = append(msg, byte(start_handle>>8)) 2084 // end_handle : in uint16 2085 msg = append(msg, byte(end_handle>>0)) 2086 msg = append(msg, byte(end_handle>>8)) 2087 2088 r.performRequest(msg) 2089 2090 r.read() 2091 widx := 8 2092 2093 var result RPC_T_GAP_CAUSE 2094 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2095 2096 r.seq++ 2097 return result 2098 } 2099 2100 func (r *rtl8720dn) rpc_client_all_char_discovery(conn_id uint8, client_id uint8, start_handle uint16, end_handle uint16) RPC_T_GAP_CAUSE { 2101 if r.debug { 2102 fmt.Printf("rpc_client_all_char_discovery()\r\n") 2103 } 2104 msg := startWriteMessage(0x00, 0x0B, 0x08, uint32(r.seq)) 2105 2106 // conn_id : in uint8 2107 msg = append(msg, byte(conn_id>>0)) 2108 // client_id : in uint8 2109 msg = append(msg, byte(client_id>>0)) 2110 // start_handle : in uint16 2111 msg = append(msg, byte(start_handle>>0)) 2112 msg = append(msg, byte(start_handle>>8)) 2113 // end_handle : in uint16 2114 msg = append(msg, byte(end_handle>>0)) 2115 msg = append(msg, byte(end_handle>>8)) 2116 2117 r.performRequest(msg) 2118 2119 r.read() 2120 widx := 8 2121 2122 var result RPC_T_GAP_CAUSE 2123 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2124 2125 r.seq++ 2126 return result 2127 } 2128 2129 func (r *rtl8720dn) rpc_client_by_uuid_char_discovery(conn_id uint8, client_id uint8, start_handle uint16, end_handle uint16, uuid16 uint16) RPC_T_GAP_CAUSE { 2130 if r.debug { 2131 fmt.Printf("rpc_client_by_uuid_char_discovery()\r\n") 2132 } 2133 msg := startWriteMessage(0x00, 0x0B, 0x09, uint32(r.seq)) 2134 2135 // conn_id : in uint8 2136 msg = append(msg, byte(conn_id>>0)) 2137 // client_id : in uint8 2138 msg = append(msg, byte(client_id>>0)) 2139 // start_handle : in uint16 2140 msg = append(msg, byte(start_handle>>0)) 2141 msg = append(msg, byte(start_handle>>8)) 2142 // end_handle : in uint16 2143 msg = append(msg, byte(end_handle>>0)) 2144 msg = append(msg, byte(end_handle>>8)) 2145 // uuid16 : in uint16 2146 msg = append(msg, byte(uuid16>>0)) 2147 msg = append(msg, byte(uuid16>>8)) 2148 2149 r.performRequest(msg) 2150 2151 r.read() 2152 widx := 8 2153 2154 var result RPC_T_GAP_CAUSE 2155 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2156 2157 r.seq++ 2158 return result 2159 } 2160 2161 func (r *rtl8720dn) rpc_client_by_uuid128_char_discovery(conn_id uint8, client_id uint8, start_handle uint16, end_handle uint16, p_uuid128 []uint8) RPC_T_GAP_CAUSE { 2162 if r.debug { 2163 fmt.Printf("rpc_client_by_uuid128_char_discovery()\r\n") 2164 } 2165 msg := startWriteMessage(0x00, 0x0B, 0x0A, uint32(r.seq)) 2166 2167 // conn_id : in uint8 2168 msg = append(msg, byte(conn_id>>0)) 2169 // client_id : in uint8 2170 msg = append(msg, byte(client_id>>0)) 2171 // start_handle : in uint16 2172 msg = append(msg, byte(start_handle>>0)) 2173 msg = append(msg, byte(start_handle>>8)) 2174 // end_handle : in uint16 2175 msg = append(msg, byte(end_handle>>0)) 2176 msg = append(msg, byte(end_handle>>8)) 2177 // p_uuid128 : in []uint8 (16) 2178 msg = append(msg, p_uuid128...) 2179 2180 r.performRequest(msg) 2181 2182 r.read() 2183 widx := 8 2184 2185 var result RPC_T_GAP_CAUSE 2186 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2187 2188 r.seq++ 2189 return result 2190 } 2191 2192 func (r *rtl8720dn) rpc_client_all_char_descriptor_discovery(conn_id uint8, client_id uint8, start_handle uint16, end_handle uint16) RPC_T_GAP_CAUSE { 2193 if r.debug { 2194 fmt.Printf("rpc_client_all_char_descriptor_discovery()\r\n") 2195 } 2196 msg := startWriteMessage(0x00, 0x0B, 0x0B, uint32(r.seq)) 2197 2198 // conn_id : in uint8 2199 msg = append(msg, byte(conn_id>>0)) 2200 // client_id : in uint8 2201 msg = append(msg, byte(client_id>>0)) 2202 // start_handle : in uint16 2203 msg = append(msg, byte(start_handle>>0)) 2204 msg = append(msg, byte(start_handle>>8)) 2205 // end_handle : in uint16 2206 msg = append(msg, byte(end_handle>>0)) 2207 msg = append(msg, byte(end_handle>>8)) 2208 2209 r.performRequest(msg) 2210 2211 r.read() 2212 widx := 8 2213 2214 var result RPC_T_GAP_CAUSE 2215 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2216 2217 r.seq++ 2218 return result 2219 } 2220 2221 func (r *rtl8720dn) rpc_client_attr_read(conn_id uint8, client_id uint8, handle uint16) RPC_T_GAP_CAUSE { 2222 if r.debug { 2223 fmt.Printf("rpc_client_attr_read()\r\n") 2224 } 2225 msg := startWriteMessage(0x00, 0x0B, 0x0C, uint32(r.seq)) 2226 2227 // conn_id : in uint8 2228 msg = append(msg, byte(conn_id>>0)) 2229 // client_id : in uint8 2230 msg = append(msg, byte(client_id>>0)) 2231 // handle : in uint16 2232 msg = append(msg, byte(handle>>0)) 2233 msg = append(msg, byte(handle>>8)) 2234 2235 r.performRequest(msg) 2236 2237 r.read() 2238 widx := 8 2239 2240 var result RPC_T_GAP_CAUSE 2241 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2242 2243 r.seq++ 2244 return result 2245 } 2246 2247 func (r *rtl8720dn) rpc_client_attr_read_using_uuid(conn_id uint8, client_id uint8, start_handle uint16, end_handle uint16, uuid16 uint16, p_uuid128 []uint8) RPC_T_GAP_CAUSE { 2248 if r.debug { 2249 fmt.Printf("rpc_client_attr_read_using_uuid()\r\n") 2250 } 2251 msg := startWriteMessage(0x00, 0x0B, 0x0D, uint32(r.seq)) 2252 2253 // conn_id : in uint8 2254 msg = append(msg, byte(conn_id>>0)) 2255 // client_id : in uint8 2256 msg = append(msg, byte(client_id>>0)) 2257 // start_handle : in uint16 2258 msg = append(msg, byte(start_handle>>0)) 2259 msg = append(msg, byte(start_handle>>8)) 2260 // end_handle : in uint16 2261 msg = append(msg, byte(end_handle>>0)) 2262 msg = append(msg, byte(end_handle>>8)) 2263 // uuid16 : in uint16 2264 msg = append(msg, byte(uuid16>>0)) 2265 msg = append(msg, byte(uuid16>>8)) 2266 // p_uuid128 : in []uint8 (16) 2267 msg = append(msg, p_uuid128...) 2268 2269 r.performRequest(msg) 2270 2271 r.read() 2272 widx := 8 2273 2274 var result RPC_T_GAP_CAUSE 2275 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2276 2277 r.seq++ 2278 return result 2279 } 2280 2281 func (r *rtl8720dn) rpc_client_attr_write(conn_id uint8, client_id uint8, write_type RPC_T_GATT_WRITE_TYPE, handle uint16, data []byte) RPC_T_GAP_CAUSE { 2282 if r.debug { 2283 fmt.Printf("rpc_client_attr_write()\r\n") 2284 } 2285 msg := startWriteMessage(0x00, 0x0B, 0x0E, uint32(r.seq)) 2286 2287 // conn_id : in uint8 2288 msg = append(msg, byte(conn_id>>0)) 2289 // client_id : in uint8 2290 msg = append(msg, byte(client_id>>0)) 2291 // write_type : in RPC_T_GATT_WRITE_TYPE 2292 msg = append(msg, byte(write_type>>0)) 2293 msg = append(msg, byte(write_type>>8)) 2294 msg = append(msg, byte(write_type>>16)) 2295 msg = append(msg, byte(write_type>>24)) 2296 // handle : in uint16 2297 msg = append(msg, byte(handle>>0)) 2298 msg = append(msg, byte(handle>>8)) 2299 // data : in []byte 2300 msg = append(msg, byte(len(data)), byte(len(data)>>8), byte(len(data)>>16), byte(len(data)>>24)) 2301 msg = append(msg, []byte(data)...) 2302 2303 r.performRequest(msg) 2304 2305 r.read() 2306 widx := 8 2307 2308 var result RPC_T_GAP_CAUSE 2309 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2310 2311 r.seq++ 2312 return result 2313 } 2314 2315 func (r *rtl8720dn) rpc_client_attr_ind_confirm(conn_id uint8) RPC_T_GAP_CAUSE { 2316 if r.debug { 2317 fmt.Printf("rpc_client_attr_ind_confirm()\r\n") 2318 } 2319 msg := startWriteMessage(0x00, 0x0B, 0x0F, uint32(r.seq)) 2320 2321 // conn_id : in uint8 2322 msg = append(msg, byte(conn_id>>0)) 2323 2324 r.performRequest(msg) 2325 2326 r.read() 2327 widx := 8 2328 2329 var result RPC_T_GAP_CAUSE 2330 result = RPC_T_GAP_CAUSE(binary.LittleEndian.Uint32(payload[widx:])) 2331 2332 r.seq++ 2333 return result 2334 } 2335 2336 func (r *rtl8720dn) rpc_ble_server_init(num uint8) bool { 2337 if r.debug { 2338 fmt.Printf("rpc_ble_server_init()\r\n") 2339 } 2340 msg := startWriteMessage(0x00, 0x0C, 0x01, uint32(r.seq)) 2341 2342 // num : in uint8 2343 msg = append(msg, byte(num>>0)) 2344 2345 r.performRequest(msg) 2346 2347 r.read() 2348 widx := 8 2349 2350 var result bool 2351 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 2352 2353 r.seq++ 2354 return result 2355 } 2356 2357 func (r *rtl8720dn) rpc_ble_create_service(uuid []uint8, uuid_length uint8, is_primary bool) uint8 { 2358 if r.debug { 2359 fmt.Printf("rpc_ble_create_service()\r\n") 2360 } 2361 msg := startWriteMessage(0x00, 0x0C, 0x02, uint32(r.seq)) 2362 2363 // uuid : in []uint8 (16) 2364 msg = append(msg, uuid...) 2365 // uuid_length : in uint8 2366 msg = append(msg, byte(uuid_length>>0)) 2367 // is_primary : in bool 2368 if is_primary { 2369 msg = append(msg, 1) 2370 } else { 2371 msg = append(msg, 0) 2372 } 2373 2374 r.performRequest(msg) 2375 2376 r.read() 2377 widx := 8 2378 2379 var result uint8 2380 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 2381 2382 r.seq++ 2383 return result 2384 } 2385 2386 func (r *rtl8720dn) rpc_ble_delete_service(app_id uint8) bool { 2387 if r.debug { 2388 fmt.Printf("rpc_ble_delete_service()\r\n") 2389 } 2390 msg := startWriteMessage(0x00, 0x0C, 0x03, uint32(r.seq)) 2391 2392 // app_id : in uint8 2393 msg = append(msg, byte(app_id>>0)) 2394 2395 r.performRequest(msg) 2396 2397 r.read() 2398 widx := 8 2399 2400 var result bool 2401 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 2402 2403 r.seq++ 2404 return result 2405 } 2406 2407 func (r *rtl8720dn) rpc_ble_service_start(app_id uint8) uint8 { 2408 if r.debug { 2409 fmt.Printf("rpc_ble_service_start()\r\n") 2410 } 2411 msg := startWriteMessage(0x00, 0x0C, 0x04, uint32(r.seq)) 2412 2413 // app_id : in uint8 2414 msg = append(msg, byte(app_id>>0)) 2415 2416 r.performRequest(msg) 2417 2418 r.read() 2419 widx := 8 2420 2421 var result uint8 2422 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 2423 2424 r.seq++ 2425 return result 2426 } 2427 2428 func (r *rtl8720dn) rpc_ble_get_servie_handle(app_id uint8) uint8 { 2429 if r.debug { 2430 fmt.Printf("rpc_ble_get_servie_handle()\r\n") 2431 } 2432 msg := startWriteMessage(0x00, 0x0C, 0x05, uint32(r.seq)) 2433 2434 // app_id : in uint8 2435 msg = append(msg, byte(app_id>>0)) 2436 2437 r.performRequest(msg) 2438 2439 r.read() 2440 widx := 8 2441 2442 var result uint8 2443 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 2444 2445 r.seq++ 2446 return result 2447 } 2448 2449 func (r *rtl8720dn) rpc_ble_create_char(app_id uint8, uuid []uint8, uuid_length uint8, properties uint8, permissions uint32) uint16 { 2450 if r.debug { 2451 fmt.Printf("rpc_ble_create_char()\r\n") 2452 } 2453 msg := startWriteMessage(0x00, 0x0C, 0x06, uint32(r.seq)) 2454 2455 // app_id : in uint8 2456 msg = append(msg, byte(app_id>>0)) 2457 // uuid : in []uint8 (16) 2458 msg = append(msg, uuid...) 2459 // uuid_length : in uint8 2460 msg = append(msg, byte(uuid_length>>0)) 2461 // properties : in uint8 2462 msg = append(msg, byte(properties>>0)) 2463 // permissions : in uint32 2464 msg = append(msg, byte(permissions>>0)) 2465 msg = append(msg, byte(permissions>>8)) 2466 msg = append(msg, byte(permissions>>16)) 2467 msg = append(msg, byte(permissions>>24)) 2468 2469 r.performRequest(msg) 2470 2471 r.read() 2472 widx := 8 2473 2474 var result uint16 2475 result = uint16(binary.LittleEndian.Uint32(payload[widx:])) 2476 2477 r.seq++ 2478 return result 2479 } 2480 2481 func (r *rtl8720dn) rpc_ble_create_desc(app_id uint8, char_handle uint16, uuid []uint8, uuid_length uint8, flags uint8, permissions uint32, value_length uint16, p_value []byte) uint16 { 2482 if r.debug { 2483 fmt.Printf("rpc_ble_create_desc()\r\n") 2484 } 2485 msg := startWriteMessage(0x00, 0x0C, 0x07, uint32(r.seq)) 2486 2487 // app_id : in uint8 2488 msg = append(msg, byte(app_id>>0)) 2489 // char_handle : in uint16 2490 msg = append(msg, byte(char_handle>>0)) 2491 msg = append(msg, byte(char_handle>>8)) 2492 // uuid : in []uint8 (16) 2493 msg = append(msg, uuid...) 2494 // uuid_length : in uint8 2495 msg = append(msg, byte(uuid_length>>0)) 2496 // flags : in uint8 2497 msg = append(msg, byte(flags>>0)) 2498 // permissions : in uint32 2499 msg = append(msg, byte(permissions>>0)) 2500 msg = append(msg, byte(permissions>>8)) 2501 msg = append(msg, byte(permissions>>16)) 2502 msg = append(msg, byte(permissions>>24)) 2503 // value_length : in uint16 2504 msg = append(msg, byte(value_length>>0)) 2505 msg = append(msg, byte(value_length>>8)) 2506 // p_value : in []byte nullable 2507 if len(p_value) == 0 { 2508 msg = append(msg, 1) 2509 } else { 2510 msg = append(msg, 0) 2511 msg = append(msg, byte(len(p_value)), byte(len(p_value)>>8), byte(len(p_value)>>16), byte(len(p_value)>>24)) 2512 msg = append(msg, []byte(p_value)...) 2513 } 2514 2515 r.performRequest(msg) 2516 2517 r.read() 2518 widx := 8 2519 2520 var result uint16 2521 result = uint16(binary.LittleEndian.Uint32(payload[widx:])) 2522 2523 r.seq++ 2524 return result 2525 } 2526 2527 func (r *rtl8720dn) rpc_server_send_data(conn_id uint8, service_id uint8, attrib_index uint16, data []byte, pdu_type RPC_T_GATT_PDU_TYPE) bool { 2528 if r.debug { 2529 fmt.Printf("rpc_server_send_data()\r\n") 2530 } 2531 msg := startWriteMessage(0x00, 0x0C, 0x08, uint32(r.seq)) 2532 2533 // conn_id : in uint8 2534 msg = append(msg, byte(conn_id>>0)) 2535 // service_id : in uint8 2536 msg = append(msg, byte(service_id>>0)) 2537 // attrib_index : in uint16 2538 msg = append(msg, byte(attrib_index>>0)) 2539 msg = append(msg, byte(attrib_index>>8)) 2540 // data : in []byte 2541 msg = append(msg, byte(len(data)), byte(len(data)>>8), byte(len(data)>>16), byte(len(data)>>24)) 2542 msg = append(msg, []byte(data)...) 2543 // pdu_type : in RPC_T_GATT_PDU_TYPE 2544 msg = append(msg, byte(pdu_type>>0)) 2545 msg = append(msg, byte(pdu_type>>8)) 2546 msg = append(msg, byte(pdu_type>>16)) 2547 msg = append(msg, byte(pdu_type>>24)) 2548 2549 r.performRequest(msg) 2550 2551 r.read() 2552 widx := 8 2553 2554 var result bool 2555 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 2556 2557 r.seq++ 2558 return result 2559 } 2560 2561 func (r *rtl8720dn) rpc_ble_server_get_attr_value(app_id uint8, attr_handle uint16) []byte { 2562 if r.debug { 2563 fmt.Printf("rpc_ble_server_get_attr_value()\r\n") 2564 } 2565 msg := startWriteMessage(0x00, 0x0C, 0x09, uint32(r.seq)) 2566 2567 // app_id : in uint8 2568 msg = append(msg, byte(app_id>>0)) 2569 // attr_handle : in uint16 2570 msg = append(msg, byte(attr_handle>>0)) 2571 msg = append(msg, byte(attr_handle>>8)) 2572 2573 r.performRequest(msg) 2574 2575 r.read() 2576 widx := 8 2577 2578 var result []byte 2579 result_length := binary.LittleEndian.Uint32(payload[widx:]) 2580 widx += 4 2581 copy(result, payload[widx:result_length]) 2582 2583 r.seq++ 2584 return result 2585 } 2586 2587 func (r *rtl8720dn) rpc_server_exec_write_confirm(conn_id uint8, cause uint16, handle uint16) bool { 2588 if r.debug { 2589 fmt.Printf("rpc_server_exec_write_confirm()\r\n") 2590 } 2591 msg := startWriteMessage(0x00, 0x0C, 0x0A, uint32(r.seq)) 2592 2593 // conn_id : in uint8 2594 msg = append(msg, byte(conn_id>>0)) 2595 // cause : in uint16 2596 msg = append(msg, byte(cause>>0)) 2597 msg = append(msg, byte(cause>>8)) 2598 // handle : in uint16 2599 msg = append(msg, byte(handle>>0)) 2600 msg = append(msg, byte(handle>>8)) 2601 2602 r.performRequest(msg) 2603 2604 r.read() 2605 widx := 8 2606 2607 var result bool 2608 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 2609 2610 r.seq++ 2611 return result 2612 } 2613 2614 func (r *rtl8720dn) rpc_server_attr_write_confirm(conn_id uint8, service_id uint8, attrib_index uint16, cause RPC_T_APP_RESULT) bool { 2615 if r.debug { 2616 fmt.Printf("rpc_server_attr_write_confirm()\r\n") 2617 } 2618 msg := startWriteMessage(0x00, 0x0C, 0x0B, uint32(r.seq)) 2619 2620 // conn_id : in uint8 2621 msg = append(msg, byte(conn_id>>0)) 2622 // service_id : in uint8 2623 msg = append(msg, byte(service_id>>0)) 2624 // attrib_index : in uint16 2625 msg = append(msg, byte(attrib_index>>0)) 2626 msg = append(msg, byte(attrib_index>>8)) 2627 // cause : in RPC_T_APP_RESULT 2628 msg = append(msg, byte(cause>>0)) 2629 msg = append(msg, byte(cause>>8)) 2630 msg = append(msg, byte(cause>>16)) 2631 msg = append(msg, byte(cause>>24)) 2632 2633 r.performRequest(msg) 2634 2635 r.read() 2636 widx := 8 2637 2638 var result bool 2639 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 2640 2641 r.seq++ 2642 return result 2643 } 2644 2645 func (r *rtl8720dn) rpc_server_attr_read_confirm(conn_id uint8, service_id uint8, attrib_index uint16, data []byte, cause RPC_T_APP_RESULT) bool { 2646 if r.debug { 2647 fmt.Printf("rpc_server_attr_read_confirm()\r\n") 2648 } 2649 msg := startWriteMessage(0x00, 0x0C, 0x0C, uint32(r.seq)) 2650 2651 // conn_id : in uint8 2652 msg = append(msg, byte(conn_id>>0)) 2653 // service_id : in uint8 2654 msg = append(msg, byte(service_id>>0)) 2655 // attrib_index : in uint16 2656 msg = append(msg, byte(attrib_index>>0)) 2657 msg = append(msg, byte(attrib_index>>8)) 2658 // data : in []byte 2659 msg = append(msg, byte(len(data)), byte(len(data)>>8), byte(len(data)>>16), byte(len(data)>>24)) 2660 msg = append(msg, []byte(data)...) 2661 // cause : in RPC_T_APP_RESULT 2662 msg = append(msg, byte(cause>>0)) 2663 msg = append(msg, byte(cause>>8)) 2664 msg = append(msg, byte(cause>>16)) 2665 msg = append(msg, byte(cause>>24)) 2666 2667 r.performRequest(msg) 2668 2669 r.read() 2670 widx := 8 2671 2672 var result bool 2673 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 2674 2675 r.seq++ 2676 return result 2677 } 2678 2679 func (r *rtl8720dn) rpc_ble_handle_gap_msg(gap_msg []byte) RPC_T_APP_RESULT { 2680 if r.debug { 2681 fmt.Printf("rpc_ble_handle_gap_msg()\r\n") 2682 } 2683 msg := startWriteMessage(0x00, 0x0D, 0x01, uint32(r.seq)) 2684 2685 // gap_msg : in []byte 2686 msg = append(msg, byte(len(gap_msg)), byte(len(gap_msg)>>8), byte(len(gap_msg)>>16), byte(len(gap_msg)>>24)) 2687 msg = append(msg, []byte(gap_msg)...) 2688 2689 r.performRequest(msg) 2690 2691 r.read() 2692 widx := 8 2693 2694 var result RPC_T_APP_RESULT 2695 result = RPC_T_APP_RESULT(binary.LittleEndian.Uint32(payload[widx:])) 2696 2697 r.seq++ 2698 return result 2699 } 2700 2701 func (r *rtl8720dn) rpc_ble_gap_callback(cb_type uint8, cb_data []byte) RPC_T_APP_RESULT { 2702 if r.debug { 2703 fmt.Printf("rpc_ble_gap_callback()\r\n") 2704 } 2705 msg := startWriteMessage(0x00, 0x0D, 0x02, uint32(r.seq)) 2706 2707 // cb_type : in uint8 2708 msg = append(msg, byte(cb_type>>0)) 2709 // cb_data : in []byte 2710 msg = append(msg, byte(len(cb_data)), byte(len(cb_data)>>8), byte(len(cb_data)>>16), byte(len(cb_data)>>24)) 2711 msg = append(msg, []byte(cb_data)...) 2712 2713 r.performRequest(msg) 2714 2715 r.read() 2716 widx := 8 2717 2718 var result RPC_T_APP_RESULT 2719 result = RPC_T_APP_RESULT(binary.LittleEndian.Uint32(payload[widx:])) 2720 2721 r.seq++ 2722 return result 2723 } 2724 2725 func (r *rtl8720dn) rpc_ble_gattc_callback(gatt_if uint8, conn_id uint8, cb_data []byte, extra_data []byte) RPC_T_APP_RESULT { 2726 if r.debug { 2727 fmt.Printf("rpc_ble_gattc_callback()\r\n") 2728 } 2729 msg := startWriteMessage(0x00, 0x0D, 0x03, uint32(r.seq)) 2730 2731 // gatt_if : in uint8 2732 msg = append(msg, byte(gatt_if>>0)) 2733 // conn_id : in uint8 2734 msg = append(msg, byte(conn_id>>0)) 2735 // cb_data : in []byte 2736 msg = append(msg, byte(len(cb_data)), byte(len(cb_data)>>8), byte(len(cb_data)>>16), byte(len(cb_data)>>24)) 2737 msg = append(msg, []byte(cb_data)...) 2738 // extra_data : in []byte 2739 msg = append(msg, byte(len(extra_data)), byte(len(extra_data)>>8), byte(len(extra_data)>>16), byte(len(extra_data)>>24)) 2740 msg = append(msg, []byte(extra_data)...) 2741 2742 r.performRequest(msg) 2743 2744 r.read() 2745 widx := 8 2746 2747 var result RPC_T_APP_RESULT 2748 result = RPC_T_APP_RESULT(binary.LittleEndian.Uint32(payload[widx:])) 2749 2750 r.seq++ 2751 return result 2752 } 2753 2754 func (r *rtl8720dn) rpc_ble_gatts_callback(gatt_if uint8, conn_id uint8, attrib_index uint16, event RPC_T_SERVICE_CALLBACK_TYPE, property uint16, read_cb_data []byte, write_cb_data []byte, app_cb_data []byte) RPC_T_APP_RESULT { 2755 if r.debug { 2756 fmt.Printf("rpc_ble_gatts_callback()\r\n") 2757 } 2758 msg := startWriteMessage(0x00, 0x0D, 0x04, uint32(r.seq)) 2759 2760 // gatt_if : in uint8 2761 msg = append(msg, byte(gatt_if>>0)) 2762 // conn_id : in uint8 2763 msg = append(msg, byte(conn_id>>0)) 2764 // attrib_index : in uint16 2765 msg = append(msg, byte(attrib_index>>0)) 2766 msg = append(msg, byte(attrib_index>>8)) 2767 // event : in RPC_T_SERVICE_CALLBACK_TYPE 2768 msg = append(msg, byte(event>>0)) 2769 msg = append(msg, byte(event>>8)) 2770 msg = append(msg, byte(event>>16)) 2771 msg = append(msg, byte(event>>24)) 2772 // property : in uint16 2773 msg = append(msg, byte(property>>0)) 2774 msg = append(msg, byte(property>>8)) 2775 // write_cb_data : in []byte nullable 2776 if len(write_cb_data) == 0 { 2777 msg = append(msg, 1) 2778 } else { 2779 msg = append(msg, 0) 2780 msg = append(msg, byte(len(write_cb_data)), byte(len(write_cb_data)>>8), byte(len(write_cb_data)>>16), byte(len(write_cb_data)>>24)) 2781 msg = append(msg, []byte(write_cb_data)...) 2782 } 2783 // app_cb_data : in []byte nullable 2784 if len(app_cb_data) == 0 { 2785 msg = append(msg, 1) 2786 } else { 2787 msg = append(msg, 0) 2788 msg = append(msg, byte(len(app_cb_data)), byte(len(app_cb_data)>>8), byte(len(app_cb_data)>>16), byte(len(app_cb_data)>>24)) 2789 msg = append(msg, []byte(app_cb_data)...) 2790 } 2791 2792 r.performRequest(msg) 2793 2794 r.read() 2795 widx := 8 2796 // read_cb_data : out []byte nullable 2797 read_cb_data_length := binary.LittleEndian.Uint32(payload[widx:]) 2798 widx += 1 2799 if read_cb_data_length == 1 { 2800 read_cb_data_length = binary.LittleEndian.Uint32(payload[widx:]) 2801 widx += 4 2802 } 2803 if read_cb_data_length > 0 { 2804 copy(read_cb_data, payload[widx:widx+int(read_cb_data_length)]) 2805 widx += int(read_cb_data_length) 2806 } 2807 2808 var result RPC_T_APP_RESULT 2809 result = RPC_T_APP_RESULT(binary.LittleEndian.Uint32(payload[widx:])) 2810 2811 r.seq++ 2812 return result 2813 } 2814 2815 func (r *rtl8720dn) rpc_wifi_connect(ssid string, password string, security_type uint32, key_id int32, semaphore uint32) int32 { 2816 if r.debug { 2817 fmt.Printf("rpc_wifi_connect()\r\n") 2818 } 2819 msg := startWriteMessage(0x00, 0x0E, 0x01, uint32(r.seq)) 2820 2821 // ssid : in string 2822 msg = append(msg, byte(len(ssid)), byte(len(ssid)>>8), byte(len(ssid)>>16), byte(len(ssid)>>24)) 2823 msg = append(msg, []byte(ssid)...) 2824 // password : in string nullable 2825 if len(password) == 0 { 2826 msg = append(msg, 1) 2827 } else { 2828 msg = append(msg, 0) 2829 msg = append(msg, byte(len(password)), byte(len(password)>>8), byte(len(password)>>16), byte(len(password)>>24)) 2830 msg = append(msg, []byte(password)...) 2831 } 2832 // security_type : in uint32 2833 msg = append(msg, byte(security_type>>0)) 2834 msg = append(msg, byte(security_type>>8)) 2835 msg = append(msg, byte(security_type>>16)) 2836 msg = append(msg, byte(security_type>>24)) 2837 // key_id : in int32 2838 msg = append(msg, byte(key_id>>0)) 2839 msg = append(msg, byte(key_id>>8)) 2840 msg = append(msg, byte(key_id>>16)) 2841 msg = append(msg, byte(key_id>>24)) 2842 // semaphore : in uint32 2843 msg = append(msg, byte(semaphore>>0)) 2844 msg = append(msg, byte(semaphore>>8)) 2845 msg = append(msg, byte(semaphore>>16)) 2846 msg = append(msg, byte(semaphore>>24)) 2847 2848 r.performRequest(msg) 2849 2850 r.read() 2851 widx := 8 2852 2853 var result int32 2854 x := binary.LittleEndian.Uint32(payload[widx:]) 2855 result = int32(x) 2856 2857 r.seq++ 2858 return result 2859 } 2860 2861 func (r *rtl8720dn) rpc_wifi_connect_bssid(bssid []byte, ssid string, password string, security_type uint32, key_id int32, semaphore uint32) int32 { 2862 if r.debug { 2863 fmt.Printf("rpc_wifi_connect_bssid()\r\n") 2864 } 2865 msg := startWriteMessage(0x00, 0x0E, 0x02, uint32(r.seq)) 2866 2867 // bssid : in []byte 2868 msg = append(msg, byte(len(bssid)), byte(len(bssid)>>8), byte(len(bssid)>>16), byte(len(bssid)>>24)) 2869 msg = append(msg, []byte(bssid)...) 2870 // ssid : in string nullable 2871 if len(ssid) == 0 { 2872 msg = append(msg, 1) 2873 } else { 2874 msg = append(msg, 0) 2875 msg = append(msg, byte(len(ssid)), byte(len(ssid)>>8), byte(len(ssid)>>16), byte(len(ssid)>>24)) 2876 msg = append(msg, []byte(ssid)...) 2877 } 2878 // password : in string 2879 msg = append(msg, byte(len(password)), byte(len(password)>>8), byte(len(password)>>16), byte(len(password)>>24)) 2880 msg = append(msg, []byte(password)...) 2881 // security_type : in uint32 2882 msg = append(msg, byte(security_type>>0)) 2883 msg = append(msg, byte(security_type>>8)) 2884 msg = append(msg, byte(security_type>>16)) 2885 msg = append(msg, byte(security_type>>24)) 2886 // key_id : in int32 2887 msg = append(msg, byte(key_id>>0)) 2888 msg = append(msg, byte(key_id>>8)) 2889 msg = append(msg, byte(key_id>>16)) 2890 msg = append(msg, byte(key_id>>24)) 2891 // semaphore : in uint32 2892 msg = append(msg, byte(semaphore>>0)) 2893 msg = append(msg, byte(semaphore>>8)) 2894 msg = append(msg, byte(semaphore>>16)) 2895 msg = append(msg, byte(semaphore>>24)) 2896 2897 r.performRequest(msg) 2898 2899 r.read() 2900 widx := 8 2901 2902 var result int32 2903 x := binary.LittleEndian.Uint32(payload[widx:]) 2904 result = int32(x) 2905 2906 r.seq++ 2907 return result 2908 } 2909 2910 func (r *rtl8720dn) rpc_wifi_disconnect() int32 { 2911 if r.debug { 2912 fmt.Printf("rpc_wifi_disconnect()\r\n") 2913 } 2914 msg := startWriteMessage(0x00, 0x0E, 0x03, uint32(r.seq)) 2915 2916 r.performRequest(msg) 2917 2918 r.read() 2919 widx := 8 2920 var result int32 2921 x := binary.LittleEndian.Uint32(payload[widx:]) 2922 result = int32(x) 2923 2924 r.seq++ 2925 return result 2926 } 2927 2928 func (r *rtl8720dn) rpc_wifi_is_connected_to_ap() int32 { 2929 if r.debug { 2930 fmt.Printf("rpc_wifi_is_connected_to_ap()\r\n") 2931 } 2932 msg := startWriteMessage(0x00, 0x0E, 0x04, uint32(r.seq)) 2933 2934 r.performRequest(msg) 2935 2936 r.read() 2937 widx := 8 2938 var result int32 2939 x := binary.LittleEndian.Uint32(payload[widx:]) 2940 result = int32(x) 2941 2942 r.seq++ 2943 return result 2944 } 2945 2946 func (r *rtl8720dn) rpc_wifi_is_up(itf uint32) int32 { 2947 if r.debug { 2948 fmt.Printf("rpc_wifi_is_up()\r\n") 2949 } 2950 msg := startWriteMessage(0x00, 0x0E, 0x05, uint32(r.seq)) 2951 2952 // itf : in uint32 2953 msg = append(msg, byte(itf>>0)) 2954 msg = append(msg, byte(itf>>8)) 2955 msg = append(msg, byte(itf>>16)) 2956 msg = append(msg, byte(itf>>24)) 2957 2958 r.performRequest(msg) 2959 2960 r.read() 2961 widx := 8 2962 2963 var result int32 2964 x := binary.LittleEndian.Uint32(payload[widx:]) 2965 result = int32(x) 2966 2967 r.seq++ 2968 return result 2969 } 2970 2971 func (r *rtl8720dn) rpc_wifi_is_ready_to_transceive(itf uint32) int32 { 2972 if r.debug { 2973 fmt.Printf("rpc_wifi_is_ready_to_transceive()\r\n") 2974 } 2975 msg := startWriteMessage(0x00, 0x0E, 0x06, uint32(r.seq)) 2976 2977 // itf : in uint32 2978 msg = append(msg, byte(itf>>0)) 2979 msg = append(msg, byte(itf>>8)) 2980 msg = append(msg, byte(itf>>16)) 2981 msg = append(msg, byte(itf>>24)) 2982 2983 r.performRequest(msg) 2984 2985 r.read() 2986 widx := 8 2987 2988 var result int32 2989 x := binary.LittleEndian.Uint32(payload[widx:]) 2990 result = int32(x) 2991 2992 r.seq++ 2993 return result 2994 } 2995 2996 func (r *rtl8720dn) rpc_wifi_set_mac_address(mac []byte) int32 { 2997 if r.debug { 2998 fmt.Printf("rpc_wifi_set_mac_address()\r\n") 2999 } 3000 msg := startWriteMessage(0x00, 0x0E, 0x07, uint32(r.seq)) 3001 3002 // mac : in []byte 3003 msg = append(msg, byte(len(mac)), byte(len(mac)>>8), byte(len(mac)>>16), byte(len(mac)>>24)) 3004 msg = append(msg, []byte(mac)...) 3005 3006 r.performRequest(msg) 3007 3008 r.read() 3009 widx := 8 3010 3011 var result int32 3012 x := binary.LittleEndian.Uint32(payload[widx:]) 3013 result = int32(x) 3014 3015 r.seq++ 3016 return result 3017 } 3018 3019 func (r *rtl8720dn) rpc_wifi_get_mac_address(mac []uint8) int32 { 3020 if r.debug { 3021 fmt.Printf("rpc_wifi_get_mac_address()\r\n") 3022 } 3023 msg := startWriteMessage(0x00, 0x0E, 0x08, uint32(r.seq)) 3024 3025 r.performRequest(msg) 3026 3027 r.read() 3028 widx := 8 3029 // mac : out []uint8 (18) 3030 copy(mac, payload[widx:widx+18]) 3031 widx += 18 3032 3033 var result int32 3034 x := binary.LittleEndian.Uint32(payload[widx:]) 3035 result = int32(x) 3036 3037 r.seq++ 3038 return result 3039 } 3040 3041 func (r *rtl8720dn) rpc_wifi_enable_powersave() int32 { 3042 if r.debug { 3043 fmt.Printf("rpc_wifi_enable_powersave()\r\n") 3044 } 3045 msg := startWriteMessage(0x00, 0x0E, 0x09, uint32(r.seq)) 3046 3047 r.performRequest(msg) 3048 3049 r.read() 3050 widx := 8 3051 var result int32 3052 x := binary.LittleEndian.Uint32(payload[widx:]) 3053 result = int32(x) 3054 3055 r.seq++ 3056 return result 3057 } 3058 3059 func (r *rtl8720dn) rpc_wifi_resume_powersave() int32 { 3060 if r.debug { 3061 fmt.Printf("rpc_wifi_resume_powersave()\r\n") 3062 } 3063 msg := startWriteMessage(0x00, 0x0E, 0x0A, uint32(r.seq)) 3064 3065 r.performRequest(msg) 3066 3067 r.read() 3068 widx := 8 3069 var result int32 3070 x := binary.LittleEndian.Uint32(payload[widx:]) 3071 result = int32(x) 3072 3073 r.seq++ 3074 return result 3075 } 3076 3077 func (r *rtl8720dn) rpc_wifi_disable_powersave() int32 { 3078 if r.debug { 3079 fmt.Printf("rpc_wifi_disable_powersave()\r\n") 3080 } 3081 msg := startWriteMessage(0x00, 0x0E, 0x0B, uint32(r.seq)) 3082 3083 r.performRequest(msg) 3084 3085 r.read() 3086 widx := 8 3087 var result int32 3088 x := binary.LittleEndian.Uint32(payload[widx:]) 3089 result = int32(x) 3090 3091 r.seq++ 3092 return result 3093 } 3094 3095 func (r *rtl8720dn) rpc_wifi_btcoex_set_bt_on() { 3096 if r.debug { 3097 fmt.Printf("rpc_wifi_btcoex_set_bt_on()\r\n") 3098 } 3099 msg := startWriteMessage(0x00, 0x0E, 0x0C, uint32(r.seq)) 3100 3101 r.performRequest(msg) 3102 3103 r.read() 3104 3105 r.seq++ 3106 return 3107 } 3108 3109 func (r *rtl8720dn) rpc_wifi_btcoex_set_bt_off() { 3110 if r.debug { 3111 fmt.Printf("rpc_wifi_btcoex_set_bt_off()\r\n") 3112 } 3113 msg := startWriteMessage(0x00, 0x0E, 0x0D, uint32(r.seq)) 3114 3115 r.performRequest(msg) 3116 3117 r.read() 3118 3119 r.seq++ 3120 return 3121 } 3122 3123 func (r *rtl8720dn) rpc_wifi_get_associated_client_list(client_list_buffer []byte, buffer_length uint16) int32 { 3124 if r.debug { 3125 fmt.Printf("rpc_wifi_get_associated_client_list()\r\n") 3126 } 3127 msg := startWriteMessage(0x00, 0x0E, 0x0E, uint32(r.seq)) 3128 3129 // buffer_length : in uint16 3130 msg = append(msg, byte(buffer_length>>0)) 3131 msg = append(msg, byte(buffer_length>>8)) 3132 3133 r.performRequest(msg) 3134 3135 r.read() 3136 widx := 8 3137 // client_list_buffer : out []byte 3138 client_list_buffer_length := binary.LittleEndian.Uint32(payload[widx:]) 3139 widx += 4 3140 if client_list_buffer_length > 0 { 3141 copy(client_list_buffer, payload[widx:widx+int(client_list_buffer_length)]) 3142 widx += int(client_list_buffer_length) 3143 } 3144 3145 var result int32 3146 x := binary.LittleEndian.Uint32(payload[widx:]) 3147 result = int32(x) 3148 3149 r.seq++ 3150 return result 3151 } 3152 3153 func (r *rtl8720dn) rpc_wifi_get_ap_bssid(bssid []uint8) int32 { 3154 if r.debug { 3155 fmt.Printf("rpc_wifi_get_ap_bssid()\r\n") 3156 } 3157 msg := startWriteMessage(0x00, 0x0E, 0x0F, uint32(r.seq)) 3158 3159 r.performRequest(msg) 3160 3161 r.read() 3162 widx := 8 3163 // bssid : out []uint8 (6) 3164 copy(bssid, payload[widx:widx+6]) 3165 widx += 6 3166 3167 var result int32 3168 x := binary.LittleEndian.Uint32(payload[widx:]) 3169 result = int32(x) 3170 3171 r.seq++ 3172 return result 3173 } 3174 3175 func (r *rtl8720dn) rpc_wifi_get_ap_info(ap_info []byte, security *uint32) int32 { 3176 if r.debug { 3177 fmt.Printf("rpc_wifi_get_ap_info()\r\n") 3178 } 3179 msg := startWriteMessage(0x00, 0x0E, 0x10, uint32(r.seq)) 3180 3181 r.performRequest(msg) 3182 3183 r.read() 3184 widx := 8 3185 // ap_info : out []byte 3186 ap_info_length := binary.LittleEndian.Uint32(payload[widx:]) 3187 widx += 4 3188 if ap_info_length > 0 { 3189 copy(ap_info, payload[widx:widx+int(ap_info_length)]) 3190 widx += int(ap_info_length) 3191 } 3192 // security : out uint32 3193 *security = binary.LittleEndian.Uint32(payload[widx:]) 3194 widx += 4 3195 3196 var result int32 3197 x := binary.LittleEndian.Uint32(payload[widx:]) 3198 result = int32(x) 3199 3200 r.seq++ 3201 return result 3202 } 3203 3204 func (r *rtl8720dn) rpc_wifi_set_country(country_code uint32) int32 { 3205 if r.debug { 3206 fmt.Printf("rpc_wifi_set_country()\r\n") 3207 } 3208 msg := startWriteMessage(0x00, 0x0E, 0x11, uint32(r.seq)) 3209 3210 // country_code : in uint32 3211 msg = append(msg, byte(country_code>>0)) 3212 msg = append(msg, byte(country_code>>8)) 3213 msg = append(msg, byte(country_code>>16)) 3214 msg = append(msg, byte(country_code>>24)) 3215 3216 r.performRequest(msg) 3217 3218 r.read() 3219 widx := 8 3220 3221 var result int32 3222 x := binary.LittleEndian.Uint32(payload[widx:]) 3223 result = int32(x) 3224 3225 r.seq++ 3226 return result 3227 } 3228 3229 func (r *rtl8720dn) rpc_wifi_get_sta_max_data_rate(inidata_rate *uint8) int32 { 3230 if r.debug { 3231 fmt.Printf("rpc_wifi_get_sta_max_data_rate()\r\n") 3232 } 3233 msg := startWriteMessage(0x00, 0x0E, 0x12, uint32(r.seq)) 3234 3235 r.performRequest(msg) 3236 3237 r.read() 3238 widx := 8 3239 // inidata_rate : out uint8 3240 *inidata_rate = payload[widx] 3241 widx += 1 3242 3243 var result int32 3244 x := binary.LittleEndian.Uint32(payload[widx:]) 3245 result = int32(x) 3246 3247 r.seq++ 3248 return result 3249 } 3250 3251 func (r *rtl8720dn) rpc_wifi_get_rssi(pRSSI *int32) int32 { 3252 if r.debug { 3253 fmt.Printf("rpc_wifi_get_rssi()\r\n") 3254 } 3255 msg := startWriteMessage(0x00, 0x0E, 0x13, uint32(r.seq)) 3256 3257 r.performRequest(msg) 3258 3259 r.read() 3260 widx := 8 3261 // pRSSI : out int32 3262 *pRSSI = int32(binary.LittleEndian.Uint32(payload[widx:])) 3263 widx += 4 3264 3265 var result int32 3266 x := binary.LittleEndian.Uint32(payload[widx:]) 3267 result = int32(x) 3268 3269 r.seq++ 3270 return result 3271 } 3272 3273 func (r *rtl8720dn) rpc_wifi_set_channel(channel int32) int32 { 3274 if r.debug { 3275 fmt.Printf("rpc_wifi_set_channel()\r\n") 3276 } 3277 msg := startWriteMessage(0x00, 0x0E, 0x14, uint32(r.seq)) 3278 3279 // channel : in int32 3280 msg = append(msg, byte(channel>>0)) 3281 msg = append(msg, byte(channel>>8)) 3282 msg = append(msg, byte(channel>>16)) 3283 msg = append(msg, byte(channel>>24)) 3284 3285 r.performRequest(msg) 3286 3287 r.read() 3288 widx := 8 3289 3290 var result int32 3291 x := binary.LittleEndian.Uint32(payload[widx:]) 3292 result = int32(x) 3293 3294 r.seq++ 3295 return result 3296 } 3297 3298 func (r *rtl8720dn) rpc_wifi_get_channel(channel *int32) int32 { 3299 if r.debug { 3300 fmt.Printf("rpc_wifi_get_channel()\r\n") 3301 } 3302 msg := startWriteMessage(0x00, 0x0E, 0x15, uint32(r.seq)) 3303 3304 r.performRequest(msg) 3305 3306 r.read() 3307 widx := 8 3308 // channel : out int32 3309 *channel = int32(binary.LittleEndian.Uint32(payload[widx:])) 3310 widx += 4 3311 3312 var result int32 3313 x := binary.LittleEndian.Uint32(payload[widx:]) 3314 result = int32(x) 3315 3316 r.seq++ 3317 return result 3318 } 3319 3320 func (r *rtl8720dn) rpc_wifi_change_channel_plan(channel_plan uint8) int32 { 3321 if r.debug { 3322 fmt.Printf("rpc_wifi_change_channel_plan()\r\n") 3323 } 3324 msg := startWriteMessage(0x00, 0x0E, 0x16, uint32(r.seq)) 3325 3326 // channel_plan : in uint8 3327 msg = append(msg, byte(channel_plan>>0)) 3328 3329 r.performRequest(msg) 3330 3331 r.read() 3332 widx := 8 3333 3334 var result int32 3335 x := binary.LittleEndian.Uint32(payload[widx:]) 3336 result = int32(x) 3337 3338 r.seq++ 3339 return result 3340 } 3341 3342 func (r *rtl8720dn) rpc_wifi_register_multicast_address(mac []uint8) int32 { 3343 if r.debug { 3344 fmt.Printf("rpc_wifi_register_multicast_address()\r\n") 3345 } 3346 msg := startWriteMessage(0x00, 0x0E, 0x17, uint32(r.seq)) 3347 3348 // mac : in []uint8 (6) 3349 msg = append(msg, mac...) 3350 3351 r.performRequest(msg) 3352 3353 r.read() 3354 widx := 8 3355 3356 var result int32 3357 x := binary.LittleEndian.Uint32(payload[widx:]) 3358 result = int32(x) 3359 3360 r.seq++ 3361 return result 3362 } 3363 3364 func (r *rtl8720dn) rpc_wifi_unregister_multicast_address(mac []uint8) int32 { 3365 if r.debug { 3366 fmt.Printf("rpc_wifi_unregister_multicast_address()\r\n") 3367 } 3368 msg := startWriteMessage(0x00, 0x0E, 0x18, uint32(r.seq)) 3369 3370 // mac : in []uint8 (6) 3371 msg = append(msg, mac...) 3372 3373 r.performRequest(msg) 3374 3375 r.read() 3376 widx := 8 3377 3378 var result int32 3379 x := binary.LittleEndian.Uint32(payload[widx:]) 3380 result = int32(x) 3381 3382 r.seq++ 3383 return result 3384 } 3385 3386 func (r *rtl8720dn) rpc_wifi_rf_on() int32 { 3387 if r.debug { 3388 fmt.Printf("rpc_wifi_rf_on()\r\n") 3389 } 3390 msg := startWriteMessage(0x00, 0x0E, 0x19, uint32(r.seq)) 3391 3392 r.performRequest(msg) 3393 3394 r.read() 3395 widx := 8 3396 var result int32 3397 x := binary.LittleEndian.Uint32(payload[widx:]) 3398 result = int32(x) 3399 3400 r.seq++ 3401 return result 3402 } 3403 3404 func (r *rtl8720dn) rpc_wifi_rf_off() int32 { 3405 if r.debug { 3406 fmt.Printf("rpc_wifi_rf_off()\r\n") 3407 } 3408 msg := startWriteMessage(0x00, 0x0E, 0x1A, uint32(r.seq)) 3409 3410 r.performRequest(msg) 3411 3412 r.read() 3413 widx := 8 3414 var result int32 3415 x := binary.LittleEndian.Uint32(payload[widx:]) 3416 result = int32(x) 3417 3418 r.seq++ 3419 return result 3420 } 3421 3422 func (r *rtl8720dn) rpc_wifi_on(mode uint32) int32 { 3423 if r.debug { 3424 fmt.Printf("rpc_wifi_on()\r\n") 3425 } 3426 msg := startWriteMessage(0x00, 0x0E, 0x1B, uint32(r.seq)) 3427 3428 // mode : in uint32 3429 msg = append(msg, byte(mode>>0)) 3430 msg = append(msg, byte(mode>>8)) 3431 msg = append(msg, byte(mode>>16)) 3432 msg = append(msg, byte(mode>>24)) 3433 3434 r.performRequest(msg) 3435 3436 r.read() 3437 widx := 8 3438 3439 var result int32 3440 x := binary.LittleEndian.Uint32(payload[widx:]) 3441 result = int32(x) 3442 3443 r.seq++ 3444 return result 3445 } 3446 3447 func (r *rtl8720dn) rpc_wifi_off() int32 { 3448 if r.debug { 3449 fmt.Printf("rpc_wifi_off()\r\n") 3450 } 3451 msg := startWriteMessage(0x00, 0x0E, 0x1C, uint32(r.seq)) 3452 3453 r.performRequest(msg) 3454 3455 r.read() 3456 widx := 8 3457 var result int32 3458 x := binary.LittleEndian.Uint32(payload[widx:]) 3459 result = int32(x) 3460 3461 r.seq++ 3462 return result 3463 } 3464 3465 func (r *rtl8720dn) rpc_wifi_set_mode(mode uint32) int32 { 3466 if r.debug { 3467 fmt.Printf("rpc_wifi_set_mode()\r\n") 3468 } 3469 msg := startWriteMessage(0x00, 0x0E, 0x1D, uint32(r.seq)) 3470 3471 // mode : in uint32 3472 msg = append(msg, byte(mode>>0)) 3473 msg = append(msg, byte(mode>>8)) 3474 msg = append(msg, byte(mode>>16)) 3475 msg = append(msg, byte(mode>>24)) 3476 3477 r.performRequest(msg) 3478 3479 r.read() 3480 widx := 8 3481 3482 var result int32 3483 x := binary.LittleEndian.Uint32(payload[widx:]) 3484 result = int32(x) 3485 3486 r.seq++ 3487 return result 3488 } 3489 3490 func (r *rtl8720dn) rpc_wifi_off_fastly() int32 { 3491 if r.debug { 3492 fmt.Printf("rpc_wifi_off_fastly()\r\n") 3493 } 3494 msg := startWriteMessage(0x00, 0x0E, 0x1E, uint32(r.seq)) 3495 3496 r.performRequest(msg) 3497 3498 r.read() 3499 widx := 8 3500 var result int32 3501 x := binary.LittleEndian.Uint32(payload[widx:]) 3502 result = int32(x) 3503 3504 r.seq++ 3505 return result 3506 } 3507 3508 func (r *rtl8720dn) rpc_wifi_set_power_mode(ips_mode uint8, lps_mode uint8) int32 { 3509 if r.debug { 3510 fmt.Printf("rpc_wifi_set_power_mode()\r\n") 3511 } 3512 msg := startWriteMessage(0x00, 0x0E, 0x1F, uint32(r.seq)) 3513 3514 // ips_mode : in uint8 3515 msg = append(msg, byte(ips_mode>>0)) 3516 // lps_mode : in uint8 3517 msg = append(msg, byte(lps_mode>>0)) 3518 3519 r.performRequest(msg) 3520 3521 r.read() 3522 widx := 8 3523 3524 var result int32 3525 x := binary.LittleEndian.Uint32(payload[widx:]) 3526 result = int32(x) 3527 3528 r.seq++ 3529 return result 3530 } 3531 3532 func (r *rtl8720dn) rpc_wifi_set_tdma_param(slot_period uint8, rfon_period_len_1 uint8, rfon_period_len_2 uint8, rfon_period_len_3 uint8) int32 { 3533 if r.debug { 3534 fmt.Printf("rpc_wifi_set_tdma_param()\r\n") 3535 } 3536 msg := startWriteMessage(0x00, 0x0E, 0x20, uint32(r.seq)) 3537 3538 // slot_period : in uint8 3539 msg = append(msg, byte(slot_period>>0)) 3540 // rfon_period_len_1 : in uint8 3541 msg = append(msg, byte(rfon_period_len_1>>0)) 3542 // rfon_period_len_2 : in uint8 3543 msg = append(msg, byte(rfon_period_len_2>>0)) 3544 // rfon_period_len_3 : in uint8 3545 msg = append(msg, byte(rfon_period_len_3>>0)) 3546 3547 r.performRequest(msg) 3548 3549 r.read() 3550 widx := 8 3551 3552 var result int32 3553 x := binary.LittleEndian.Uint32(payload[widx:]) 3554 result = int32(x) 3555 3556 r.seq++ 3557 return result 3558 } 3559 3560 func (r *rtl8720dn) rpc_wifi_set_lps_dtim(dtim uint8) int32 { 3561 if r.debug { 3562 fmt.Printf("rpc_wifi_set_lps_dtim()\r\n") 3563 } 3564 msg := startWriteMessage(0x00, 0x0E, 0x21, uint32(r.seq)) 3565 3566 // dtim : in uint8 3567 msg = append(msg, byte(dtim>>0)) 3568 3569 r.performRequest(msg) 3570 3571 r.read() 3572 widx := 8 3573 3574 var result int32 3575 x := binary.LittleEndian.Uint32(payload[widx:]) 3576 result = int32(x) 3577 3578 r.seq++ 3579 return result 3580 } 3581 3582 func (r *rtl8720dn) rpc_wifi_get_lps_dtim(dtim *uint8) int32 { 3583 if r.debug { 3584 fmt.Printf("rpc_wifi_get_lps_dtim()\r\n") 3585 } 3586 msg := startWriteMessage(0x00, 0x0E, 0x22, uint32(r.seq)) 3587 3588 r.performRequest(msg) 3589 3590 r.read() 3591 widx := 8 3592 // dtim : out uint8 3593 *dtim = payload[widx] 3594 widx += 1 3595 3596 var result int32 3597 x := binary.LittleEndian.Uint32(payload[widx:]) 3598 result = int32(x) 3599 3600 r.seq++ 3601 return result 3602 } 3603 3604 func (r *rtl8720dn) rpc_wifi_set_lps_thresh(mode uint8) int32 { 3605 if r.debug { 3606 fmt.Printf("rpc_wifi_set_lps_thresh()\r\n") 3607 } 3608 msg := startWriteMessage(0x00, 0x0E, 0x23, uint32(r.seq)) 3609 3610 // mode : in uint8 3611 msg = append(msg, byte(mode>>0)) 3612 3613 r.performRequest(msg) 3614 3615 r.read() 3616 widx := 8 3617 3618 var result int32 3619 x := binary.LittleEndian.Uint32(payload[widx:]) 3620 result = int32(x) 3621 3622 r.seq++ 3623 return result 3624 } 3625 3626 func (r *rtl8720dn) rpc_wifi_set_lps_level(lps_level uint8) int32 { 3627 if r.debug { 3628 fmt.Printf("rpc_wifi_set_lps_level()\r\n") 3629 } 3630 msg := startWriteMessage(0x00, 0x0E, 0x24, uint32(r.seq)) 3631 3632 // lps_level : in uint8 3633 msg = append(msg, byte(lps_level>>0)) 3634 3635 r.performRequest(msg) 3636 3637 r.read() 3638 widx := 8 3639 3640 var result int32 3641 x := binary.LittleEndian.Uint32(payload[widx:]) 3642 result = int32(x) 3643 3644 r.seq++ 3645 return result 3646 } 3647 3648 func (r *rtl8720dn) rpc_wifi_set_mfp_support(value uint8) int32 { 3649 if r.debug { 3650 fmt.Printf("rpc_wifi_set_mfp_support()\r\n") 3651 } 3652 msg := startWriteMessage(0x00, 0x0E, 0x25, uint32(r.seq)) 3653 3654 // value : in uint8 3655 msg = append(msg, byte(value>>0)) 3656 3657 r.performRequest(msg) 3658 3659 r.read() 3660 widx := 8 3661 3662 var result int32 3663 x := binary.LittleEndian.Uint32(payload[widx:]) 3664 result = int32(x) 3665 3666 r.seq++ 3667 return result 3668 } 3669 3670 func (r *rtl8720dn) rpc_wifi_start_ap(ssid string, password string, security_type uint32, channel int32) int32 { 3671 if r.debug { 3672 fmt.Printf("rpc_wifi_start_ap()\r\n") 3673 } 3674 msg := startWriteMessage(0x00, 0x0E, 0x26, uint32(r.seq)) 3675 3676 // ssid : in string 3677 msg = append(msg, byte(len(ssid)), byte(len(ssid)>>8), byte(len(ssid)>>16), byte(len(ssid)>>24)) 3678 msg = append(msg, []byte(ssid)...) 3679 // password : in string nullable 3680 if len(password) == 0 { 3681 msg = append(msg, 1) 3682 } else { 3683 msg = append(msg, 0) 3684 msg = append(msg, byte(len(password)), byte(len(password)>>8), byte(len(password)>>16), byte(len(password)>>24)) 3685 msg = append(msg, []byte(password)...) 3686 } 3687 // security_type : in uint32 3688 msg = append(msg, byte(security_type>>0)) 3689 msg = append(msg, byte(security_type>>8)) 3690 msg = append(msg, byte(security_type>>16)) 3691 msg = append(msg, byte(security_type>>24)) 3692 // channel : in int32 3693 msg = append(msg, byte(channel>>0)) 3694 msg = append(msg, byte(channel>>8)) 3695 msg = append(msg, byte(channel>>16)) 3696 msg = append(msg, byte(channel>>24)) 3697 3698 r.performRequest(msg) 3699 3700 r.read() 3701 widx := 8 3702 3703 var result int32 3704 x := binary.LittleEndian.Uint32(payload[widx:]) 3705 result = int32(x) 3706 3707 r.seq++ 3708 return result 3709 } 3710 3711 func (r *rtl8720dn) rpc_wifi_start_ap_with_hidden_ssid(ssid string, password string, security_type uint32, channel int32) int32 { 3712 if r.debug { 3713 fmt.Printf("rpc_wifi_start_ap_with_hidden_ssid()\r\n") 3714 } 3715 msg := startWriteMessage(0x00, 0x0E, 0x27, uint32(r.seq)) 3716 3717 // ssid : in string 3718 msg = append(msg, byte(len(ssid)), byte(len(ssid)>>8), byte(len(ssid)>>16), byte(len(ssid)>>24)) 3719 msg = append(msg, []byte(ssid)...) 3720 // password : in string nullable 3721 if len(password) == 0 { 3722 msg = append(msg, 1) 3723 } else { 3724 msg = append(msg, 0) 3725 msg = append(msg, byte(len(password)), byte(len(password)>>8), byte(len(password)>>16), byte(len(password)>>24)) 3726 msg = append(msg, []byte(password)...) 3727 } 3728 // security_type : in uint32 3729 msg = append(msg, byte(security_type>>0)) 3730 msg = append(msg, byte(security_type>>8)) 3731 msg = append(msg, byte(security_type>>16)) 3732 msg = append(msg, byte(security_type>>24)) 3733 // channel : in int32 3734 msg = append(msg, byte(channel>>0)) 3735 msg = append(msg, byte(channel>>8)) 3736 msg = append(msg, byte(channel>>16)) 3737 msg = append(msg, byte(channel>>24)) 3738 3739 r.performRequest(msg) 3740 3741 r.read() 3742 widx := 8 3743 3744 var result int32 3745 x := binary.LittleEndian.Uint32(payload[widx:]) 3746 result = int32(x) 3747 3748 r.seq++ 3749 return result 3750 } 3751 3752 func (r *rtl8720dn) rpc_wifi_set_pscan_chan(channel_list []byte, pscan_config uint8) int32 { 3753 if r.debug { 3754 fmt.Printf("rpc_wifi_set_pscan_chan()\r\n") 3755 } 3756 msg := startWriteMessage(0x00, 0x0E, 0x28, uint32(r.seq)) 3757 3758 // channel_list : in []byte 3759 msg = append(msg, byte(len(channel_list)), byte(len(channel_list)>>8), byte(len(channel_list)>>16), byte(len(channel_list)>>24)) 3760 msg = append(msg, []byte(channel_list)...) 3761 // pscan_config : in uint8 3762 msg = append(msg, byte(pscan_config>>0)) 3763 3764 r.performRequest(msg) 3765 3766 r.read() 3767 widx := 8 3768 3769 var result int32 3770 x := binary.LittleEndian.Uint32(payload[widx:]) 3771 result = int32(x) 3772 3773 r.seq++ 3774 return result 3775 } 3776 3777 func (r *rtl8720dn) rpc_wifi_get_setting(ifname string, pSetting []byte) int32 { 3778 if r.debug { 3779 fmt.Printf("rpc_wifi_get_setting()\r\n") 3780 } 3781 msg := startWriteMessage(0x00, 0x0E, 0x29, uint32(r.seq)) 3782 3783 // ifname : in string 3784 msg = append(msg, byte(len(ifname)), byte(len(ifname)>>8), byte(len(ifname)>>16), byte(len(ifname)>>24)) 3785 msg = append(msg, []byte(ifname)...) 3786 3787 r.performRequest(msg) 3788 3789 r.read() 3790 widx := 8 3791 // pSetting : out []byte 3792 pSetting_length := binary.LittleEndian.Uint32(payload[widx:]) 3793 widx += 4 3794 if pSetting_length > 0 { 3795 copy(pSetting, payload[widx:widx+int(pSetting_length)]) 3796 widx += int(pSetting_length) 3797 } 3798 3799 var result int32 3800 x := binary.LittleEndian.Uint32(payload[widx:]) 3801 result = int32(x) 3802 3803 r.seq++ 3804 return result 3805 } 3806 3807 func (r *rtl8720dn) rpc_wifi_set_network_mode(mode uint32) int32 { 3808 if r.debug { 3809 fmt.Printf("rpc_wifi_set_network_mode()\r\n") 3810 } 3811 msg := startWriteMessage(0x00, 0x0E, 0x2A, uint32(r.seq)) 3812 3813 // mode : in uint32 3814 msg = append(msg, byte(mode>>0)) 3815 msg = append(msg, byte(mode>>8)) 3816 msg = append(msg, byte(mode>>16)) 3817 msg = append(msg, byte(mode>>24)) 3818 3819 r.performRequest(msg) 3820 3821 r.read() 3822 widx := 8 3823 3824 var result int32 3825 x := binary.LittleEndian.Uint32(payload[widx:]) 3826 result = int32(x) 3827 3828 r.seq++ 3829 return result 3830 } 3831 3832 func (r *rtl8720dn) rpc_wifi_get_network_mode(pmode *uint32) int32 { 3833 if r.debug { 3834 fmt.Printf("rpc_wifi_get_network_mode()\r\n") 3835 } 3836 msg := startWriteMessage(0x00, 0x0E, 0x2B, uint32(r.seq)) 3837 3838 r.performRequest(msg) 3839 3840 r.read() 3841 widx := 8 3842 // pmode : out uint32 3843 *pmode = binary.LittleEndian.Uint32(payload[widx:]) 3844 widx += 4 3845 3846 var result int32 3847 x := binary.LittleEndian.Uint32(payload[widx:]) 3848 result = int32(x) 3849 3850 r.seq++ 3851 return result 3852 } 3853 3854 func (r *rtl8720dn) rpc_wifi_set_wps_phase(is_trigger_wps uint8) int32 { 3855 if r.debug { 3856 fmt.Printf("rpc_wifi_set_wps_phase()\r\n") 3857 } 3858 msg := startWriteMessage(0x00, 0x0E, 0x2C, uint32(r.seq)) 3859 3860 // is_trigger_wps : in uint8 3861 msg = append(msg, byte(is_trigger_wps>>0)) 3862 3863 r.performRequest(msg) 3864 3865 r.read() 3866 widx := 8 3867 3868 var result int32 3869 x := binary.LittleEndian.Uint32(payload[widx:]) 3870 result = int32(x) 3871 3872 r.seq++ 3873 return result 3874 } 3875 3876 func (r *rtl8720dn) rpc_wifi_restart_ap(ssid []byte, password []byte, security_type uint32, channel int32) int32 { 3877 if r.debug { 3878 fmt.Printf("rpc_wifi_restart_ap()\r\n") 3879 } 3880 msg := startWriteMessage(0x00, 0x0E, 0x2D, uint32(r.seq)) 3881 3882 // ssid : in []byte 3883 msg = append(msg, byte(len(ssid)), byte(len(ssid)>>8), byte(len(ssid)>>16), byte(len(ssid)>>24)) 3884 msg = append(msg, []byte(ssid)...) 3885 // password : in []byte 3886 msg = append(msg, byte(len(password)), byte(len(password)>>8), byte(len(password)>>16), byte(len(password)>>24)) 3887 msg = append(msg, []byte(password)...) 3888 // security_type : in uint32 3889 msg = append(msg, byte(security_type>>0)) 3890 msg = append(msg, byte(security_type>>8)) 3891 msg = append(msg, byte(security_type>>16)) 3892 msg = append(msg, byte(security_type>>24)) 3893 // channel : in int32 3894 msg = append(msg, byte(channel>>0)) 3895 msg = append(msg, byte(channel>>8)) 3896 msg = append(msg, byte(channel>>16)) 3897 msg = append(msg, byte(channel>>24)) 3898 3899 r.performRequest(msg) 3900 3901 r.read() 3902 widx := 8 3903 3904 var result int32 3905 x := binary.LittleEndian.Uint32(payload[widx:]) 3906 result = int32(x) 3907 3908 r.seq++ 3909 return result 3910 } 3911 3912 func (r *rtl8720dn) rpc_wifi_config_autoreconnect(mode uint8, retry_times uint8, timeout uint16) int32 { 3913 if r.debug { 3914 fmt.Printf("rpc_wifi_config_autoreconnect()\r\n") 3915 } 3916 msg := startWriteMessage(0x00, 0x0E, 0x2E, uint32(r.seq)) 3917 3918 // mode : in uint8 3919 msg = append(msg, byte(mode>>0)) 3920 // retry_times : in uint8 3921 msg = append(msg, byte(retry_times>>0)) 3922 // timeout : in uint16 3923 msg = append(msg, byte(timeout>>0)) 3924 msg = append(msg, byte(timeout>>8)) 3925 3926 r.performRequest(msg) 3927 3928 r.read() 3929 widx := 8 3930 3931 var result int32 3932 x := binary.LittleEndian.Uint32(payload[widx:]) 3933 result = int32(x) 3934 3935 r.seq++ 3936 return result 3937 } 3938 3939 func (r *rtl8720dn) rpc_wifi_set_autoreconnect(mode uint8) int32 { 3940 if r.debug { 3941 fmt.Printf("rpc_wifi_set_autoreconnect()\r\n") 3942 } 3943 msg := startWriteMessage(0x00, 0x0E, 0x2F, uint32(r.seq)) 3944 3945 // mode : in uint8 3946 msg = append(msg, byte(mode>>0)) 3947 3948 r.performRequest(msg) 3949 3950 r.read() 3951 widx := 8 3952 3953 var result int32 3954 x := binary.LittleEndian.Uint32(payload[widx:]) 3955 result = int32(x) 3956 3957 r.seq++ 3958 return result 3959 } 3960 3961 func (r *rtl8720dn) rpc_wifi_get_autoreconnect(mode *uint8) int32 { 3962 if r.debug { 3963 fmt.Printf("rpc_wifi_get_autoreconnect()\r\n") 3964 } 3965 msg := startWriteMessage(0x00, 0x0E, 0x30, uint32(r.seq)) 3966 3967 r.performRequest(msg) 3968 3969 r.read() 3970 widx := 8 3971 // mode : out uint8 3972 *mode = payload[widx] 3973 widx += 1 3974 3975 var result int32 3976 x := binary.LittleEndian.Uint32(payload[widx:]) 3977 result = int32(x) 3978 3979 r.seq++ 3980 return result 3981 } 3982 3983 func (r *rtl8720dn) rpc_wifi_get_last_error() int32 { 3984 if r.debug { 3985 fmt.Printf("rpc_wifi_get_last_error()\r\n") 3986 } 3987 msg := startWriteMessage(0x00, 0x0E, 0x31, uint32(r.seq)) 3988 3989 r.performRequest(msg) 3990 3991 r.read() 3992 widx := 8 3993 var result int32 3994 x := binary.LittleEndian.Uint32(payload[widx:]) 3995 result = int32(x) 3996 3997 r.seq++ 3998 return result 3999 } 4000 4001 func (r *rtl8720dn) rpc_wifi_add_custom_ie(cus_ie []byte) int32 { 4002 if r.debug { 4003 fmt.Printf("rpc_wifi_add_custom_ie()\r\n") 4004 } 4005 msg := startWriteMessage(0x00, 0x0E, 0x32, uint32(r.seq)) 4006 4007 // cus_ie : in []byte 4008 msg = append(msg, byte(len(cus_ie)), byte(len(cus_ie)>>8), byte(len(cus_ie)>>16), byte(len(cus_ie)>>24)) 4009 msg = append(msg, []byte(cus_ie)...) 4010 4011 r.performRequest(msg) 4012 4013 r.read() 4014 widx := 8 4015 4016 var result int32 4017 x := binary.LittleEndian.Uint32(payload[widx:]) 4018 result = int32(x) 4019 4020 r.seq++ 4021 return result 4022 } 4023 4024 func (r *rtl8720dn) rpc_wifi_update_custom_ie(cus_ie []byte, ie_index int32) int32 { 4025 if r.debug { 4026 fmt.Printf("rpc_wifi_update_custom_ie()\r\n") 4027 } 4028 msg := startWriteMessage(0x00, 0x0E, 0x33, uint32(r.seq)) 4029 4030 // cus_ie : in []byte 4031 msg = append(msg, byte(len(cus_ie)), byte(len(cus_ie)>>8), byte(len(cus_ie)>>16), byte(len(cus_ie)>>24)) 4032 msg = append(msg, []byte(cus_ie)...) 4033 // ie_index : in int32 4034 msg = append(msg, byte(ie_index>>0)) 4035 msg = append(msg, byte(ie_index>>8)) 4036 msg = append(msg, byte(ie_index>>16)) 4037 msg = append(msg, byte(ie_index>>24)) 4038 4039 r.performRequest(msg) 4040 4041 r.read() 4042 widx := 8 4043 4044 var result int32 4045 x := binary.LittleEndian.Uint32(payload[widx:]) 4046 result = int32(x) 4047 4048 r.seq++ 4049 return result 4050 } 4051 4052 func (r *rtl8720dn) rpc_wifi_del_custom_ie() int32 { 4053 if r.debug { 4054 fmt.Printf("rpc_wifi_del_custom_ie()\r\n") 4055 } 4056 msg := startWriteMessage(0x00, 0x0E, 0x34, uint32(r.seq)) 4057 4058 r.performRequest(msg) 4059 4060 r.read() 4061 widx := 8 4062 var result int32 4063 x := binary.LittleEndian.Uint32(payload[widx:]) 4064 result = int32(x) 4065 4066 r.seq++ 4067 return result 4068 } 4069 4070 func (r *rtl8720dn) rpc_wifi_set_indicate_mgnt(enable int32) { 4071 if r.debug { 4072 fmt.Printf("rpc_wifi_set_indicate_mgnt()\r\n") 4073 } 4074 msg := startWriteMessage(0x00, 0x0E, 0x35, uint32(r.seq)) 4075 4076 // enable : in int32 4077 msg = append(msg, byte(enable>>0)) 4078 msg = append(msg, byte(enable>>8)) 4079 msg = append(msg, byte(enable>>16)) 4080 msg = append(msg, byte(enable>>24)) 4081 4082 r.performRequest(msg) 4083 4084 r.read() 4085 4086 r.seq++ 4087 return 4088 } 4089 4090 func (r *rtl8720dn) rpc_wifi_get_drv_ability(ability *uint32) int32 { 4091 if r.debug { 4092 fmt.Printf("rpc_wifi_get_drv_ability()\r\n") 4093 } 4094 msg := startWriteMessage(0x00, 0x0E, 0x36, uint32(r.seq)) 4095 4096 r.performRequest(msg) 4097 4098 r.read() 4099 widx := 8 4100 // ability : out uint32 4101 *ability = binary.LittleEndian.Uint32(payload[widx:]) 4102 widx += 4 4103 4104 var result int32 4105 x := binary.LittleEndian.Uint32(payload[widx:]) 4106 result = int32(x) 4107 4108 r.seq++ 4109 return result 4110 } 4111 4112 func (r *rtl8720dn) rpc_wifi_set_channel_plan(channel_plan uint8) int32 { 4113 if r.debug { 4114 fmt.Printf("rpc_wifi_set_channel_plan()\r\n") 4115 } 4116 msg := startWriteMessage(0x00, 0x0E, 0x37, uint32(r.seq)) 4117 4118 // channel_plan : in uint8 4119 msg = append(msg, byte(channel_plan>>0)) 4120 4121 r.performRequest(msg) 4122 4123 r.read() 4124 widx := 8 4125 4126 var result int32 4127 x := binary.LittleEndian.Uint32(payload[widx:]) 4128 result = int32(x) 4129 4130 r.seq++ 4131 return result 4132 } 4133 4134 func (r *rtl8720dn) rpc_wifi_get_channel_plan(channel_plan *uint8) int32 { 4135 if r.debug { 4136 fmt.Printf("rpc_wifi_get_channel_plan()\r\n") 4137 } 4138 msg := startWriteMessage(0x00, 0x0E, 0x38, uint32(r.seq)) 4139 4140 r.performRequest(msg) 4141 4142 r.read() 4143 widx := 8 4144 // channel_plan : out uint8 4145 *channel_plan = payload[widx] 4146 widx += 1 4147 4148 var result int32 4149 x := binary.LittleEndian.Uint32(payload[widx:]) 4150 result = int32(x) 4151 4152 r.seq++ 4153 return result 4154 } 4155 4156 func (r *rtl8720dn) rpc_wifi_enable_forwarding() int32 { 4157 if r.debug { 4158 fmt.Printf("rpc_wifi_enable_forwarding()\r\n") 4159 } 4160 msg := startWriteMessage(0x00, 0x0E, 0x39, uint32(r.seq)) 4161 4162 r.performRequest(msg) 4163 4164 r.read() 4165 widx := 8 4166 var result int32 4167 x := binary.LittleEndian.Uint32(payload[widx:]) 4168 result = int32(x) 4169 4170 r.seq++ 4171 return result 4172 } 4173 4174 func (r *rtl8720dn) rpc_wifi_disable_forwarding() int32 { 4175 if r.debug { 4176 fmt.Printf("rpc_wifi_disable_forwarding()\r\n") 4177 } 4178 msg := startWriteMessage(0x00, 0x0E, 0x3A, uint32(r.seq)) 4179 4180 r.performRequest(msg) 4181 4182 r.read() 4183 widx := 8 4184 var result int32 4185 x := binary.LittleEndian.Uint32(payload[widx:]) 4186 result = int32(x) 4187 4188 r.seq++ 4189 return result 4190 } 4191 4192 func (r *rtl8720dn) rpc_wifi_set_ch_deauth(enable uint8) int32 { 4193 if r.debug { 4194 fmt.Printf("rpc_wifi_set_ch_deauth()\r\n") 4195 } 4196 msg := startWriteMessage(0x00, 0x0E, 0x3B, uint32(r.seq)) 4197 4198 // enable : in uint8 4199 msg = append(msg, byte(enable>>0)) 4200 4201 r.performRequest(msg) 4202 4203 r.read() 4204 widx := 8 4205 4206 var result int32 4207 x := binary.LittleEndian.Uint32(payload[widx:]) 4208 result = int32(x) 4209 4210 r.seq++ 4211 return result 4212 } 4213 4214 func (r *rtl8720dn) rpc_wifi_get_band_type() uint8 { 4215 if r.debug { 4216 fmt.Printf("rpc_wifi_get_band_type()\r\n") 4217 } 4218 msg := startWriteMessage(0x00, 0x0E, 0x3C, uint32(r.seq)) 4219 4220 r.performRequest(msg) 4221 4222 r.read() 4223 widx := 8 4224 var result uint8 4225 result = uint8(binary.LittleEndian.Uint32(payload[widx:])) 4226 4227 r.seq++ 4228 return result 4229 } 4230 4231 func (r *rtl8720dn) rpc_wifi_set_tx_pause_data(NewState uint32) int32 { 4232 if r.debug { 4233 fmt.Printf("rpc_wifi_set_tx_pause_data()\r\n") 4234 } 4235 msg := startWriteMessage(0x00, 0x0E, 0x3D, uint32(r.seq)) 4236 4237 // NewState : in uint32 4238 msg = append(msg, byte(NewState>>0)) 4239 msg = append(msg, byte(NewState>>8)) 4240 msg = append(msg, byte(NewState>>16)) 4241 msg = append(msg, byte(NewState>>24)) 4242 4243 r.performRequest(msg) 4244 4245 r.read() 4246 widx := 8 4247 4248 var result int32 4249 x := binary.LittleEndian.Uint32(payload[widx:]) 4250 result = int32(x) 4251 4252 r.seq++ 4253 return result 4254 } 4255 4256 func (r *rtl8720dn) rpc_wifi_get_reconnect_data(wifi_info []byte) int32 { 4257 if r.debug { 4258 fmt.Printf("rpc_wifi_get_reconnect_data()\r\n") 4259 } 4260 msg := startWriteMessage(0x00, 0x0E, 0x3E, uint32(r.seq)) 4261 4262 r.performRequest(msg) 4263 4264 r.read() 4265 widx := 8 4266 // wifi_info : out []byte 4267 wifi_info_length := binary.LittleEndian.Uint32(payload[widx:]) 4268 widx += 4 4269 if wifi_info_length > 0 { 4270 copy(wifi_info, payload[widx:widx+int(wifi_info_length)]) 4271 widx += int(wifi_info_length) 4272 } 4273 4274 var result int32 4275 x := binary.LittleEndian.Uint32(payload[widx:]) 4276 result = int32(x) 4277 4278 r.seq++ 4279 return result 4280 } 4281 4282 func (r *rtl8720dn) rpc_wifi_clear_reconnect_data() int32 { 4283 if r.debug { 4284 fmt.Printf("rpc_wifi_clear_reconnect_data()\r\n") 4285 } 4286 msg := startWriteMessage(0x00, 0x0E, 0x3F, uint32(r.seq)) 4287 4288 r.performRequest(msg) 4289 4290 r.read() 4291 widx := 8 4292 var result int32 4293 x := binary.LittleEndian.Uint32(payload[widx:]) 4294 result = int32(x) 4295 4296 r.seq++ 4297 return result 4298 } 4299 4300 func (r *rtl8720dn) rpc_wifi_scan_start() int32 { 4301 if r.debug { 4302 fmt.Printf("rpc_wifi_scan_start()\r\n") 4303 } 4304 msg := startWriteMessage(0x00, 0x0E, 0x40, uint32(r.seq)) 4305 4306 r.performRequest(msg) 4307 4308 r.read() 4309 widx := 8 4310 var result int32 4311 x := binary.LittleEndian.Uint32(payload[widx:]) 4312 result = int32(x) 4313 4314 r.seq++ 4315 return result 4316 } 4317 4318 func (r *rtl8720dn) rpc_wifi_is_scaning() bool { 4319 if r.debug { 4320 fmt.Printf("rpc_wifi_is_scaning()\r\n") 4321 } 4322 msg := startWriteMessage(0x00, 0x0E, 0x41, uint32(r.seq)) 4323 4324 r.performRequest(msg) 4325 4326 r.read() 4327 widx := 8 4328 var result bool 4329 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 4330 4331 r.seq++ 4332 return result 4333 } 4334 4335 func (r *rtl8720dn) rpc_wifi_scan_get_ap_records(number uint16, _scanResult []byte) int32 { 4336 if r.debug { 4337 fmt.Printf("rpc_wifi_scan_get_ap_records()\r\n") 4338 } 4339 msg := startWriteMessage(0x00, 0x0E, 0x42, uint32(r.seq)) 4340 4341 // number : in uint16 4342 msg = append(msg, byte(number>>0)) 4343 msg = append(msg, byte(number>>8)) 4344 4345 r.performRequest(msg) 4346 4347 r.read() 4348 widx := 8 4349 // _scanResult : out []byte 4350 _scanResult_length := binary.LittleEndian.Uint32(payload[widx:]) 4351 widx += 4 4352 if _scanResult_length > 0 { 4353 copy(_scanResult, payload[widx:widx+int(_scanResult_length)]) 4354 widx += int(_scanResult_length) 4355 } 4356 4357 var result int32 4358 x := binary.LittleEndian.Uint32(payload[widx:]) 4359 result = int32(x) 4360 4361 r.seq++ 4362 return result 4363 } 4364 4365 func (r *rtl8720dn) rpc_wifi_scan_get_ap_num() uint16 { 4366 if r.debug { 4367 fmt.Printf("rpc_wifi_scan_get_ap_num()\r\n") 4368 } 4369 msg := startWriteMessage(0x00, 0x0E, 0x43, uint32(r.seq)) 4370 4371 r.performRequest(msg) 4372 4373 r.read() 4374 widx := 8 4375 var result uint16 4376 result = uint16(binary.LittleEndian.Uint32(payload[widx:])) 4377 4378 r.seq++ 4379 return result 4380 } 4381 4382 func (r *rtl8720dn) rpc_tcpip_adapter_init() int32 { 4383 if r.debug { 4384 fmt.Printf("rpc_tcpip_adapter_init()\r\n") 4385 } 4386 msg := startWriteMessage(0x00, 0x0F, 0x01, uint32(r.seq)) 4387 4388 r.performRequest(msg) 4389 4390 r.read() 4391 widx := 8 4392 var result int32 4393 x := binary.LittleEndian.Uint32(payload[widx:]) 4394 result = int32(x) 4395 4396 r.seq++ 4397 return result 4398 } 4399 4400 func (r *rtl8720dn) rpc_tcpip_adapter_sta_start(mac []byte, ip_info []byte) int32 { 4401 if r.debug { 4402 fmt.Printf("rpc_tcpip_adapter_sta_start()\r\n") 4403 } 4404 msg := startWriteMessage(0x00, 0x0F, 0x02, uint32(r.seq)) 4405 4406 // mac : in []byte 4407 msg = append(msg, byte(len(mac)), byte(len(mac)>>8), byte(len(mac)>>16), byte(len(mac)>>24)) 4408 msg = append(msg, []byte(mac)...) 4409 // ip_info : in []byte 4410 msg = append(msg, byte(len(ip_info)), byte(len(ip_info)>>8), byte(len(ip_info)>>16), byte(len(ip_info)>>24)) 4411 msg = append(msg, []byte(ip_info)...) 4412 4413 r.performRequest(msg) 4414 4415 r.read() 4416 widx := 8 4417 4418 var result int32 4419 x := binary.LittleEndian.Uint32(payload[widx:]) 4420 result = int32(x) 4421 4422 r.seq++ 4423 return result 4424 } 4425 4426 func (r *rtl8720dn) rpc_tcpip_adapter_ap_start(mac []byte, ip_info []byte) int32 { 4427 if r.debug { 4428 fmt.Printf("rpc_tcpip_adapter_ap_start()\r\n") 4429 } 4430 msg := startWriteMessage(0x00, 0x0F, 0x03, uint32(r.seq)) 4431 4432 // mac : in []byte 4433 msg = append(msg, byte(len(mac)), byte(len(mac)>>8), byte(len(mac)>>16), byte(len(mac)>>24)) 4434 msg = append(msg, []byte(mac)...) 4435 // ip_info : in []byte 4436 msg = append(msg, byte(len(ip_info)), byte(len(ip_info)>>8), byte(len(ip_info)>>16), byte(len(ip_info)>>24)) 4437 msg = append(msg, []byte(ip_info)...) 4438 4439 r.performRequest(msg) 4440 4441 r.read() 4442 widx := 8 4443 4444 var result int32 4445 x := binary.LittleEndian.Uint32(payload[widx:]) 4446 result = int32(x) 4447 4448 r.seq++ 4449 return result 4450 } 4451 4452 func (r *rtl8720dn) rpc_tcpip_adapter_stop(tcpip_if uint32) int32 { 4453 if r.debug { 4454 fmt.Printf("rpc_tcpip_adapter_stop()\r\n") 4455 } 4456 msg := startWriteMessage(0x00, 0x0F, 0x04, uint32(r.seq)) 4457 4458 // tcpip_if : in uint32 4459 msg = append(msg, byte(tcpip_if>>0)) 4460 msg = append(msg, byte(tcpip_if>>8)) 4461 msg = append(msg, byte(tcpip_if>>16)) 4462 msg = append(msg, byte(tcpip_if>>24)) 4463 4464 r.performRequest(msg) 4465 4466 r.read() 4467 widx := 8 4468 4469 var result int32 4470 x := binary.LittleEndian.Uint32(payload[widx:]) 4471 result = int32(x) 4472 4473 r.seq++ 4474 return result 4475 } 4476 4477 func (r *rtl8720dn) rpc_tcpip_adapter_up(tcpip_if uint32) int32 { 4478 if r.debug { 4479 fmt.Printf("rpc_tcpip_adapter_up()\r\n") 4480 } 4481 msg := startWriteMessage(0x00, 0x0F, 0x05, uint32(r.seq)) 4482 4483 // tcpip_if : in uint32 4484 msg = append(msg, byte(tcpip_if>>0)) 4485 msg = append(msg, byte(tcpip_if>>8)) 4486 msg = append(msg, byte(tcpip_if>>16)) 4487 msg = append(msg, byte(tcpip_if>>24)) 4488 4489 r.performRequest(msg) 4490 4491 r.read() 4492 widx := 8 4493 4494 var result int32 4495 x := binary.LittleEndian.Uint32(payload[widx:]) 4496 result = int32(x) 4497 4498 r.seq++ 4499 return result 4500 } 4501 4502 func (r *rtl8720dn) rpc_tcpip_adapter_down(tcpip_if uint32) int32 { 4503 if r.debug { 4504 fmt.Printf("rpc_tcpip_adapter_down()\r\n") 4505 } 4506 msg := startWriteMessage(0x00, 0x0F, 0x06, uint32(r.seq)) 4507 4508 // tcpip_if : in uint32 4509 msg = append(msg, byte(tcpip_if>>0)) 4510 msg = append(msg, byte(tcpip_if>>8)) 4511 msg = append(msg, byte(tcpip_if>>16)) 4512 msg = append(msg, byte(tcpip_if>>24)) 4513 4514 r.performRequest(msg) 4515 4516 r.read() 4517 widx := 8 4518 4519 var result int32 4520 x := binary.LittleEndian.Uint32(payload[widx:]) 4521 result = int32(x) 4522 4523 r.seq++ 4524 return result 4525 } 4526 4527 func (r *rtl8720dn) rpc_tcpip_adapter_get_ip_info(tcpip_if uint32, ip_info []byte) int32 { 4528 if r.debug { 4529 fmt.Printf("rpc_tcpip_adapter_get_ip_info()\r\n") 4530 } 4531 msg := startWriteMessage(0x00, 0x0F, 0x07, uint32(r.seq)) 4532 4533 // tcpip_if : in uint32 4534 msg = append(msg, byte(tcpip_if>>0)) 4535 msg = append(msg, byte(tcpip_if>>8)) 4536 msg = append(msg, byte(tcpip_if>>16)) 4537 msg = append(msg, byte(tcpip_if>>24)) 4538 4539 r.performRequest(msg) 4540 4541 r.read() 4542 widx := 8 4543 // ip_info : out []byte 4544 ip_info_length := binary.LittleEndian.Uint32(payload[widx:]) 4545 widx += 4 4546 if ip_info_length > 0 { 4547 copy(ip_info, payload[widx:widx+int(ip_info_length)]) 4548 widx += int(ip_info_length) 4549 } 4550 4551 var result int32 4552 x := binary.LittleEndian.Uint32(payload[widx:]) 4553 result = int32(x) 4554 4555 r.seq++ 4556 return result 4557 } 4558 4559 func (r *rtl8720dn) rpc_tcpip_adapter_set_ip_info(tcpip_if uint32, ip_info []byte) int32 { 4560 if r.debug { 4561 fmt.Printf("rpc_tcpip_adapter_set_ip_info()\r\n") 4562 } 4563 msg := startWriteMessage(0x00, 0x0F, 0x08, uint32(r.seq)) 4564 4565 // tcpip_if : in uint32 4566 msg = append(msg, byte(tcpip_if>>0)) 4567 msg = append(msg, byte(tcpip_if>>8)) 4568 msg = append(msg, byte(tcpip_if>>16)) 4569 msg = append(msg, byte(tcpip_if>>24)) 4570 // ip_info : in []byte 4571 msg = append(msg, byte(len(ip_info)), byte(len(ip_info)>>8), byte(len(ip_info)>>16), byte(len(ip_info)>>24)) 4572 msg = append(msg, []byte(ip_info)...) 4573 4574 r.performRequest(msg) 4575 4576 r.read() 4577 widx := 8 4578 4579 var result int32 4580 x := binary.LittleEndian.Uint32(payload[widx:]) 4581 result = int32(x) 4582 4583 r.seq++ 4584 return result 4585 } 4586 4587 func (r *rtl8720dn) rpc_tcpip_adapter_set_dns_info(tcpip_if uint32, dns_type uint32, dns []byte) int32 { 4588 if r.debug { 4589 fmt.Printf("rpc_tcpip_adapter_set_dns_info()\r\n") 4590 } 4591 msg := startWriteMessage(0x00, 0x0F, 0x09, uint32(r.seq)) 4592 4593 // tcpip_if : in uint32 4594 msg = append(msg, byte(tcpip_if>>0)) 4595 msg = append(msg, byte(tcpip_if>>8)) 4596 msg = append(msg, byte(tcpip_if>>16)) 4597 msg = append(msg, byte(tcpip_if>>24)) 4598 // dns_type : in uint32 4599 msg = append(msg, byte(dns_type>>0)) 4600 msg = append(msg, byte(dns_type>>8)) 4601 msg = append(msg, byte(dns_type>>16)) 4602 msg = append(msg, byte(dns_type>>24)) 4603 // dns : in []byte 4604 msg = append(msg, byte(len(dns)), byte(len(dns)>>8), byte(len(dns)>>16), byte(len(dns)>>24)) 4605 msg = append(msg, []byte(dns)...) 4606 4607 r.performRequest(msg) 4608 4609 r.read() 4610 widx := 8 4611 4612 var result int32 4613 x := binary.LittleEndian.Uint32(payload[widx:]) 4614 result = int32(x) 4615 4616 r.seq++ 4617 return result 4618 } 4619 4620 func (r *rtl8720dn) rpc_tcpip_adapter_get_dns_info(tcpip_if uint32, dns_type uint32, dns []byte) int32 { 4621 if r.debug { 4622 fmt.Printf("rpc_tcpip_adapter_get_dns_info()\r\n") 4623 } 4624 msg := startWriteMessage(0x00, 0x0F, 0x0A, uint32(r.seq)) 4625 4626 // tcpip_if : in uint32 4627 msg = append(msg, byte(tcpip_if>>0)) 4628 msg = append(msg, byte(tcpip_if>>8)) 4629 msg = append(msg, byte(tcpip_if>>16)) 4630 msg = append(msg, byte(tcpip_if>>24)) 4631 // dns_type : in uint32 4632 msg = append(msg, byte(dns_type>>0)) 4633 msg = append(msg, byte(dns_type>>8)) 4634 msg = append(msg, byte(dns_type>>16)) 4635 msg = append(msg, byte(dns_type>>24)) 4636 4637 r.performRequest(msg) 4638 4639 r.read() 4640 widx := 8 4641 // dns : out []byte 4642 dns_length := binary.LittleEndian.Uint32(payload[widx:]) 4643 widx += 4 4644 if dns_length > 0 { 4645 copy(dns, payload[widx:widx+int(dns_length)]) 4646 widx += int(dns_length) 4647 } 4648 4649 var result int32 4650 x := binary.LittleEndian.Uint32(payload[widx:]) 4651 result = int32(x) 4652 4653 r.seq++ 4654 return result 4655 } 4656 4657 func (r *rtl8720dn) rpc_tcpip_adapter_dhcps_start(tcpip_if uint32) int32 { 4658 if r.debug { 4659 fmt.Printf("rpc_tcpip_adapter_dhcps_start()\r\n") 4660 } 4661 msg := startWriteMessage(0x00, 0x0F, 0x0B, uint32(r.seq)) 4662 4663 // tcpip_if : in uint32 4664 msg = append(msg, byte(tcpip_if>>0)) 4665 msg = append(msg, byte(tcpip_if>>8)) 4666 msg = append(msg, byte(tcpip_if>>16)) 4667 msg = append(msg, byte(tcpip_if>>24)) 4668 4669 r.performRequest(msg) 4670 4671 r.read() 4672 widx := 8 4673 4674 var result int32 4675 x := binary.LittleEndian.Uint32(payload[widx:]) 4676 result = int32(x) 4677 4678 r.seq++ 4679 return result 4680 } 4681 4682 func (r *rtl8720dn) rpc_tcpip_adapter_dhcps_stop(tcpip_if uint32) int32 { 4683 if r.debug { 4684 fmt.Printf("rpc_tcpip_adapter_dhcps_stop()\r\n") 4685 } 4686 msg := startWriteMessage(0x00, 0x0F, 0x0C, uint32(r.seq)) 4687 4688 // tcpip_if : in uint32 4689 msg = append(msg, byte(tcpip_if>>0)) 4690 msg = append(msg, byte(tcpip_if>>8)) 4691 msg = append(msg, byte(tcpip_if>>16)) 4692 msg = append(msg, byte(tcpip_if>>24)) 4693 4694 r.performRequest(msg) 4695 4696 r.read() 4697 widx := 8 4698 4699 var result int32 4700 x := binary.LittleEndian.Uint32(payload[widx:]) 4701 result = int32(x) 4702 4703 r.seq++ 4704 return result 4705 } 4706 4707 func (r *rtl8720dn) rpc_tcpip_adapter_dhcpc_start(tcpip_if uint32) int32 { 4708 if r.debug { 4709 fmt.Printf("rpc_tcpip_adapter_dhcpc_start()\r\n") 4710 } 4711 msg := startWriteMessage(0x00, 0x0F, 0x0D, uint32(r.seq)) 4712 4713 // tcpip_if : in uint32 4714 msg = append(msg, byte(tcpip_if>>0)) 4715 msg = append(msg, byte(tcpip_if>>8)) 4716 msg = append(msg, byte(tcpip_if>>16)) 4717 msg = append(msg, byte(tcpip_if>>24)) 4718 4719 r.performRequest(msg) 4720 4721 r.read() 4722 widx := 8 4723 4724 var result int32 4725 x := binary.LittleEndian.Uint32(payload[widx:]) 4726 result = int32(x) 4727 4728 r.seq++ 4729 return result 4730 } 4731 4732 func (r *rtl8720dn) rpc_tcpip_adapter_dhcpc_stop(tcpip_if uint32) int32 { 4733 if r.debug { 4734 fmt.Printf("rpc_tcpip_adapter_dhcpc_stop()\r\n") 4735 } 4736 msg := startWriteMessage(0x00, 0x0F, 0x0E, uint32(r.seq)) 4737 4738 // tcpip_if : in uint32 4739 msg = append(msg, byte(tcpip_if>>0)) 4740 msg = append(msg, byte(tcpip_if>>8)) 4741 msg = append(msg, byte(tcpip_if>>16)) 4742 msg = append(msg, byte(tcpip_if>>24)) 4743 4744 r.performRequest(msg) 4745 4746 r.read() 4747 widx := 8 4748 4749 var result int32 4750 x := binary.LittleEndian.Uint32(payload[widx:]) 4751 result = int32(x) 4752 4753 r.seq++ 4754 return result 4755 } 4756 4757 func (r *rtl8720dn) rpc_tcpip_adapter_set_hostname(tcpip_if uint32, hostname string) int32 { 4758 if r.debug { 4759 fmt.Printf("rpc_tcpip_adapter_set_hostname()\r\n") 4760 } 4761 msg := startWriteMessage(0x00, 0x0F, 0x0F, uint32(r.seq)) 4762 4763 // tcpip_if : in uint32 4764 msg = append(msg, byte(tcpip_if>>0)) 4765 msg = append(msg, byte(tcpip_if>>8)) 4766 msg = append(msg, byte(tcpip_if>>16)) 4767 msg = append(msg, byte(tcpip_if>>24)) 4768 // hostname : in string 4769 msg = append(msg, byte(len(hostname)), byte(len(hostname)>>8), byte(len(hostname)>>16), byte(len(hostname)>>24)) 4770 msg = append(msg, []byte(hostname)...) 4771 4772 r.performRequest(msg) 4773 4774 r.read() 4775 widx := 8 4776 4777 var result int32 4778 x := binary.LittleEndian.Uint32(payload[widx:]) 4779 result = int32(x) 4780 4781 r.seq++ 4782 return result 4783 } 4784 4785 func (r *rtl8720dn) rpc_tcpip_adapter_get_hostname(tcpip_if uint32, hostname string) int32 { 4786 if r.debug { 4787 fmt.Printf("rpc_tcpip_adapter_get_hostname()\r\n") 4788 } 4789 msg := startWriteMessage(0x00, 0x0F, 0x10, uint32(r.seq)) 4790 4791 // tcpip_if : in uint32 4792 msg = append(msg, byte(tcpip_if>>0)) 4793 msg = append(msg, byte(tcpip_if>>8)) 4794 msg = append(msg, byte(tcpip_if>>16)) 4795 msg = append(msg, byte(tcpip_if>>24)) 4796 4797 r.performRequest(msg) 4798 4799 r.read() 4800 widx := 8 4801 // hostname : out string 4802 hostname_length := binary.LittleEndian.Uint32(payload[widx:]) 4803 widx += 4 4804 if hostname_length > 0 { 4805 hostname = string(payload[widx : widx+int(hostname_length)]) 4806 widx += int(hostname_length) 4807 } 4808 4809 var result int32 4810 x := binary.LittleEndian.Uint32(payload[widx:]) 4811 result = int32(x) 4812 4813 r.seq++ 4814 return result 4815 } 4816 4817 func (r *rtl8720dn) rpc_tcpip_adapter_get_mac(tcpip_if uint32, mac []byte) int32 { 4818 if r.debug { 4819 fmt.Printf("rpc_tcpip_adapter_get_mac()\r\n") 4820 } 4821 msg := startWriteMessage(0x00, 0x0F, 0x11, uint32(r.seq)) 4822 4823 // tcpip_if : in uint32 4824 msg = append(msg, byte(tcpip_if>>0)) 4825 msg = append(msg, byte(tcpip_if>>8)) 4826 msg = append(msg, byte(tcpip_if>>16)) 4827 msg = append(msg, byte(tcpip_if>>24)) 4828 4829 r.performRequest(msg) 4830 4831 r.read() 4832 widx := 8 4833 // mac : out []byte 4834 mac_length := binary.LittleEndian.Uint32(payload[widx:]) 4835 widx += 4 4836 if mac_length > 0 { 4837 copy(mac, payload[widx:widx+int(mac_length)]) 4838 widx += int(mac_length) 4839 } 4840 4841 var result int32 4842 x := binary.LittleEndian.Uint32(payload[widx:]) 4843 result = int32(x) 4844 4845 r.seq++ 4846 return result 4847 } 4848 4849 func (r *rtl8720dn) rpc_tcpip_adapter_set_mac(tcpip_if uint32, mac []byte) int32 { 4850 if r.debug { 4851 fmt.Printf("rpc_tcpip_adapter_set_mac()\r\n") 4852 } 4853 msg := startWriteMessage(0x00, 0x0F, 0x12, uint32(r.seq)) 4854 4855 // tcpip_if : in uint32 4856 msg = append(msg, byte(tcpip_if>>0)) 4857 msg = append(msg, byte(tcpip_if>>8)) 4858 msg = append(msg, byte(tcpip_if>>16)) 4859 msg = append(msg, byte(tcpip_if>>24)) 4860 // mac : in []byte 4861 msg = append(msg, byte(len(mac)), byte(len(mac)>>8), byte(len(mac)>>16), byte(len(mac)>>24)) 4862 msg = append(msg, []byte(mac)...) 4863 4864 r.performRequest(msg) 4865 4866 r.read() 4867 widx := 8 4868 4869 var result int32 4870 x := binary.LittleEndian.Uint32(payload[widx:]) 4871 result = int32(x) 4872 4873 r.seq++ 4874 return result 4875 } 4876 4877 func (r *rtl8720dn) rpc_tcpip_api_call(fn []byte, call []byte) int32 { 4878 if r.debug { 4879 fmt.Printf("rpc_tcpip_api_call()\r\n") 4880 } 4881 msg := startWriteMessage(0x00, 0x0F, 0x13, uint32(r.seq)) 4882 4883 // fn : in []byte 4884 msg = append(msg, byte(len(fn)), byte(len(fn)>>8), byte(len(fn)>>16), byte(len(fn)>>24)) 4885 msg = append(msg, []byte(fn)...) 4886 // call : in []byte 4887 msg = append(msg, byte(len(call)), byte(len(call)>>8), byte(len(call)>>16), byte(len(call)>>24)) 4888 msg = append(msg, []byte(call)...) 4889 4890 r.performRequest(msg) 4891 4892 r.read() 4893 widx := 8 4894 4895 var result int32 4896 x := binary.LittleEndian.Uint32(payload[widx:]) 4897 result = int32(x) 4898 4899 r.seq++ 4900 return result 4901 } 4902 4903 func (r *rtl8720dn) rpc_tcp_connect(pcb_in []byte, pcb_out []byte, ipaddr []byte, port uint16, connected []byte) int32 { 4904 if r.debug { 4905 fmt.Printf("rpc_tcp_connect()\r\n") 4906 } 4907 msg := startWriteMessage(0x00, 0x0F, 0x14, uint32(r.seq)) 4908 4909 // pcb_in : in []byte 4910 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 4911 msg = append(msg, []byte(pcb_in)...) 4912 // ipaddr : in []byte 4913 msg = append(msg, byte(len(ipaddr)), byte(len(ipaddr)>>8), byte(len(ipaddr)>>16), byte(len(ipaddr)>>24)) 4914 msg = append(msg, []byte(ipaddr)...) 4915 // port : in uint16 4916 msg = append(msg, byte(port>>0)) 4917 msg = append(msg, byte(port>>8)) 4918 // connected : in []byte 4919 msg = append(msg, byte(len(connected)), byte(len(connected)>>8), byte(len(connected)>>16), byte(len(connected)>>24)) 4920 msg = append(msg, []byte(connected)...) 4921 4922 r.performRequest(msg) 4923 4924 r.read() 4925 widx := 8 4926 // pcb_out : out []byte 4927 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 4928 widx += 4 4929 if pcb_out_length > 0 { 4930 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 4931 widx += int(pcb_out_length) 4932 } 4933 4934 var result int32 4935 x := binary.LittleEndian.Uint32(payload[widx:]) 4936 result = int32(x) 4937 4938 r.seq++ 4939 return result 4940 } 4941 4942 func (r *rtl8720dn) rpc_tcp_recved(pcb_in []byte, pcb_out []byte, length uint16) int32 { 4943 if r.debug { 4944 fmt.Printf("rpc_tcp_recved()\r\n") 4945 } 4946 msg := startWriteMessage(0x00, 0x0F, 0x15, uint32(r.seq)) 4947 4948 // pcb_in : in []byte 4949 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 4950 msg = append(msg, []byte(pcb_in)...) 4951 // length : in uint16 4952 msg = append(msg, byte(length>>0)) 4953 msg = append(msg, byte(length>>8)) 4954 4955 r.performRequest(msg) 4956 4957 r.read() 4958 widx := 8 4959 // pcb_out : out []byte 4960 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 4961 widx += 4 4962 if pcb_out_length > 0 { 4963 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 4964 widx += int(pcb_out_length) 4965 } 4966 4967 var result int32 4968 x := binary.LittleEndian.Uint32(payload[widx:]) 4969 result = int32(x) 4970 4971 r.seq++ 4972 return result 4973 } 4974 4975 func (r *rtl8720dn) rpc_tcp_abort(pcb_in []byte, pcb_out []byte) int32 { 4976 if r.debug { 4977 fmt.Printf("rpc_tcp_abort()\r\n") 4978 } 4979 msg := startWriteMessage(0x00, 0x0F, 0x16, uint32(r.seq)) 4980 4981 // pcb_in : in []byte 4982 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 4983 msg = append(msg, []byte(pcb_in)...) 4984 4985 r.performRequest(msg) 4986 4987 r.read() 4988 widx := 8 4989 // pcb_out : out []byte 4990 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 4991 widx += 4 4992 if pcb_out_length > 0 { 4993 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 4994 widx += int(pcb_out_length) 4995 } 4996 4997 var result int32 4998 x := binary.LittleEndian.Uint32(payload[widx:]) 4999 result = int32(x) 5000 5001 r.seq++ 5002 return result 5003 } 5004 5005 func (r *rtl8720dn) rpc_tcp_write(pcb_in []byte, pcb_out []byte, data []byte, apiflags uint8) int32 { 5006 if r.debug { 5007 fmt.Printf("rpc_tcp_write()\r\n") 5008 } 5009 msg := startWriteMessage(0x00, 0x0F, 0x17, uint32(r.seq)) 5010 5011 // pcb_in : in []byte 5012 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5013 msg = append(msg, []byte(pcb_in)...) 5014 // data : in []byte 5015 msg = append(msg, byte(len(data)), byte(len(data)>>8), byte(len(data)>>16), byte(len(data)>>24)) 5016 msg = append(msg, []byte(data)...) 5017 // apiflags : in uint8 5018 msg = append(msg, byte(apiflags>>0)) 5019 5020 r.performRequest(msg) 5021 5022 r.read() 5023 widx := 8 5024 // pcb_out : out []byte 5025 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5026 widx += 4 5027 if pcb_out_length > 0 { 5028 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5029 widx += int(pcb_out_length) 5030 } 5031 5032 var result int32 5033 x := binary.LittleEndian.Uint32(payload[widx:]) 5034 result = int32(x) 5035 5036 r.seq++ 5037 return result 5038 } 5039 5040 func (r *rtl8720dn) rpc_tcp_output(pcb_in []byte, pcb_out []byte) int32 { 5041 if r.debug { 5042 fmt.Printf("rpc_tcp_output()\r\n") 5043 } 5044 msg := startWriteMessage(0x00, 0x0F, 0x18, uint32(r.seq)) 5045 5046 // pcb_in : in []byte 5047 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5048 msg = append(msg, []byte(pcb_in)...) 5049 5050 r.performRequest(msg) 5051 5052 r.read() 5053 widx := 8 5054 // pcb_out : out []byte 5055 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5056 widx += 4 5057 if pcb_out_length > 0 { 5058 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5059 widx += int(pcb_out_length) 5060 } 5061 5062 var result int32 5063 x := binary.LittleEndian.Uint32(payload[widx:]) 5064 result = int32(x) 5065 5066 r.seq++ 5067 return result 5068 } 5069 5070 func (r *rtl8720dn) rpc_tcp_close(pcb_in []byte, pcb_out []byte) int32 { 5071 if r.debug { 5072 fmt.Printf("rpc_tcp_close()\r\n") 5073 } 5074 msg := startWriteMessage(0x00, 0x0F, 0x19, uint32(r.seq)) 5075 5076 // pcb_in : in []byte 5077 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5078 msg = append(msg, []byte(pcb_in)...) 5079 5080 r.performRequest(msg) 5081 5082 r.read() 5083 widx := 8 5084 // pcb_out : out []byte 5085 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5086 widx += 4 5087 if pcb_out_length > 0 { 5088 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5089 widx += int(pcb_out_length) 5090 } 5091 5092 var result int32 5093 x := binary.LittleEndian.Uint32(payload[widx:]) 5094 result = int32(x) 5095 5096 r.seq++ 5097 return result 5098 } 5099 5100 func (r *rtl8720dn) rpc_tcp_bind(pcb_in []byte, pcb_out []byte, ipaddr []byte, port uint16) int32 { 5101 if r.debug { 5102 fmt.Printf("rpc_tcp_bind()\r\n") 5103 } 5104 msg := startWriteMessage(0x00, 0x0F, 0x1A, uint32(r.seq)) 5105 5106 // pcb_in : in []byte 5107 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5108 msg = append(msg, []byte(pcb_in)...) 5109 // ipaddr : in []byte 5110 msg = append(msg, byte(len(ipaddr)), byte(len(ipaddr)>>8), byte(len(ipaddr)>>16), byte(len(ipaddr)>>24)) 5111 msg = append(msg, []byte(ipaddr)...) 5112 // port : in uint16 5113 msg = append(msg, byte(port>>0)) 5114 msg = append(msg, byte(port>>8)) 5115 5116 r.performRequest(msg) 5117 5118 r.read() 5119 widx := 8 5120 // pcb_out : out []byte 5121 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5122 widx += 4 5123 if pcb_out_length > 0 { 5124 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5125 widx += int(pcb_out_length) 5126 } 5127 5128 var result int32 5129 x := binary.LittleEndian.Uint32(payload[widx:]) 5130 result = int32(x) 5131 5132 r.seq++ 5133 return result 5134 } 5135 5136 func (r *rtl8720dn) rpc_tcp_new_ip_type(ip_type uint8, pcb_out []byte) int32 { 5137 if r.debug { 5138 fmt.Printf("rpc_tcp_new_ip_type()\r\n") 5139 } 5140 msg := startWriteMessage(0x00, 0x0F, 0x1B, uint32(r.seq)) 5141 5142 // ip_type : in uint8 5143 msg = append(msg, byte(ip_type>>0)) 5144 5145 r.performRequest(msg) 5146 5147 r.read() 5148 widx := 8 5149 // pcb_out : out []byte 5150 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5151 widx += 4 5152 if pcb_out_length > 0 { 5153 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5154 widx += int(pcb_out_length) 5155 } 5156 5157 var result int32 5158 x := binary.LittleEndian.Uint32(payload[widx:]) 5159 result = int32(x) 5160 5161 r.seq++ 5162 return result 5163 } 5164 5165 func (r *rtl8720dn) rpc_tcp_arg(pcb_in []byte, pcb_out []byte, func_arg []byte) int32 { 5166 if r.debug { 5167 fmt.Printf("rpc_tcp_arg()\r\n") 5168 } 5169 msg := startWriteMessage(0x00, 0x0F, 0x1C, uint32(r.seq)) 5170 5171 // pcb_in : in []byte 5172 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5173 msg = append(msg, []byte(pcb_in)...) 5174 // func_arg : in []byte 5175 msg = append(msg, byte(len(func_arg)), byte(len(func_arg)>>8), byte(len(func_arg)>>16), byte(len(func_arg)>>24)) 5176 msg = append(msg, []byte(func_arg)...) 5177 5178 r.performRequest(msg) 5179 5180 r.read() 5181 widx := 8 5182 // pcb_out : out []byte 5183 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5184 widx += 4 5185 if pcb_out_length > 0 { 5186 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5187 widx += int(pcb_out_length) 5188 } 5189 5190 var result int32 5191 x := binary.LittleEndian.Uint32(payload[widx:]) 5192 result = int32(x) 5193 5194 r.seq++ 5195 return result 5196 } 5197 5198 func (r *rtl8720dn) rpc_tcp_err(pcb_in []byte, pcb_out []byte, func_err []byte) int32 { 5199 if r.debug { 5200 fmt.Printf("rpc_tcp_err()\r\n") 5201 } 5202 msg := startWriteMessage(0x00, 0x0F, 0x1D, uint32(r.seq)) 5203 5204 // pcb_in : in []byte 5205 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5206 msg = append(msg, []byte(pcb_in)...) 5207 // func_err : in []byte 5208 msg = append(msg, byte(len(func_err)), byte(len(func_err)>>8), byte(len(func_err)>>16), byte(len(func_err)>>24)) 5209 msg = append(msg, []byte(func_err)...) 5210 5211 r.performRequest(msg) 5212 5213 r.read() 5214 widx := 8 5215 // pcb_out : out []byte 5216 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5217 widx += 4 5218 if pcb_out_length > 0 { 5219 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5220 widx += int(pcb_out_length) 5221 } 5222 5223 var result int32 5224 x := binary.LittleEndian.Uint32(payload[widx:]) 5225 result = int32(x) 5226 5227 r.seq++ 5228 return result 5229 } 5230 5231 func (r *rtl8720dn) rpc_tcp_recv(pcb_in []byte, pcb_out []byte, func_recv []byte) int32 { 5232 if r.debug { 5233 fmt.Printf("rpc_tcp_recv()\r\n") 5234 } 5235 msg := startWriteMessage(0x00, 0x0F, 0x1E, uint32(r.seq)) 5236 5237 // pcb_in : in []byte 5238 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5239 msg = append(msg, []byte(pcb_in)...) 5240 // func_recv : in []byte 5241 msg = append(msg, byte(len(func_recv)), byte(len(func_recv)>>8), byte(len(func_recv)>>16), byte(len(func_recv)>>24)) 5242 msg = append(msg, []byte(func_recv)...) 5243 5244 r.performRequest(msg) 5245 5246 r.read() 5247 widx := 8 5248 // pcb_out : out []byte 5249 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5250 widx += 4 5251 if pcb_out_length > 0 { 5252 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5253 widx += int(pcb_out_length) 5254 } 5255 5256 var result int32 5257 x := binary.LittleEndian.Uint32(payload[widx:]) 5258 result = int32(x) 5259 5260 r.seq++ 5261 return result 5262 } 5263 5264 func (r *rtl8720dn) rpc_tcp_sent(pcb_in []byte, pcb_out []byte, func_sent []byte) int32 { 5265 if r.debug { 5266 fmt.Printf("rpc_tcp_sent()\r\n") 5267 } 5268 msg := startWriteMessage(0x00, 0x0F, 0x1F, uint32(r.seq)) 5269 5270 // pcb_in : in []byte 5271 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5272 msg = append(msg, []byte(pcb_in)...) 5273 // func_sent : in []byte 5274 msg = append(msg, byte(len(func_sent)), byte(len(func_sent)>>8), byte(len(func_sent)>>16), byte(len(func_sent)>>24)) 5275 msg = append(msg, []byte(func_sent)...) 5276 5277 r.performRequest(msg) 5278 5279 r.read() 5280 widx := 8 5281 // pcb_out : out []byte 5282 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5283 widx += 4 5284 if pcb_out_length > 0 { 5285 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5286 widx += int(pcb_out_length) 5287 } 5288 5289 var result int32 5290 x := binary.LittleEndian.Uint32(payload[widx:]) 5291 result = int32(x) 5292 5293 r.seq++ 5294 return result 5295 } 5296 5297 func (r *rtl8720dn) rpc_tcp_accept(pcb_in []byte, pcb_out []byte, func_accept []byte) int32 { 5298 if r.debug { 5299 fmt.Printf("rpc_tcp_accept()\r\n") 5300 } 5301 msg := startWriteMessage(0x00, 0x0F, 0x20, uint32(r.seq)) 5302 5303 // pcb_in : in []byte 5304 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5305 msg = append(msg, []byte(pcb_in)...) 5306 // func_accept : in []byte 5307 msg = append(msg, byte(len(func_accept)), byte(len(func_accept)>>8), byte(len(func_accept)>>16), byte(len(func_accept)>>24)) 5308 msg = append(msg, []byte(func_accept)...) 5309 5310 r.performRequest(msg) 5311 5312 r.read() 5313 widx := 8 5314 // pcb_out : out []byte 5315 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5316 widx += 4 5317 if pcb_out_length > 0 { 5318 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5319 widx += int(pcb_out_length) 5320 } 5321 5322 var result int32 5323 x := binary.LittleEndian.Uint32(payload[widx:]) 5324 result = int32(x) 5325 5326 r.seq++ 5327 return result 5328 } 5329 5330 func (r *rtl8720dn) rpc_tcp_poll(pcb_in []byte, pcb_out []byte, func_poll []byte, interval uint8) int32 { 5331 if r.debug { 5332 fmt.Printf("rpc_tcp_poll()\r\n") 5333 } 5334 msg := startWriteMessage(0x00, 0x0F, 0x21, uint32(r.seq)) 5335 5336 // pcb_in : in []byte 5337 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5338 msg = append(msg, []byte(pcb_in)...) 5339 // func_poll : in []byte 5340 msg = append(msg, byte(len(func_poll)), byte(len(func_poll)>>8), byte(len(func_poll)>>16), byte(len(func_poll)>>24)) 5341 msg = append(msg, []byte(func_poll)...) 5342 // interval : in uint8 5343 msg = append(msg, byte(interval>>0)) 5344 5345 r.performRequest(msg) 5346 5347 r.read() 5348 widx := 8 5349 // pcb_out : out []byte 5350 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5351 widx += 4 5352 if pcb_out_length > 0 { 5353 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5354 widx += int(pcb_out_length) 5355 } 5356 5357 var result int32 5358 x := binary.LittleEndian.Uint32(payload[widx:]) 5359 result = int32(x) 5360 5361 r.seq++ 5362 return result 5363 } 5364 5365 func (r *rtl8720dn) rpc_tcp_listen_with_backlog(pcb_in []byte, pcb_out []byte, backlog uint8) int32 { 5366 if r.debug { 5367 fmt.Printf("rpc_tcp_listen_with_backlog()\r\n") 5368 } 5369 msg := startWriteMessage(0x00, 0x0F, 0x22, uint32(r.seq)) 5370 5371 // pcb_in : in []byte 5372 msg = append(msg, byte(len(pcb_in)), byte(len(pcb_in)>>8), byte(len(pcb_in)>>16), byte(len(pcb_in)>>24)) 5373 msg = append(msg, []byte(pcb_in)...) 5374 // backlog : in uint8 5375 msg = append(msg, byte(backlog>>0)) 5376 5377 r.performRequest(msg) 5378 5379 r.read() 5380 widx := 8 5381 // pcb_out : out []byte 5382 pcb_out_length := binary.LittleEndian.Uint32(payload[widx:]) 5383 widx += 4 5384 if pcb_out_length > 0 { 5385 copy(pcb_out, payload[widx:widx+int(pcb_out_length)]) 5386 widx += int(pcb_out_length) 5387 } 5388 5389 var result int32 5390 x := binary.LittleEndian.Uint32(payload[widx:]) 5391 result = int32(x) 5392 5393 r.seq++ 5394 return result 5395 } 5396 5397 func (r *rtl8720dn) rpc_pbuf_free(p []byte) int32 { 5398 if r.debug { 5399 fmt.Printf("rpc_pbuf_free()\r\n") 5400 } 5401 msg := startWriteMessage(0x00, 0x0F, 0x23, uint32(r.seq)) 5402 5403 // p : in []byte 5404 msg = append(msg, byte(len(p)), byte(len(p)>>8), byte(len(p)>>16), byte(len(p)>>24)) 5405 msg = append(msg, []byte(p)...) 5406 5407 r.performRequest(msg) 5408 5409 r.read() 5410 widx := 8 5411 5412 var result int32 5413 x := binary.LittleEndian.Uint32(payload[widx:]) 5414 result = int32(x) 5415 5416 r.seq++ 5417 return result 5418 } 5419 5420 func (r *rtl8720dn) rpc_ip4addr_ntoa(ip4_addr_in []byte) string { 5421 if r.debug { 5422 fmt.Printf("rpc_ip4addr_ntoa()\r\n") 5423 } 5424 msg := startWriteMessage(0x00, 0x0F, 0x24, uint32(r.seq)) 5425 5426 // ip4_addr_in : in []byte 5427 msg = append(msg, byte(len(ip4_addr_in)), byte(len(ip4_addr_in)>>8), byte(len(ip4_addr_in)>>16), byte(len(ip4_addr_in)>>24)) 5428 msg = append(msg, []byte(ip4_addr_in)...) 5429 5430 r.performRequest(msg) 5431 5432 r.read() 5433 widx := 8 5434 5435 var result string 5436 result_length := binary.LittleEndian.Uint32(payload[widx:]) 5437 widx += 4 5438 result = string(payload[widx : widx+int(result_length)]) 5439 5440 r.seq++ 5441 return result 5442 } 5443 5444 func (r *rtl8720dn) rpc_inet_chksum(dataptr_in []byte) uint16 { 5445 if r.debug { 5446 fmt.Printf("rpc_inet_chksum()\r\n") 5447 } 5448 msg := startWriteMessage(0x00, 0x0F, 0x25, uint32(r.seq)) 5449 5450 // dataptr_in : in []byte 5451 msg = append(msg, byte(len(dataptr_in)), byte(len(dataptr_in)>>8), byte(len(dataptr_in)>>16), byte(len(dataptr_in)>>24)) 5452 msg = append(msg, []byte(dataptr_in)...) 5453 5454 r.performRequest(msg) 5455 5456 r.read() 5457 widx := 8 5458 5459 var result uint16 5460 result = uint16(binary.LittleEndian.Uint32(payload[widx:])) 5461 5462 r.seq++ 5463 return result 5464 } 5465 5466 func (r *rtl8720dn) rpc_lwip_accept(s int32, addr []byte, addrlen *uint32) int32 { 5467 if r.debug { 5468 fmt.Printf("rpc_lwip_accept()\r\n") 5469 } 5470 msg := startWriteMessage(0x00, 0x10, 0x01, uint32(r.seq)) 5471 5472 // s : in int32 5473 msg = append(msg, byte(s>>0)) 5474 msg = append(msg, byte(s>>8)) 5475 msg = append(msg, byte(s>>16)) 5476 msg = append(msg, byte(s>>24)) 5477 // addr : in []byte 5478 msg = append(msg, byte(len(addr)), byte(len(addr)>>8), byte(len(addr)>>16), byte(len(addr)>>24)) 5479 msg = append(msg, []byte(addr)...) 5480 // addrlen : inout uint32 5481 msg = append(msg, byte(*addrlen>>0)) 5482 msg = append(msg, byte(*addrlen>>8)) 5483 msg = append(msg, byte(*addrlen>>16)) 5484 msg = append(msg, byte(*addrlen>>24)) 5485 5486 r.performRequest(msg) 5487 5488 r.read() 5489 widx := 8 5490 // addrlen : inout uint32 5491 *addrlen = binary.LittleEndian.Uint32(payload[widx:]) 5492 widx += 4 5493 5494 var result int32 5495 x := binary.LittleEndian.Uint32(payload[widx:]) 5496 result = int32(x) 5497 5498 r.seq++ 5499 return result 5500 } 5501 5502 func (r *rtl8720dn) rpc_lwip_bind(s int32, name []byte, namelen uint32) int32 { 5503 if r.debug { 5504 fmt.Printf("rpc_lwip_bind()\r\n") 5505 } 5506 msg := startWriteMessage(0x00, 0x10, 0x02, uint32(r.seq)) 5507 5508 // s : in int32 5509 msg = append(msg, byte(s>>0)) 5510 msg = append(msg, byte(s>>8)) 5511 msg = append(msg, byte(s>>16)) 5512 msg = append(msg, byte(s>>24)) 5513 // name : in []byte 5514 msg = append(msg, byte(len(name)), byte(len(name)>>8), byte(len(name)>>16), byte(len(name)>>24)) 5515 msg = append(msg, []byte(name)...) 5516 // namelen : in uint32 5517 msg = append(msg, byte(namelen>>0)) 5518 msg = append(msg, byte(namelen>>8)) 5519 msg = append(msg, byte(namelen>>16)) 5520 msg = append(msg, byte(namelen>>24)) 5521 5522 r.performRequest(msg) 5523 5524 r.read() 5525 widx := 8 5526 5527 var result int32 5528 x := binary.LittleEndian.Uint32(payload[widx:]) 5529 result = int32(x) 5530 5531 r.seq++ 5532 return result 5533 } 5534 5535 func (r *rtl8720dn) rpc_lwip_shutdown(s int32, how int32) int32 { 5536 if r.debug { 5537 fmt.Printf("rpc_lwip_shutdown()\r\n") 5538 } 5539 msg := startWriteMessage(0x00, 0x10, 0x03, uint32(r.seq)) 5540 5541 // s : in int32 5542 msg = append(msg, byte(s>>0)) 5543 msg = append(msg, byte(s>>8)) 5544 msg = append(msg, byte(s>>16)) 5545 msg = append(msg, byte(s>>24)) 5546 // how : in int32 5547 msg = append(msg, byte(how>>0)) 5548 msg = append(msg, byte(how>>8)) 5549 msg = append(msg, byte(how>>16)) 5550 msg = append(msg, byte(how>>24)) 5551 5552 r.performRequest(msg) 5553 5554 r.read() 5555 widx := 8 5556 5557 var result int32 5558 x := binary.LittleEndian.Uint32(payload[widx:]) 5559 result = int32(x) 5560 5561 r.seq++ 5562 return result 5563 } 5564 5565 func (r *rtl8720dn) rpc_lwip_getpeername(s int32, name []byte, namelen *uint32) int32 { 5566 if r.debug { 5567 fmt.Printf("rpc_lwip_getpeername()\r\n") 5568 } 5569 msg := startWriteMessage(0x00, 0x10, 0x04, uint32(r.seq)) 5570 5571 // s : in int32 5572 msg = append(msg, byte(s>>0)) 5573 msg = append(msg, byte(s>>8)) 5574 msg = append(msg, byte(s>>16)) 5575 msg = append(msg, byte(s>>24)) 5576 // namelen : inout uint32 5577 msg = append(msg, byte(*namelen>>0)) 5578 msg = append(msg, byte(*namelen>>8)) 5579 msg = append(msg, byte(*namelen>>16)) 5580 msg = append(msg, byte(*namelen>>24)) 5581 5582 r.performRequest(msg) 5583 5584 r.read() 5585 widx := 8 5586 // name : out []byte 5587 name_length := binary.LittleEndian.Uint32(payload[widx:]) 5588 widx += 4 5589 if name_length > 0 { 5590 copy(name, payload[widx:widx+int(name_length)]) 5591 widx += int(name_length) 5592 } 5593 // namelen : inout uint32 5594 *namelen = binary.LittleEndian.Uint32(payload[widx:]) 5595 widx += 4 5596 5597 var result int32 5598 x := binary.LittleEndian.Uint32(payload[widx:]) 5599 result = int32(x) 5600 5601 r.seq++ 5602 return result 5603 } 5604 5605 func (r *rtl8720dn) rpc_lwip_getsockname(s int32, name []byte, namelen *uint32) int32 { 5606 if r.debug { 5607 fmt.Printf("rpc_lwip_getsockname()\r\n") 5608 } 5609 msg := startWriteMessage(0x00, 0x10, 0x05, uint32(r.seq)) 5610 5611 // s : in int32 5612 msg = append(msg, byte(s>>0)) 5613 msg = append(msg, byte(s>>8)) 5614 msg = append(msg, byte(s>>16)) 5615 msg = append(msg, byte(s>>24)) 5616 // namelen : inout uint32 5617 msg = append(msg, byte(*namelen>>0)) 5618 msg = append(msg, byte(*namelen>>8)) 5619 msg = append(msg, byte(*namelen>>16)) 5620 msg = append(msg, byte(*namelen>>24)) 5621 5622 r.performRequest(msg) 5623 5624 r.read() 5625 widx := 8 5626 // name : out []byte 5627 name_length := binary.LittleEndian.Uint32(payload[widx:]) 5628 widx += 4 5629 if name_length > 0 { 5630 copy(name, payload[widx:widx+int(name_length)]) 5631 widx += int(name_length) 5632 } 5633 // namelen : inout uint32 5634 *namelen = binary.LittleEndian.Uint32(payload[widx:]) 5635 widx += 4 5636 5637 var result int32 5638 x := binary.LittleEndian.Uint32(payload[widx:]) 5639 result = int32(x) 5640 5641 r.seq++ 5642 return result 5643 } 5644 5645 func (r *rtl8720dn) rpc_lwip_getsockopt(s int32, level int32, optname int32, in_optval []byte, out_optval []byte, optlen *uint32) int32 { 5646 if r.debug { 5647 fmt.Printf("rpc_lwip_getsockopt()\r\n") 5648 } 5649 msg := startWriteMessage(0x00, 0x10, 0x06, uint32(r.seq)) 5650 5651 // s : in int32 5652 msg = append(msg, byte(s>>0)) 5653 msg = append(msg, byte(s>>8)) 5654 msg = append(msg, byte(s>>16)) 5655 msg = append(msg, byte(s>>24)) 5656 // level : in int32 5657 msg = append(msg, byte(level>>0)) 5658 msg = append(msg, byte(level>>8)) 5659 msg = append(msg, byte(level>>16)) 5660 msg = append(msg, byte(level>>24)) 5661 // optname : in int32 5662 msg = append(msg, byte(optname>>0)) 5663 msg = append(msg, byte(optname>>8)) 5664 msg = append(msg, byte(optname>>16)) 5665 msg = append(msg, byte(optname>>24)) 5666 // in_optval : in []byte 5667 msg = append(msg, byte(len(in_optval)), byte(len(in_optval)>>8), byte(len(in_optval)>>16), byte(len(in_optval)>>24)) 5668 msg = append(msg, []byte(in_optval)...) 5669 // optlen : inout uint32 5670 msg = append(msg, byte(*optlen>>0)) 5671 msg = append(msg, byte(*optlen>>8)) 5672 msg = append(msg, byte(*optlen>>16)) 5673 msg = append(msg, byte(*optlen>>24)) 5674 5675 r.performRequest(msg) 5676 5677 r.read() 5678 widx := 8 5679 // out_optval : out []byte 5680 out_optval_length := binary.LittleEndian.Uint32(payload[widx:]) 5681 widx += 4 5682 if out_optval_length > 0 { 5683 copy(out_optval, payload[widx:widx+int(out_optval_length)]) 5684 widx += int(out_optval_length) 5685 } 5686 // optlen : inout uint32 5687 *optlen = binary.LittleEndian.Uint32(payload[widx:]) 5688 widx += 4 5689 5690 var result int32 5691 x := binary.LittleEndian.Uint32(payload[widx:]) 5692 result = int32(x) 5693 5694 r.seq++ 5695 return result 5696 } 5697 5698 func (r *rtl8720dn) rpc_lwip_setsockopt(s int32, level int32, optname int32, optval []byte, optlen uint32) int32 { 5699 if r.debug { 5700 fmt.Printf("rpc_lwip_setsockopt()\r\n") 5701 } 5702 msg := startWriteMessage(0x00, 0x10, 0x07, uint32(r.seq)) 5703 5704 // s : in int32 5705 msg = append(msg, byte(s>>0)) 5706 msg = append(msg, byte(s>>8)) 5707 msg = append(msg, byte(s>>16)) 5708 msg = append(msg, byte(s>>24)) 5709 // level : in int32 5710 msg = append(msg, byte(level>>0)) 5711 msg = append(msg, byte(level>>8)) 5712 msg = append(msg, byte(level>>16)) 5713 msg = append(msg, byte(level>>24)) 5714 // optname : in int32 5715 msg = append(msg, byte(optname>>0)) 5716 msg = append(msg, byte(optname>>8)) 5717 msg = append(msg, byte(optname>>16)) 5718 msg = append(msg, byte(optname>>24)) 5719 // optval : in []byte 5720 msg = append(msg, byte(len(optval)), byte(len(optval)>>8), byte(len(optval)>>16), byte(len(optval)>>24)) 5721 msg = append(msg, []byte(optval)...) 5722 // optlen : in uint32 5723 msg = append(msg, byte(optlen>>0)) 5724 msg = append(msg, byte(optlen>>8)) 5725 msg = append(msg, byte(optlen>>16)) 5726 msg = append(msg, byte(optlen>>24)) 5727 5728 r.performRequest(msg) 5729 5730 r.read() 5731 widx := 8 5732 5733 var result int32 5734 x := binary.LittleEndian.Uint32(payload[widx:]) 5735 result = int32(x) 5736 5737 r.seq++ 5738 return result 5739 } 5740 5741 func (r *rtl8720dn) rpc_lwip_close(s int32) int32 { 5742 if r.debug { 5743 fmt.Printf("rpc_lwip_close()\r\n") 5744 } 5745 msg := startWriteMessage(0x00, 0x10, 0x08, uint32(r.seq)) 5746 5747 // s : in int32 5748 msg = append(msg, byte(s>>0)) 5749 msg = append(msg, byte(s>>8)) 5750 msg = append(msg, byte(s>>16)) 5751 msg = append(msg, byte(s>>24)) 5752 5753 r.performRequest(msg) 5754 5755 r.read() 5756 widx := 8 5757 5758 var result int32 5759 x := binary.LittleEndian.Uint32(payload[widx:]) 5760 result = int32(x) 5761 5762 r.seq++ 5763 return result 5764 } 5765 5766 func (r *rtl8720dn) rpc_lwip_connect(s int32, name []byte, namelen uint32) int32 { 5767 if r.debug { 5768 fmt.Printf("rpc_lwip_connect()\r\n") 5769 } 5770 msg := startWriteMessage(0x00, 0x10, 0x09, uint32(r.seq)) 5771 5772 // s : in int32 5773 msg = append(msg, byte(s>>0)) 5774 msg = append(msg, byte(s>>8)) 5775 msg = append(msg, byte(s>>16)) 5776 msg = append(msg, byte(s>>24)) 5777 // name : in []byte 5778 msg = append(msg, byte(len(name)), byte(len(name)>>8), byte(len(name)>>16), byte(len(name)>>24)) 5779 msg = append(msg, []byte(name)...) 5780 // namelen : in uint32 5781 msg = append(msg, byte(namelen>>0)) 5782 msg = append(msg, byte(namelen>>8)) 5783 msg = append(msg, byte(namelen>>16)) 5784 msg = append(msg, byte(namelen>>24)) 5785 5786 r.performRequest(msg) 5787 5788 r.read() 5789 widx := 8 5790 5791 var result int32 5792 x := binary.LittleEndian.Uint32(payload[widx:]) 5793 result = int32(x) 5794 5795 r.seq++ 5796 return result 5797 } 5798 5799 func (r *rtl8720dn) rpc_lwip_listen(s int32, backlog int32) int32 { 5800 if r.debug { 5801 fmt.Printf("rpc_lwip_listen()\r\n") 5802 } 5803 msg := startWriteMessage(0x00, 0x10, 0x0A, uint32(r.seq)) 5804 5805 // s : in int32 5806 msg = append(msg, byte(s>>0)) 5807 msg = append(msg, byte(s>>8)) 5808 msg = append(msg, byte(s>>16)) 5809 msg = append(msg, byte(s>>24)) 5810 // backlog : in int32 5811 msg = append(msg, byte(backlog>>0)) 5812 msg = append(msg, byte(backlog>>8)) 5813 msg = append(msg, byte(backlog>>16)) 5814 msg = append(msg, byte(backlog>>24)) 5815 5816 r.performRequest(msg) 5817 5818 r.read() 5819 widx := 8 5820 5821 var result int32 5822 x := binary.LittleEndian.Uint32(payload[widx:]) 5823 result = int32(x) 5824 5825 r.seq++ 5826 return result 5827 } 5828 5829 func (r *rtl8720dn) rpc_lwip_available(s int32) int32 { 5830 if r.debug { 5831 fmt.Printf("rpc_lwip_available()\r\n") 5832 } 5833 msg := startWriteMessage(0x00, 0x10, 0x0B, uint32(r.seq)) 5834 5835 // s : in int32 5836 msg = append(msg, byte(s>>0)) 5837 msg = append(msg, byte(s>>8)) 5838 msg = append(msg, byte(s>>16)) 5839 msg = append(msg, byte(s>>24)) 5840 5841 r.performRequest(msg) 5842 5843 r.read() 5844 widx := 8 5845 5846 var result int32 5847 x := binary.LittleEndian.Uint32(payload[widx:]) 5848 result = int32(x) 5849 5850 r.seq++ 5851 return result 5852 } 5853 5854 func (r *rtl8720dn) rpc_lwip_recv(s int32, mem []byte, length uint32, flags int32, timeout uint32) int32 { 5855 if r.debug { 5856 fmt.Printf("rpc_lwip_recv()\r\n") 5857 } 5858 msg := startWriteMessage(0x00, 0x10, 0x0C, uint32(r.seq)) 5859 5860 // s : in int32 5861 msg = append(msg, byte(s>>0)) 5862 msg = append(msg, byte(s>>8)) 5863 msg = append(msg, byte(s>>16)) 5864 msg = append(msg, byte(s>>24)) 5865 // length : in uint32 5866 msg = append(msg, byte(length>>0)) 5867 msg = append(msg, byte(length>>8)) 5868 msg = append(msg, byte(length>>16)) 5869 msg = append(msg, byte(length>>24)) 5870 // flags : in int32 5871 msg = append(msg, byte(flags>>0)) 5872 msg = append(msg, byte(flags>>8)) 5873 msg = append(msg, byte(flags>>16)) 5874 msg = append(msg, byte(flags>>24)) 5875 // timeout : in uint32 5876 msg = append(msg, byte(timeout>>0)) 5877 msg = append(msg, byte(timeout>>8)) 5878 msg = append(msg, byte(timeout>>16)) 5879 msg = append(msg, byte(timeout>>24)) 5880 5881 r.performRequest(msg) 5882 5883 r.read() 5884 widx := 8 5885 // mem : out []byte 5886 mem_length := binary.LittleEndian.Uint32(payload[widx:]) 5887 widx += 4 5888 if mem_length > 0 { 5889 copy(mem, payload[widx:widx+int(mem_length)]) 5890 widx += int(mem_length) 5891 } 5892 5893 var result int32 5894 x := binary.LittleEndian.Uint32(payload[widx:]) 5895 result = int32(x) 5896 5897 r.seq++ 5898 return result 5899 } 5900 5901 func (r *rtl8720dn) rpc_lwip_read(s int32, mem []byte, length uint32, timeout uint32) int32 { 5902 if r.debug { 5903 fmt.Printf("rpc_lwip_read()\r\n") 5904 } 5905 msg := startWriteMessage(0x00, 0x10, 0x0D, uint32(r.seq)) 5906 5907 // s : in int32 5908 msg = append(msg, byte(s>>0)) 5909 msg = append(msg, byte(s>>8)) 5910 msg = append(msg, byte(s>>16)) 5911 msg = append(msg, byte(s>>24)) 5912 // length : in uint32 5913 msg = append(msg, byte(length>>0)) 5914 msg = append(msg, byte(length>>8)) 5915 msg = append(msg, byte(length>>16)) 5916 msg = append(msg, byte(length>>24)) 5917 // timeout : in uint32 5918 msg = append(msg, byte(timeout>>0)) 5919 msg = append(msg, byte(timeout>>8)) 5920 msg = append(msg, byte(timeout>>16)) 5921 msg = append(msg, byte(timeout>>24)) 5922 5923 r.performRequest(msg) 5924 5925 r.read() 5926 widx := 8 5927 // mem : out []byte 5928 mem_length := binary.LittleEndian.Uint32(payload[widx:]) 5929 widx += 4 5930 if mem_length > 0 { 5931 copy(mem, payload[widx:widx+int(mem_length)]) 5932 widx += int(mem_length) 5933 } 5934 5935 var result int32 5936 x := binary.LittleEndian.Uint32(payload[widx:]) 5937 result = int32(x) 5938 5939 r.seq++ 5940 return result 5941 } 5942 5943 func (r *rtl8720dn) rpc_lwip_recvfrom(s int32, mem []byte, length uint32, flags int32, from []byte, fromlen *uint32, timeout uint32) int32 { 5944 if r.debug { 5945 fmt.Printf("rpc_lwip_recvfrom()\r\n") 5946 } 5947 msg := startWriteMessage(0x00, 0x10, 0x0E, uint32(r.seq)) 5948 5949 // s : in int32 5950 msg = append(msg, byte(s>>0)) 5951 msg = append(msg, byte(s>>8)) 5952 msg = append(msg, byte(s>>16)) 5953 msg = append(msg, byte(s>>24)) 5954 // length : in uint32 5955 msg = append(msg, byte(length>>0)) 5956 msg = append(msg, byte(length>>8)) 5957 msg = append(msg, byte(length>>16)) 5958 msg = append(msg, byte(length>>24)) 5959 // flags : in int32 5960 msg = append(msg, byte(flags>>0)) 5961 msg = append(msg, byte(flags>>8)) 5962 msg = append(msg, byte(flags>>16)) 5963 msg = append(msg, byte(flags>>24)) 5964 // fromlen : inout uint32 5965 msg = append(msg, byte(*fromlen>>0)) 5966 msg = append(msg, byte(*fromlen>>8)) 5967 msg = append(msg, byte(*fromlen>>16)) 5968 msg = append(msg, byte(*fromlen>>24)) 5969 // timeout : in uint32 5970 msg = append(msg, byte(timeout>>0)) 5971 msg = append(msg, byte(timeout>>8)) 5972 msg = append(msg, byte(timeout>>16)) 5973 msg = append(msg, byte(timeout>>24)) 5974 5975 r.performRequest(msg) 5976 5977 r.read() 5978 widx := 8 5979 // mem : out []byte 5980 mem_length := binary.LittleEndian.Uint32(payload[widx:]) 5981 widx += 4 5982 if mem_length > 0 { 5983 copy(mem, payload[widx:widx+int(mem_length)]) 5984 widx += int(mem_length) 5985 } 5986 // from : out []byte 5987 from_length := binary.LittleEndian.Uint32(payload[widx:]) 5988 widx += 4 5989 if from_length > 0 { 5990 copy(from, payload[widx:widx+int(from_length)]) 5991 widx += int(from_length) 5992 } 5993 // fromlen : inout uint32 5994 *fromlen = binary.LittleEndian.Uint32(payload[widx:]) 5995 widx += 4 5996 5997 var result int32 5998 x := binary.LittleEndian.Uint32(payload[widx:]) 5999 result = int32(x) 6000 6001 r.seq++ 6002 return result 6003 } 6004 6005 func (r *rtl8720dn) rpc_lwip_send(s int32, dataptr []byte, flags int32) int32 { 6006 if r.debug { 6007 fmt.Printf("rpc_lwip_send()\r\n") 6008 } 6009 msg := startWriteMessage(0x00, 0x10, 0x0F, uint32(r.seq)) 6010 6011 // s : in int32 6012 msg = append(msg, byte(s>>0)) 6013 msg = append(msg, byte(s>>8)) 6014 msg = append(msg, byte(s>>16)) 6015 msg = append(msg, byte(s>>24)) 6016 // dataptr : in []byte 6017 msg = append(msg, byte(len(dataptr)), byte(len(dataptr)>>8), byte(len(dataptr)>>16), byte(len(dataptr)>>24)) 6018 msg = append(msg, []byte(dataptr)...) 6019 // flags : in int32 6020 msg = append(msg, byte(flags>>0)) 6021 msg = append(msg, byte(flags>>8)) 6022 msg = append(msg, byte(flags>>16)) 6023 msg = append(msg, byte(flags>>24)) 6024 6025 r.performRequest(msg) 6026 6027 r.read() 6028 widx := 8 6029 6030 var result int32 6031 x := binary.LittleEndian.Uint32(payload[widx:]) 6032 result = int32(x) 6033 6034 r.seq++ 6035 return result 6036 } 6037 6038 func (r *rtl8720dn) rpc_lwip_sendmsg(s int32, msg_name []byte, msg_iov []byte, msg_control []byte, msg_flags int32, flags int32) int32 { 6039 if r.debug { 6040 fmt.Printf("rpc_lwip_sendmsg()\r\n") 6041 } 6042 msg := startWriteMessage(0x00, 0x10, 0x10, uint32(r.seq)) 6043 6044 // s : in int32 6045 msg = append(msg, byte(s>>0)) 6046 msg = append(msg, byte(s>>8)) 6047 msg = append(msg, byte(s>>16)) 6048 msg = append(msg, byte(s>>24)) 6049 // msg_name : in []byte 6050 msg = append(msg, byte(len(msg_name)), byte(len(msg_name)>>8), byte(len(msg_name)>>16), byte(len(msg_name)>>24)) 6051 msg = append(msg, []byte(msg_name)...) 6052 // msg_iov : in []byte 6053 msg = append(msg, byte(len(msg_iov)), byte(len(msg_iov)>>8), byte(len(msg_iov)>>16), byte(len(msg_iov)>>24)) 6054 msg = append(msg, []byte(msg_iov)...) 6055 // msg_control : in []byte 6056 msg = append(msg, byte(len(msg_control)), byte(len(msg_control)>>8), byte(len(msg_control)>>16), byte(len(msg_control)>>24)) 6057 msg = append(msg, []byte(msg_control)...) 6058 // msg_flags : in int32 6059 msg = append(msg, byte(msg_flags>>0)) 6060 msg = append(msg, byte(msg_flags>>8)) 6061 msg = append(msg, byte(msg_flags>>16)) 6062 msg = append(msg, byte(msg_flags>>24)) 6063 // flags : in int32 6064 msg = append(msg, byte(flags>>0)) 6065 msg = append(msg, byte(flags>>8)) 6066 msg = append(msg, byte(flags>>16)) 6067 msg = append(msg, byte(flags>>24)) 6068 6069 r.performRequest(msg) 6070 6071 r.read() 6072 widx := 8 6073 6074 var result int32 6075 x := binary.LittleEndian.Uint32(payload[widx:]) 6076 result = int32(x) 6077 6078 r.seq++ 6079 return result 6080 } 6081 6082 func (r *rtl8720dn) rpc_lwip_sendto(s int32, dataptr []byte, flags int32, to []byte, tolen uint32) int32 { 6083 if r.debug { 6084 fmt.Printf("rpc_lwip_sendto()\r\n") 6085 } 6086 msg := startWriteMessage(0x00, 0x10, 0x11, uint32(r.seq)) 6087 6088 // s : in int32 6089 msg = append(msg, byte(s>>0)) 6090 msg = append(msg, byte(s>>8)) 6091 msg = append(msg, byte(s>>16)) 6092 msg = append(msg, byte(s>>24)) 6093 // dataptr : in []byte 6094 msg = append(msg, byte(len(dataptr)), byte(len(dataptr)>>8), byte(len(dataptr)>>16), byte(len(dataptr)>>24)) 6095 msg = append(msg, []byte(dataptr)...) 6096 // flags : in int32 6097 msg = append(msg, byte(flags>>0)) 6098 msg = append(msg, byte(flags>>8)) 6099 msg = append(msg, byte(flags>>16)) 6100 msg = append(msg, byte(flags>>24)) 6101 // to : in []byte 6102 msg = append(msg, byte(len(to)), byte(len(to)>>8), byte(len(to)>>16), byte(len(to)>>24)) 6103 msg = append(msg, []byte(to)...) 6104 // tolen : in uint32 6105 msg = append(msg, byte(tolen>>0)) 6106 msg = append(msg, byte(tolen>>8)) 6107 msg = append(msg, byte(tolen>>16)) 6108 msg = append(msg, byte(tolen>>24)) 6109 6110 r.performRequest(msg) 6111 6112 r.read() 6113 widx := 8 6114 6115 var result int32 6116 x := binary.LittleEndian.Uint32(payload[widx:]) 6117 result = int32(x) 6118 6119 r.seq++ 6120 return result 6121 } 6122 6123 func (r *rtl8720dn) rpc_lwip_socket(domain int32, l_type int32, protocol int32) int32 { 6124 if r.debug { 6125 fmt.Printf("rpc_lwip_socket()\r\n") 6126 } 6127 msg := startWriteMessage(0x00, 0x10, 0x12, uint32(r.seq)) 6128 6129 // domain : in int32 6130 msg = append(msg, byte(domain>>0)) 6131 msg = append(msg, byte(domain>>8)) 6132 msg = append(msg, byte(domain>>16)) 6133 msg = append(msg, byte(domain>>24)) 6134 // l_type : in int32 6135 msg = append(msg, byte(l_type>>0)) 6136 msg = append(msg, byte(l_type>>8)) 6137 msg = append(msg, byte(l_type>>16)) 6138 msg = append(msg, byte(l_type>>24)) 6139 // protocol : in int32 6140 msg = append(msg, byte(protocol>>0)) 6141 msg = append(msg, byte(protocol>>8)) 6142 msg = append(msg, byte(protocol>>16)) 6143 msg = append(msg, byte(protocol>>24)) 6144 6145 r.performRequest(msg) 6146 6147 r.read() 6148 widx := 8 6149 6150 var result int32 6151 x := binary.LittleEndian.Uint32(payload[widx:]) 6152 result = int32(x) 6153 6154 r.seq++ 6155 return result 6156 } 6157 6158 func (r *rtl8720dn) rpc_lwip_write(s int32, dataptr []byte, size uint32) int32 { 6159 if r.debug { 6160 fmt.Printf("rpc_lwip_write()\r\n") 6161 } 6162 msg := startWriteMessage(0x00, 0x10, 0x13, uint32(r.seq)) 6163 6164 // s : in int32 6165 msg = append(msg, byte(s>>0)) 6166 msg = append(msg, byte(s>>8)) 6167 msg = append(msg, byte(s>>16)) 6168 msg = append(msg, byte(s>>24)) 6169 // dataptr : in []byte 6170 msg = append(msg, byte(len(dataptr)), byte(len(dataptr)>>8), byte(len(dataptr)>>16), byte(len(dataptr)>>24)) 6171 msg = append(msg, []byte(dataptr)...) 6172 // size : in uint32 6173 msg = append(msg, byte(size>>0)) 6174 msg = append(msg, byte(size>>8)) 6175 msg = append(msg, byte(size>>16)) 6176 msg = append(msg, byte(size>>24)) 6177 6178 r.performRequest(msg) 6179 6180 r.read() 6181 widx := 8 6182 6183 var result int32 6184 x := binary.LittleEndian.Uint32(payload[widx:]) 6185 result = int32(x) 6186 6187 r.seq++ 6188 return result 6189 } 6190 6191 func (r *rtl8720dn) rpc_lwip_writev(s int32, iov []byte, iovcnt int32) int32 { 6192 if r.debug { 6193 fmt.Printf("rpc_lwip_writev()\r\n") 6194 } 6195 msg := startWriteMessage(0x00, 0x10, 0x14, uint32(r.seq)) 6196 6197 // s : in int32 6198 msg = append(msg, byte(s>>0)) 6199 msg = append(msg, byte(s>>8)) 6200 msg = append(msg, byte(s>>16)) 6201 msg = append(msg, byte(s>>24)) 6202 // iov : in []byte 6203 msg = append(msg, byte(len(iov)), byte(len(iov)>>8), byte(len(iov)>>16), byte(len(iov)>>24)) 6204 msg = append(msg, []byte(iov)...) 6205 // iovcnt : in int32 6206 msg = append(msg, byte(iovcnt>>0)) 6207 msg = append(msg, byte(iovcnt>>8)) 6208 msg = append(msg, byte(iovcnt>>16)) 6209 msg = append(msg, byte(iovcnt>>24)) 6210 6211 r.performRequest(msg) 6212 6213 r.read() 6214 widx := 8 6215 6216 var result int32 6217 x := binary.LittleEndian.Uint32(payload[widx:]) 6218 result = int32(x) 6219 6220 r.seq++ 6221 return result 6222 } 6223 6224 func (r *rtl8720dn) rpc_lwip_select(maxfdp1 int32, readset []byte, writeset []byte, exceptset []byte, timeout []byte) int32 { 6225 if r.debug { 6226 fmt.Printf("rpc_lwip_select()\r\n") 6227 } 6228 msg := startWriteMessage(0x00, 0x10, 0x15, uint32(r.seq)) 6229 6230 // maxfdp1 : in int32 6231 msg = append(msg, byte(maxfdp1>>0)) 6232 msg = append(msg, byte(maxfdp1>>8)) 6233 msg = append(msg, byte(maxfdp1>>16)) 6234 msg = append(msg, byte(maxfdp1>>24)) 6235 // readset : in []byte nullable 6236 if len(readset) == 0 { 6237 msg = append(msg, 1) 6238 } else { 6239 msg = append(msg, 0) 6240 msg = append(msg, byte(len(readset)), byte(len(readset)>>8), byte(len(readset)>>16), byte(len(readset)>>24)) 6241 msg = append(msg, []byte(readset)...) 6242 } 6243 // writeset : in []byte nullable 6244 if len(writeset) == 0 { 6245 msg = append(msg, 1) 6246 } else { 6247 msg = append(msg, 0) 6248 msg = append(msg, byte(len(writeset)), byte(len(writeset)>>8), byte(len(writeset)>>16), byte(len(writeset)>>24)) 6249 msg = append(msg, []byte(writeset)...) 6250 } 6251 // exceptset : in []byte nullable 6252 if len(exceptset) == 0 { 6253 msg = append(msg, 1) 6254 } else { 6255 msg = append(msg, 0) 6256 msg = append(msg, byte(len(exceptset)), byte(len(exceptset)>>8), byte(len(exceptset)>>16), byte(len(exceptset)>>24)) 6257 msg = append(msg, []byte(exceptset)...) 6258 } 6259 // timeout : in []byte nullable 6260 if len(timeout) == 0 { 6261 msg = append(msg, 1) 6262 } else { 6263 msg = append(msg, 0) 6264 msg = append(msg, byte(len(timeout)), byte(len(timeout)>>8), byte(len(timeout)>>16), byte(len(timeout)>>24)) 6265 msg = append(msg, []byte(timeout)...) 6266 } 6267 6268 r.performRequest(msg) 6269 6270 r.read() 6271 widx := 8 6272 6273 var result int32 6274 x := binary.LittleEndian.Uint32(payload[widx:]) 6275 result = int32(x) 6276 6277 r.seq++ 6278 return result 6279 } 6280 6281 func (r *rtl8720dn) rpc_lwip_ioctl(s int32, cmd uint32, in_argp []byte, out_argp []byte) int32 { 6282 if r.debug { 6283 fmt.Printf("rpc_lwip_ioctl()\r\n") 6284 } 6285 msg := startWriteMessage(0x00, 0x10, 0x16, uint32(r.seq)) 6286 6287 // s : in int32 6288 msg = append(msg, byte(s>>0)) 6289 msg = append(msg, byte(s>>8)) 6290 msg = append(msg, byte(s>>16)) 6291 msg = append(msg, byte(s>>24)) 6292 // cmd : in uint32 6293 msg = append(msg, byte(cmd>>0)) 6294 msg = append(msg, byte(cmd>>8)) 6295 msg = append(msg, byte(cmd>>16)) 6296 msg = append(msg, byte(cmd>>24)) 6297 // in_argp : in []byte 6298 msg = append(msg, byte(len(in_argp)), byte(len(in_argp)>>8), byte(len(in_argp)>>16), byte(len(in_argp)>>24)) 6299 msg = append(msg, []byte(in_argp)...) 6300 6301 r.performRequest(msg) 6302 6303 r.read() 6304 widx := 8 6305 // out_argp : out []byte 6306 out_argp_length := binary.LittleEndian.Uint32(payload[widx:]) 6307 widx += 4 6308 if out_argp_length > 0 { 6309 copy(out_argp, payload[widx:widx+int(out_argp_length)]) 6310 widx += int(out_argp_length) 6311 } 6312 6313 var result int32 6314 x := binary.LittleEndian.Uint32(payload[widx:]) 6315 result = int32(x) 6316 6317 r.seq++ 6318 return result 6319 } 6320 6321 func (r *rtl8720dn) rpc_lwip_fcntl(s int32, cmd int32, val int32) int32 { 6322 if r.debug { 6323 fmt.Printf("rpc_lwip_fcntl()\r\n") 6324 } 6325 msg := startWriteMessage(0x00, 0x10, 0x17, uint32(r.seq)) 6326 6327 // s : in int32 6328 msg = append(msg, byte(s>>0)) 6329 msg = append(msg, byte(s>>8)) 6330 msg = append(msg, byte(s>>16)) 6331 msg = append(msg, byte(s>>24)) 6332 // cmd : in int32 6333 msg = append(msg, byte(cmd>>0)) 6334 msg = append(msg, byte(cmd>>8)) 6335 msg = append(msg, byte(cmd>>16)) 6336 msg = append(msg, byte(cmd>>24)) 6337 // val : in int32 6338 msg = append(msg, byte(val>>0)) 6339 msg = append(msg, byte(val>>8)) 6340 msg = append(msg, byte(val>>16)) 6341 msg = append(msg, byte(val>>24)) 6342 6343 r.performRequest(msg) 6344 6345 r.read() 6346 widx := 8 6347 6348 var result int32 6349 x := binary.LittleEndian.Uint32(payload[widx:]) 6350 result = int32(x) 6351 6352 r.seq++ 6353 return result 6354 } 6355 6356 func (r *rtl8720dn) rpc_lwip_errno() int32 { 6357 if r.debug { 6358 fmt.Printf("rpc_lwip_errno()\r\n") 6359 } 6360 msg := startWriteMessage(0x00, 0x10, 0x18, uint32(r.seq)) 6361 6362 r.performRequest(msg) 6363 6364 r.read() 6365 widx := 8 6366 var result int32 6367 x := binary.LittleEndian.Uint32(payload[widx:]) 6368 result = int32(x) 6369 6370 r.seq++ 6371 return result 6372 } 6373 6374 func (r *rtl8720dn) rpc_netconn_gethostbyname(name string, addr []byte) int8 { 6375 if r.debug { 6376 fmt.Printf("rpc_netconn_gethostbyname()\r\n") 6377 } 6378 msg := startWriteMessage(0x00, 0x10, 0x19, uint32(r.seq)) 6379 6380 // name : in string 6381 msg = append(msg, byte(len(name)), byte(len(name)>>8), byte(len(name)>>16), byte(len(name)>>24)) 6382 msg = append(msg, []byte(name)...) 6383 6384 r.performRequest(msg) 6385 6386 r.read() 6387 widx := 8 6388 // addr : out []byte 6389 addr_length := binary.LittleEndian.Uint32(payload[widx:]) 6390 widx += 4 6391 if addr_length > 0 { 6392 copy(addr, payload[widx:widx+int(addr_length)]) 6393 widx += int(addr_length) 6394 } 6395 6396 var result int8 6397 x := binary.LittleEndian.Uint32(payload[widx:]) 6398 result = int8(x) 6399 6400 r.seq++ 6401 return result 6402 } 6403 6404 func (r *rtl8720dn) rpc_dns_gethostbyname_addrtype(hostname string, addr []byte, found uint32, callback_arg []byte, dns_addrtype uint8) int8 { 6405 if r.debug { 6406 fmt.Printf("rpc_dns_gethostbyname_addrtype()\r\n") 6407 } 6408 msg := startWriteMessage(0x00, 0x10, 0x1A, uint32(r.seq)) 6409 6410 // hostname : in string 6411 msg = append(msg, byte(len(hostname)), byte(len(hostname)>>8), byte(len(hostname)>>16), byte(len(hostname)>>24)) 6412 msg = append(msg, []byte(hostname)...) 6413 // found : in uint32 6414 msg = append(msg, byte(found>>0)) 6415 msg = append(msg, byte(found>>8)) 6416 msg = append(msg, byte(found>>16)) 6417 msg = append(msg, byte(found>>24)) 6418 // callback_arg : in []byte nullable 6419 if len(callback_arg) == 0 { 6420 msg = append(msg, 1) 6421 } else { 6422 msg = append(msg, 0) 6423 msg = append(msg, byte(len(callback_arg)), byte(len(callback_arg)>>8), byte(len(callback_arg)>>16), byte(len(callback_arg)>>24)) 6424 msg = append(msg, []byte(callback_arg)...) 6425 } 6426 // dns_addrtype : in uint8 6427 msg = append(msg, byte(dns_addrtype>>0)) 6428 6429 r.performRequest(msg) 6430 6431 r.read() 6432 widx := 8 6433 // addr : out []byte 6434 addr_length := binary.LittleEndian.Uint32(payload[widx:]) 6435 widx += 4 6436 if addr_length > 0 { 6437 copy(addr, payload[widx:widx+int(addr_length)]) 6438 widx += int(addr_length) 6439 } 6440 6441 var result int8 6442 x := binary.LittleEndian.Uint32(payload[widx:]) 6443 result = int8(x) 6444 6445 r.seq++ 6446 return result 6447 } 6448 6449 func (r *rtl8720dn) rpc_wifi_ssl_client_create() uint32 { 6450 if r.debug { 6451 fmt.Printf("rpc_wifi_ssl_client_create()\r\n") 6452 } 6453 msg := startWriteMessage(0x00, 0x11, 0x01, uint32(r.seq)) 6454 6455 r.performRequest(msg) 6456 6457 r.read() 6458 widx := 8 6459 var result uint32 6460 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6461 6462 r.seq++ 6463 return result 6464 } 6465 6466 func (r *rtl8720dn) rpc_wifi_ssl_client_destroy(ssl_client uint32) { 6467 if r.debug { 6468 fmt.Printf("rpc_wifi_ssl_client_destroy()\r\n") 6469 } 6470 msg := startWriteMessage(0x00, 0x11, 0x02, uint32(r.seq)) 6471 6472 // ssl_client : in uint32 6473 msg = append(msg, byte(ssl_client>>0)) 6474 msg = append(msg, byte(ssl_client>>8)) 6475 msg = append(msg, byte(ssl_client>>16)) 6476 msg = append(msg, byte(ssl_client>>24)) 6477 6478 r.performRequest(msg) 6479 6480 r.read() 6481 6482 r.seq++ 6483 return 6484 } 6485 6486 func (r *rtl8720dn) rpc_wifi_ssl_init(ssl_client uint32) { 6487 if r.debug { 6488 fmt.Printf("rpc_wifi_ssl_init()\r\n") 6489 } 6490 msg := startWriteMessage(0x00, 0x11, 0x03, uint32(r.seq)) 6491 6492 // ssl_client : in uint32 6493 msg = append(msg, byte(ssl_client>>0)) 6494 msg = append(msg, byte(ssl_client>>8)) 6495 msg = append(msg, byte(ssl_client>>16)) 6496 msg = append(msg, byte(ssl_client>>24)) 6497 6498 r.performRequest(msg) 6499 6500 r.read() 6501 6502 r.seq++ 6503 return 6504 } 6505 6506 func (r *rtl8720dn) rpc_wifi_ssl_set_socket(ssl_client uint32, socket int32) { 6507 if r.debug { 6508 fmt.Printf("rpc_wifi_ssl_set_socket()\r\n") 6509 } 6510 msg := startWriteMessage(0x00, 0x11, 0x04, uint32(r.seq)) 6511 6512 // ssl_client : in uint32 6513 msg = append(msg, byte(ssl_client>>0)) 6514 msg = append(msg, byte(ssl_client>>8)) 6515 msg = append(msg, byte(ssl_client>>16)) 6516 msg = append(msg, byte(ssl_client>>24)) 6517 // socket : in int32 6518 msg = append(msg, byte(socket>>0)) 6519 msg = append(msg, byte(socket>>8)) 6520 msg = append(msg, byte(socket>>16)) 6521 msg = append(msg, byte(socket>>24)) 6522 6523 r.performRequest(msg) 6524 6525 r.read() 6526 6527 r.seq++ 6528 return 6529 } 6530 6531 func (r *rtl8720dn) rpc_wifi_ssl_set_timeout(ssl_client uint32, timeout uint32) { 6532 if r.debug { 6533 fmt.Printf("rpc_wifi_ssl_set_timeout()\r\n") 6534 } 6535 msg := startWriteMessage(0x00, 0x11, 0x05, uint32(r.seq)) 6536 6537 // ssl_client : in uint32 6538 msg = append(msg, byte(ssl_client>>0)) 6539 msg = append(msg, byte(ssl_client>>8)) 6540 msg = append(msg, byte(ssl_client>>16)) 6541 msg = append(msg, byte(ssl_client>>24)) 6542 // timeout : in uint32 6543 msg = append(msg, byte(timeout>>0)) 6544 msg = append(msg, byte(timeout>>8)) 6545 msg = append(msg, byte(timeout>>16)) 6546 msg = append(msg, byte(timeout>>24)) 6547 6548 r.performRequest(msg) 6549 6550 r.read() 6551 6552 r.seq++ 6553 return 6554 } 6555 6556 func (r *rtl8720dn) rpc_wifi_ssl_get_socket(ssl_client uint32) int32 { 6557 if r.debug { 6558 fmt.Printf("rpc_wifi_ssl_get_socket()\r\n") 6559 } 6560 msg := startWriteMessage(0x00, 0x11, 0x06, uint32(r.seq)) 6561 6562 // ssl_client : in uint32 6563 msg = append(msg, byte(ssl_client>>0)) 6564 msg = append(msg, byte(ssl_client>>8)) 6565 msg = append(msg, byte(ssl_client>>16)) 6566 msg = append(msg, byte(ssl_client>>24)) 6567 6568 r.performRequest(msg) 6569 6570 r.read() 6571 widx := 8 6572 6573 var result int32 6574 x := binary.LittleEndian.Uint32(payload[widx:]) 6575 result = int32(x) 6576 6577 r.seq++ 6578 return result 6579 } 6580 6581 func (r *rtl8720dn) rpc_wifi_ssl_get_timeout(ssl_client uint32) uint32 { 6582 if r.debug { 6583 fmt.Printf("rpc_wifi_ssl_get_timeout()\r\n") 6584 } 6585 msg := startWriteMessage(0x00, 0x11, 0x07, uint32(r.seq)) 6586 6587 // ssl_client : in uint32 6588 msg = append(msg, byte(ssl_client>>0)) 6589 msg = append(msg, byte(ssl_client>>8)) 6590 msg = append(msg, byte(ssl_client>>16)) 6591 msg = append(msg, byte(ssl_client>>24)) 6592 6593 r.performRequest(msg) 6594 6595 r.read() 6596 widx := 8 6597 6598 var result uint32 6599 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6600 6601 r.seq++ 6602 return result 6603 } 6604 6605 func (r *rtl8720dn) rpc_wifi_ssl_set_rootCA(ssl_client uint32, rootCABuff string) uint32 { 6606 if r.debug { 6607 fmt.Printf("rpc_wifi_ssl_set_rootCA()\r\n") 6608 } 6609 msg := startWriteMessage(0x00, 0x11, 0x08, uint32(r.seq)) 6610 6611 // ssl_client : in uint32 6612 msg = append(msg, byte(ssl_client>>0)) 6613 msg = append(msg, byte(ssl_client>>8)) 6614 msg = append(msg, byte(ssl_client>>16)) 6615 msg = append(msg, byte(ssl_client>>24)) 6616 // rootCABuff : in string 6617 msg = append(msg, byte(len(rootCABuff)), byte(len(rootCABuff)>>8), byte(len(rootCABuff)>>16), byte(len(rootCABuff)>>24)) 6618 msg = append(msg, []byte(rootCABuff)...) 6619 6620 r.performRequest(msg) 6621 6622 r.read() 6623 widx := 8 6624 6625 var result uint32 6626 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6627 6628 r.seq++ 6629 return result 6630 } 6631 6632 func (r *rtl8720dn) rpc_wifi_ssl_get_rootCA(ssl_client uint32, rootCABuff string) uint32 { 6633 if r.debug { 6634 fmt.Printf("rpc_wifi_ssl_get_rootCA()\r\n") 6635 } 6636 msg := startWriteMessage(0x00, 0x11, 0x09, uint32(r.seq)) 6637 6638 // ssl_client : in uint32 6639 msg = append(msg, byte(ssl_client>>0)) 6640 msg = append(msg, byte(ssl_client>>8)) 6641 msg = append(msg, byte(ssl_client>>16)) 6642 msg = append(msg, byte(ssl_client>>24)) 6643 6644 r.performRequest(msg) 6645 6646 r.read() 6647 widx := 8 6648 // rootCABuff : out string nullable 6649 rootCABuff_length := binary.LittleEndian.Uint32(payload[widx:]) 6650 widx += 1 6651 if rootCABuff_length == 1 { 6652 rootCABuff_length = binary.LittleEndian.Uint32(payload[widx:]) 6653 widx += 4 6654 } 6655 if rootCABuff_length > 0 { 6656 rootCABuff = string(payload[widx : widx+int(rootCABuff_length)]) 6657 widx += int(rootCABuff_length) 6658 } 6659 6660 var result uint32 6661 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6662 6663 r.seq++ 6664 return result 6665 } 6666 6667 func (r *rtl8720dn) rpc_wifi_ssl_set_cliCert(ssl_client uint32, cli_cert string) uint32 { 6668 if r.debug { 6669 fmt.Printf("rpc_wifi_ssl_set_cliCert()\r\n") 6670 } 6671 msg := startWriteMessage(0x00, 0x11, 0x0A, uint32(r.seq)) 6672 6673 // ssl_client : in uint32 6674 msg = append(msg, byte(ssl_client>>0)) 6675 msg = append(msg, byte(ssl_client>>8)) 6676 msg = append(msg, byte(ssl_client>>16)) 6677 msg = append(msg, byte(ssl_client>>24)) 6678 // cli_cert : in string 6679 msg = append(msg, byte(len(cli_cert)), byte(len(cli_cert)>>8), byte(len(cli_cert)>>16), byte(len(cli_cert)>>24)) 6680 msg = append(msg, []byte(cli_cert)...) 6681 6682 r.performRequest(msg) 6683 6684 r.read() 6685 widx := 8 6686 6687 var result uint32 6688 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6689 6690 r.seq++ 6691 return result 6692 } 6693 6694 func (r *rtl8720dn) rpc_wifi_ssl_get_cliCert(ssl_client uint32, cli_cert string) uint32 { 6695 if r.debug { 6696 fmt.Printf("rpc_wifi_ssl_get_cliCert()\r\n") 6697 } 6698 msg := startWriteMessage(0x00, 0x11, 0x0B, uint32(r.seq)) 6699 6700 // ssl_client : in uint32 6701 msg = append(msg, byte(ssl_client>>0)) 6702 msg = append(msg, byte(ssl_client>>8)) 6703 msg = append(msg, byte(ssl_client>>16)) 6704 msg = append(msg, byte(ssl_client>>24)) 6705 // cli_cert : in string nullable 6706 if len(cli_cert) == 0 { 6707 msg = append(msg, 1) 6708 } else { 6709 msg = append(msg, 0) 6710 msg = append(msg, byte(len(cli_cert)), byte(len(cli_cert)>>8), byte(len(cli_cert)>>16), byte(len(cli_cert)>>24)) 6711 msg = append(msg, []byte(cli_cert)...) 6712 } 6713 6714 r.performRequest(msg) 6715 6716 r.read() 6717 widx := 8 6718 6719 var result uint32 6720 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6721 6722 r.seq++ 6723 return result 6724 } 6725 6726 func (r *rtl8720dn) rpc_wifi_ssl_set_cliKey(ssl_client uint32, cli_key string) uint32 { 6727 if r.debug { 6728 fmt.Printf("rpc_wifi_ssl_set_cliKey()\r\n") 6729 } 6730 msg := startWriteMessage(0x00, 0x11, 0x0C, uint32(r.seq)) 6731 6732 // ssl_client : in uint32 6733 msg = append(msg, byte(ssl_client>>0)) 6734 msg = append(msg, byte(ssl_client>>8)) 6735 msg = append(msg, byte(ssl_client>>16)) 6736 msg = append(msg, byte(ssl_client>>24)) 6737 // cli_key : in string 6738 msg = append(msg, byte(len(cli_key)), byte(len(cli_key)>>8), byte(len(cli_key)>>16), byte(len(cli_key)>>24)) 6739 msg = append(msg, []byte(cli_key)...) 6740 6741 r.performRequest(msg) 6742 6743 r.read() 6744 widx := 8 6745 6746 var result uint32 6747 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6748 6749 r.seq++ 6750 return result 6751 } 6752 6753 func (r *rtl8720dn) rpc_wifi_ssl_get_cliKey(ssl_client uint32, cli_key string) uint32 { 6754 if r.debug { 6755 fmt.Printf("rpc_wifi_ssl_get_cliKey()\r\n") 6756 } 6757 msg := startWriteMessage(0x00, 0x11, 0x0D, uint32(r.seq)) 6758 6759 // ssl_client : in uint32 6760 msg = append(msg, byte(ssl_client>>0)) 6761 msg = append(msg, byte(ssl_client>>8)) 6762 msg = append(msg, byte(ssl_client>>16)) 6763 msg = append(msg, byte(ssl_client>>24)) 6764 // cli_key : in string nullable 6765 if len(cli_key) == 0 { 6766 msg = append(msg, 1) 6767 } else { 6768 msg = append(msg, 0) 6769 msg = append(msg, byte(len(cli_key)), byte(len(cli_key)>>8), byte(len(cli_key)>>16), byte(len(cli_key)>>24)) 6770 msg = append(msg, []byte(cli_key)...) 6771 } 6772 6773 r.performRequest(msg) 6774 6775 r.read() 6776 widx := 8 6777 6778 var result uint32 6779 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6780 6781 r.seq++ 6782 return result 6783 } 6784 6785 func (r *rtl8720dn) rpc_wifi_ssl_set_pskIdent(ssl_client uint32, pskIdent string) uint32 { 6786 if r.debug { 6787 fmt.Printf("rpc_wifi_ssl_set_pskIdent()\r\n") 6788 } 6789 msg := startWriteMessage(0x00, 0x11, 0x0E, uint32(r.seq)) 6790 6791 // ssl_client : in uint32 6792 msg = append(msg, byte(ssl_client>>0)) 6793 msg = append(msg, byte(ssl_client>>8)) 6794 msg = append(msg, byte(ssl_client>>16)) 6795 msg = append(msg, byte(ssl_client>>24)) 6796 // pskIdent : in string 6797 msg = append(msg, byte(len(pskIdent)), byte(len(pskIdent)>>8), byte(len(pskIdent)>>16), byte(len(pskIdent)>>24)) 6798 msg = append(msg, []byte(pskIdent)...) 6799 6800 r.performRequest(msg) 6801 6802 r.read() 6803 widx := 8 6804 6805 var result uint32 6806 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6807 6808 r.seq++ 6809 return result 6810 } 6811 6812 func (r *rtl8720dn) rpc_wifi_ssl_get_pskIdent(ssl_client uint32, pskIdent string) uint32 { 6813 if r.debug { 6814 fmt.Printf("rpc_wifi_ssl_get_pskIdent()\r\n") 6815 } 6816 msg := startWriteMessage(0x00, 0x11, 0x0F, uint32(r.seq)) 6817 6818 // ssl_client : in uint32 6819 msg = append(msg, byte(ssl_client>>0)) 6820 msg = append(msg, byte(ssl_client>>8)) 6821 msg = append(msg, byte(ssl_client>>16)) 6822 msg = append(msg, byte(ssl_client>>24)) 6823 // pskIdent : in string nullable 6824 if len(pskIdent) == 0 { 6825 msg = append(msg, 1) 6826 } else { 6827 msg = append(msg, 0) 6828 msg = append(msg, byte(len(pskIdent)), byte(len(pskIdent)>>8), byte(len(pskIdent)>>16), byte(len(pskIdent)>>24)) 6829 msg = append(msg, []byte(pskIdent)...) 6830 } 6831 6832 r.performRequest(msg) 6833 6834 r.read() 6835 widx := 8 6836 6837 var result uint32 6838 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6839 6840 r.seq++ 6841 return result 6842 } 6843 6844 func (r *rtl8720dn) rpc_wifi_ssl_set_psKey(ssl_client uint32, psKey string) uint32 { 6845 if r.debug { 6846 fmt.Printf("rpc_wifi_ssl_set_psKey()\r\n") 6847 } 6848 msg := startWriteMessage(0x00, 0x11, 0x10, uint32(r.seq)) 6849 6850 // ssl_client : in uint32 6851 msg = append(msg, byte(ssl_client>>0)) 6852 msg = append(msg, byte(ssl_client>>8)) 6853 msg = append(msg, byte(ssl_client>>16)) 6854 msg = append(msg, byte(ssl_client>>24)) 6855 // psKey : in string 6856 msg = append(msg, byte(len(psKey)), byte(len(psKey)>>8), byte(len(psKey)>>16), byte(len(psKey)>>24)) 6857 msg = append(msg, []byte(psKey)...) 6858 6859 r.performRequest(msg) 6860 6861 r.read() 6862 widx := 8 6863 6864 var result uint32 6865 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6866 6867 r.seq++ 6868 return result 6869 } 6870 6871 func (r *rtl8720dn) rpc_wifi_ssl_get_psKey(ssl_client uint32, psKey string) uint32 { 6872 if r.debug { 6873 fmt.Printf("rpc_wifi_ssl_get_psKey()\r\n") 6874 } 6875 msg := startWriteMessage(0x00, 0x11, 0x11, uint32(r.seq)) 6876 6877 // ssl_client : in uint32 6878 msg = append(msg, byte(ssl_client>>0)) 6879 msg = append(msg, byte(ssl_client>>8)) 6880 msg = append(msg, byte(ssl_client>>16)) 6881 msg = append(msg, byte(ssl_client>>24)) 6882 // psKey : in string nullable 6883 if len(psKey) == 0 { 6884 msg = append(msg, 1) 6885 } else { 6886 msg = append(msg, 0) 6887 msg = append(msg, byte(len(psKey)), byte(len(psKey)>>8), byte(len(psKey)>>16), byte(len(psKey)>>24)) 6888 msg = append(msg, []byte(psKey)...) 6889 } 6890 6891 r.performRequest(msg) 6892 6893 r.read() 6894 widx := 8 6895 6896 var result uint32 6897 result = uint32(binary.LittleEndian.Uint32(payload[widx:])) 6898 6899 r.seq++ 6900 return result 6901 } 6902 6903 func (r *rtl8720dn) rpc_wifi_start_ssl_client(ssl_client uint32, host string, port uint32, timeout int32) int32 { 6904 if r.debug { 6905 fmt.Printf("rpc_wifi_start_ssl_client()\r\n") 6906 } 6907 msg := startWriteMessage(0x00, 0x11, 0x12, uint32(r.seq)) 6908 6909 // ssl_client : in uint32 6910 msg = append(msg, byte(ssl_client>>0)) 6911 msg = append(msg, byte(ssl_client>>8)) 6912 msg = append(msg, byte(ssl_client>>16)) 6913 msg = append(msg, byte(ssl_client>>24)) 6914 // host : in string nullable 6915 if len(host) == 0 { 6916 msg = append(msg, 1) 6917 } else { 6918 msg = append(msg, 0) 6919 msg = append(msg, byte(len(host)), byte(len(host)>>8), byte(len(host)>>16), byte(len(host)>>24)) 6920 msg = append(msg, []byte(host)...) 6921 } 6922 // port : in uint32 6923 msg = append(msg, byte(port>>0)) 6924 msg = append(msg, byte(port>>8)) 6925 msg = append(msg, byte(port>>16)) 6926 msg = append(msg, byte(port>>24)) 6927 // timeout : in int32 6928 msg = append(msg, byte(timeout>>0)) 6929 msg = append(msg, byte(timeout>>8)) 6930 msg = append(msg, byte(timeout>>16)) 6931 msg = append(msg, byte(timeout>>24)) 6932 6933 r.performRequest(msg) 6934 6935 r.read() 6936 widx := 8 6937 6938 var result int32 6939 x := binary.LittleEndian.Uint32(payload[widx:]) 6940 result = int32(x) 6941 6942 r.seq++ 6943 return result 6944 } 6945 6946 func (r *rtl8720dn) rpc_wifi_stop_ssl_socket(ssl_client uint32) { 6947 if r.debug { 6948 fmt.Printf("rpc_wifi_stop_ssl_socket()\r\n") 6949 } 6950 msg := startWriteMessage(0x00, 0x11, 0x13, uint32(r.seq)) 6951 6952 // ssl_client : in uint32 6953 msg = append(msg, byte(ssl_client>>0)) 6954 msg = append(msg, byte(ssl_client>>8)) 6955 msg = append(msg, byte(ssl_client>>16)) 6956 msg = append(msg, byte(ssl_client>>24)) 6957 6958 r.performRequest(msg) 6959 6960 r.read() 6961 6962 r.seq++ 6963 return 6964 } 6965 6966 func (r *rtl8720dn) rpc_wifi_data_to_read(ssl_client uint32) int32 { 6967 if r.debug { 6968 fmt.Printf("rpc_wifi_data_to_read()\r\n") 6969 } 6970 msg := startWriteMessage(0x00, 0x11, 0x14, uint32(r.seq)) 6971 6972 // ssl_client : in uint32 6973 msg = append(msg, byte(ssl_client>>0)) 6974 msg = append(msg, byte(ssl_client>>8)) 6975 msg = append(msg, byte(ssl_client>>16)) 6976 msg = append(msg, byte(ssl_client>>24)) 6977 6978 r.performRequest(msg) 6979 6980 r.read() 6981 widx := 8 6982 6983 var result int32 6984 x := binary.LittleEndian.Uint32(payload[widx:]) 6985 result = int32(x) 6986 6987 r.seq++ 6988 return result 6989 } 6990 6991 func (r *rtl8720dn) rpc_wifi_send_ssl_data(ssl_client uint32, data []byte, length uint16) int32 { 6992 if r.debug { 6993 fmt.Printf("rpc_wifi_send_ssl_data()\r\n") 6994 } 6995 msg := startWriteMessage(0x00, 0x11, 0x15, uint32(r.seq)) 6996 6997 // ssl_client : in uint32 6998 msg = append(msg, byte(ssl_client>>0)) 6999 msg = append(msg, byte(ssl_client>>8)) 7000 msg = append(msg, byte(ssl_client>>16)) 7001 msg = append(msg, byte(ssl_client>>24)) 7002 // data : in []byte 7003 msg = append(msg, byte(len(data)), byte(len(data)>>8), byte(len(data)>>16), byte(len(data)>>24)) 7004 msg = append(msg, []byte(data)...) 7005 // length : in uint16 7006 msg = append(msg, byte(length>>0)) 7007 msg = append(msg, byte(length>>8)) 7008 7009 r.performRequest(msg) 7010 7011 r.read() 7012 widx := 8 7013 7014 var result int32 7015 x := binary.LittleEndian.Uint32(payload[widx:]) 7016 result = int32(x) 7017 7018 r.seq++ 7019 return result 7020 } 7021 7022 func (r *rtl8720dn) rpc_wifi_get_ssl_receive(ssl_client uint32, data []byte, length int32) int32 { 7023 if r.debug { 7024 fmt.Printf("rpc_wifi_get_ssl_receive()\r\n") 7025 } 7026 msg := startWriteMessage(0x00, 0x11, 0x16, uint32(r.seq)) 7027 7028 // ssl_client : in uint32 7029 msg = append(msg, byte(ssl_client>>0)) 7030 msg = append(msg, byte(ssl_client>>8)) 7031 msg = append(msg, byte(ssl_client>>16)) 7032 msg = append(msg, byte(ssl_client>>24)) 7033 // length : in int32 7034 msg = append(msg, byte(length>>0)) 7035 msg = append(msg, byte(length>>8)) 7036 msg = append(msg, byte(length>>16)) 7037 msg = append(msg, byte(length>>24)) 7038 7039 r.performRequest(msg) 7040 7041 r.read() 7042 widx := 8 7043 // data : out []byte 7044 data_length := binary.LittleEndian.Uint32(payload[widx:]) 7045 widx += 4 7046 if data_length > 0 { 7047 copy(data, payload[widx:widx+int(data_length)]) 7048 widx += int(data_length) 7049 } 7050 7051 var result int32 7052 x := binary.LittleEndian.Uint32(payload[widx:]) 7053 result = int32(x) 7054 7055 r.seq++ 7056 return result 7057 } 7058 7059 func (r *rtl8720dn) rpc_wifi_verify_ssl_fingerprint(ssl_client uint32, fp string, domain_name string) bool { 7060 if r.debug { 7061 fmt.Printf("rpc_wifi_verify_ssl_fingerprint()\r\n") 7062 } 7063 msg := startWriteMessage(0x00, 0x11, 0x17, uint32(r.seq)) 7064 7065 // ssl_client : in uint32 7066 msg = append(msg, byte(ssl_client>>0)) 7067 msg = append(msg, byte(ssl_client>>8)) 7068 msg = append(msg, byte(ssl_client>>16)) 7069 msg = append(msg, byte(ssl_client>>24)) 7070 // fp : in string 7071 msg = append(msg, byte(len(fp)), byte(len(fp)>>8), byte(len(fp)>>16), byte(len(fp)>>24)) 7072 msg = append(msg, []byte(fp)...) 7073 // domain_name : in string 7074 msg = append(msg, byte(len(domain_name)), byte(len(domain_name)>>8), byte(len(domain_name)>>16), byte(len(domain_name)>>24)) 7075 msg = append(msg, []byte(domain_name)...) 7076 7077 r.performRequest(msg) 7078 7079 r.read() 7080 widx := 8 7081 7082 var result bool 7083 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 7084 7085 r.seq++ 7086 return result 7087 } 7088 7089 func (r *rtl8720dn) rpc_wifi_verify_ssl_dn(ssl_client uint32, domain_name string) bool { 7090 if r.debug { 7091 fmt.Printf("rpc_wifi_verify_ssl_dn()\r\n") 7092 } 7093 msg := startWriteMessage(0x00, 0x11, 0x18, uint32(r.seq)) 7094 7095 // ssl_client : in uint32 7096 msg = append(msg, byte(ssl_client>>0)) 7097 msg = append(msg, byte(ssl_client>>8)) 7098 msg = append(msg, byte(ssl_client>>16)) 7099 msg = append(msg, byte(ssl_client>>24)) 7100 // domain_name : in string 7101 msg = append(msg, byte(len(domain_name)), byte(len(domain_name)>>8), byte(len(domain_name)>>16), byte(len(domain_name)>>24)) 7102 msg = append(msg, []byte(domain_name)...) 7103 7104 r.performRequest(msg) 7105 7106 r.read() 7107 widx := 8 7108 7109 var result bool 7110 result = binary.LittleEndian.Uint32(payload[widx:]) == 1 7111 7112 r.seq++ 7113 return result 7114 } 7115 7116 func (r *rtl8720dn) rpc_wifi_ssl_strerror(errnum int32, buffer []byte, buflen uint32) { 7117 if r.debug { 7118 fmt.Printf("rpc_wifi_ssl_strerror()\r\n") 7119 } 7120 msg := startWriteMessage(0x00, 0x11, 0x19, uint32(r.seq)) 7121 7122 // errnum : in int32 7123 msg = append(msg, byte(errnum>>0)) 7124 msg = append(msg, byte(errnum>>8)) 7125 msg = append(msg, byte(errnum>>16)) 7126 msg = append(msg, byte(errnum>>24)) 7127 // buflen : in uint32 7128 msg = append(msg, byte(buflen>>0)) 7129 msg = append(msg, byte(buflen>>8)) 7130 msg = append(msg, byte(buflen>>16)) 7131 msg = append(msg, byte(buflen>>24)) 7132 7133 r.performRequest(msg) 7134 7135 r.read() 7136 widx := 8 7137 // buffer : out []byte 7138 buffer_length := binary.LittleEndian.Uint32(payload[widx:]) 7139 widx += 4 7140 if buffer_length > 0 { 7141 copy(buffer, payload[widx:widx+int(buffer_length)]) 7142 widx += int(buffer_length) 7143 } 7144 7145 r.seq++ 7146 return 7147 } 7148 7149 func (r *rtl8720dn) rpc_mdns_init() int32 { 7150 if r.debug { 7151 fmt.Printf("rpc_mdns_init()\r\n") 7152 } 7153 msg := startWriteMessage(0x00, 0x12, 0x01, uint32(r.seq)) 7154 7155 r.performRequest(msg) 7156 7157 r.read() 7158 widx := 8 7159 var result int32 7160 x := binary.LittleEndian.Uint32(payload[widx:]) 7161 result = int32(x) 7162 7163 r.seq++ 7164 return result 7165 } 7166 7167 func (r *rtl8720dn) rpc_mdns_free() int32 { 7168 if r.debug { 7169 fmt.Printf("rpc_mdns_free()\r\n") 7170 } 7171 msg := startWriteMessage(0x00, 0x12, 0x02, uint32(r.seq)) 7172 7173 r.performRequest(msg) 7174 7175 r.read() 7176 widx := 8 7177 var result int32 7178 x := binary.LittleEndian.Uint32(payload[widx:]) 7179 result = int32(x) 7180 7181 r.seq++ 7182 return result 7183 } 7184 7185 func (r *rtl8720dn) rpc_mdns_service_add(instance_name string, service_type string, proto string, port uint16) int32 { 7186 if r.debug { 7187 fmt.Printf("rpc_mdns_service_add()\r\n") 7188 } 7189 msg := startWriteMessage(0x00, 0x12, 0x03, uint32(r.seq)) 7190 7191 // instance_name : in string 7192 msg = append(msg, byte(len(instance_name)), byte(len(instance_name)>>8), byte(len(instance_name)>>16), byte(len(instance_name)>>24)) 7193 msg = append(msg, []byte(instance_name)...) 7194 // service_type : in string 7195 msg = append(msg, byte(len(service_type)), byte(len(service_type)>>8), byte(len(service_type)>>16), byte(len(service_type)>>24)) 7196 msg = append(msg, []byte(service_type)...) 7197 // proto : in string 7198 msg = append(msg, byte(len(proto)), byte(len(proto)>>8), byte(len(proto)>>16), byte(len(proto)>>24)) 7199 msg = append(msg, []byte(proto)...) 7200 // port : in uint16 7201 msg = append(msg, byte(port>>0)) 7202 msg = append(msg, byte(port>>8)) 7203 7204 r.performRequest(msg) 7205 7206 r.read() 7207 widx := 8 7208 7209 var result int32 7210 x := binary.LittleEndian.Uint32(payload[widx:]) 7211 result = int32(x) 7212 7213 r.seq++ 7214 return result 7215 } 7216 7217 func (r *rtl8720dn) rpc_mdns_service_remove(service_type string, proto string) int32 { 7218 if r.debug { 7219 fmt.Printf("rpc_mdns_service_remove()\r\n") 7220 } 7221 msg := startWriteMessage(0x00, 0x12, 0x04, uint32(r.seq)) 7222 7223 // service_type : in string 7224 msg = append(msg, byte(len(service_type)), byte(len(service_type)>>8), byte(len(service_type)>>16), byte(len(service_type)>>24)) 7225 msg = append(msg, []byte(service_type)...) 7226 // proto : in string 7227 msg = append(msg, byte(len(proto)), byte(len(proto)>>8), byte(len(proto)>>16), byte(len(proto)>>24)) 7228 msg = append(msg, []byte(proto)...) 7229 7230 r.performRequest(msg) 7231 7232 r.read() 7233 widx := 8 7234 7235 var result int32 7236 x := binary.LittleEndian.Uint32(payload[widx:]) 7237 result = int32(x) 7238 7239 r.seq++ 7240 return result 7241 } 7242 7243 func (r *rtl8720dn) rpc_mdns_service_txt_item_set(service_type string, proto string, key string, value string) int32 { 7244 if r.debug { 7245 fmt.Printf("rpc_mdns_service_txt_item_set()\r\n") 7246 } 7247 msg := startWriteMessage(0x00, 0x12, 0x05, uint32(r.seq)) 7248 7249 // service_type : in string 7250 msg = append(msg, byte(len(service_type)), byte(len(service_type)>>8), byte(len(service_type)>>16), byte(len(service_type)>>24)) 7251 msg = append(msg, []byte(service_type)...) 7252 // proto : in string 7253 msg = append(msg, byte(len(proto)), byte(len(proto)>>8), byte(len(proto)>>16), byte(len(proto)>>24)) 7254 msg = append(msg, []byte(proto)...) 7255 // key : in string 7256 msg = append(msg, byte(len(key)), byte(len(key)>>8), byte(len(key)>>16), byte(len(key)>>24)) 7257 msg = append(msg, []byte(key)...) 7258 // value : in string 7259 msg = append(msg, byte(len(value)), byte(len(value)>>8), byte(len(value)>>16), byte(len(value)>>24)) 7260 msg = append(msg, []byte(value)...) 7261 7262 r.performRequest(msg) 7263 7264 r.read() 7265 widx := 8 7266 7267 var result int32 7268 x := binary.LittleEndian.Uint32(payload[widx:]) 7269 result = int32(x) 7270 7271 r.seq++ 7272 return result 7273 } 7274 7275 func (r *rtl8720dn) rpc_mdns_service_instance_name_set(service string, proto string, instance string) int32 { 7276 if r.debug { 7277 fmt.Printf("rpc_mdns_service_instance_name_set()\r\n") 7278 } 7279 msg := startWriteMessage(0x00, 0x12, 0x06, uint32(r.seq)) 7280 7281 // service : in string 7282 msg = append(msg, byte(len(service)), byte(len(service)>>8), byte(len(service)>>16), byte(len(service)>>24)) 7283 msg = append(msg, []byte(service)...) 7284 // proto : in string 7285 msg = append(msg, byte(len(proto)), byte(len(proto)>>8), byte(len(proto)>>16), byte(len(proto)>>24)) 7286 msg = append(msg, []byte(proto)...) 7287 // instance : in string 7288 msg = append(msg, byte(len(instance)), byte(len(instance)>>8), byte(len(instance)>>16), byte(len(instance)>>24)) 7289 msg = append(msg, []byte(instance)...) 7290 7291 r.performRequest(msg) 7292 7293 r.read() 7294 widx := 8 7295 7296 var result int32 7297 x := binary.LittleEndian.Uint32(payload[widx:]) 7298 result = int32(x) 7299 7300 r.seq++ 7301 return result 7302 } 7303 7304 func (r *rtl8720dn) rpc_mdns_instance_name_set(instance_name string) int32 { 7305 if r.debug { 7306 fmt.Printf("rpc_mdns_instance_name_set()\r\n") 7307 } 7308 msg := startWriteMessage(0x00, 0x12, 0x07, uint32(r.seq)) 7309 7310 // instance_name : in string 7311 msg = append(msg, byte(len(instance_name)), byte(len(instance_name)>>8), byte(len(instance_name)>>16), byte(len(instance_name)>>24)) 7312 msg = append(msg, []byte(instance_name)...) 7313 7314 r.performRequest(msg) 7315 7316 r.read() 7317 widx := 8 7318 7319 var result int32 7320 x := binary.LittleEndian.Uint32(payload[widx:]) 7321 result = int32(x) 7322 7323 r.seq++ 7324 return result 7325 } 7326 7327 func (r *rtl8720dn) rpc_mdns_hostname_set(hostname string) int32 { 7328 if r.debug { 7329 fmt.Printf("rpc_mdns_hostname_set()\r\n") 7330 } 7331 msg := startWriteMessage(0x00, 0x12, 0x08, uint32(r.seq)) 7332 7333 // hostname : in string 7334 msg = append(msg, byte(len(hostname)), byte(len(hostname)>>8), byte(len(hostname)>>16), byte(len(hostname)>>24)) 7335 msg = append(msg, []byte(hostname)...) 7336 7337 r.performRequest(msg) 7338 7339 r.read() 7340 widx := 8 7341 7342 var result int32 7343 x := binary.LittleEndian.Uint32(payload[widx:]) 7344 result = int32(x) 7345 7346 r.seq++ 7347 return result 7348 } 7349 7350 func (r *rtl8720dn) rpc_mdns_query_a(host_name string, timeout uint32, addr []byte) int32 { 7351 if r.debug { 7352 fmt.Printf("rpc_mdns_query_a()\r\n") 7353 } 7354 msg := startWriteMessage(0x00, 0x12, 0x09, uint32(r.seq)) 7355 7356 // host_name : in string 7357 msg = append(msg, byte(len(host_name)), byte(len(host_name)>>8), byte(len(host_name)>>16), byte(len(host_name)>>24)) 7358 msg = append(msg, []byte(host_name)...) 7359 // timeout : in uint32 7360 msg = append(msg, byte(timeout>>0)) 7361 msg = append(msg, byte(timeout>>8)) 7362 msg = append(msg, byte(timeout>>16)) 7363 msg = append(msg, byte(timeout>>24)) 7364 7365 r.performRequest(msg) 7366 7367 r.read() 7368 widx := 8 7369 // addr : out []byte 7370 addr_length := binary.LittleEndian.Uint32(payload[widx:]) 7371 widx += 4 7372 if addr_length > 0 { 7373 copy(addr, payload[widx:widx+int(addr_length)]) 7374 widx += int(addr_length) 7375 } 7376 7377 var result int32 7378 x := binary.LittleEndian.Uint32(payload[widx:]) 7379 result = int32(x) 7380 7381 r.seq++ 7382 return result 7383 } 7384 7385 func (r *rtl8720dn) rpc_mdns_query_ptr(service_type string, proto string, timeout uint32, max_results int32, result_total *int32) int32 { 7386 if r.debug { 7387 fmt.Printf("rpc_mdns_query_ptr()\r\n") 7388 } 7389 msg := startWriteMessage(0x00, 0x12, 0x0A, uint32(r.seq)) 7390 7391 // service_type : in string 7392 msg = append(msg, byte(len(service_type)), byte(len(service_type)>>8), byte(len(service_type)>>16), byte(len(service_type)>>24)) 7393 msg = append(msg, []byte(service_type)...) 7394 // proto : in string 7395 msg = append(msg, byte(len(proto)), byte(len(proto)>>8), byte(len(proto)>>16), byte(len(proto)>>24)) 7396 msg = append(msg, []byte(proto)...) 7397 // timeout : in uint32 7398 msg = append(msg, byte(timeout>>0)) 7399 msg = append(msg, byte(timeout>>8)) 7400 msg = append(msg, byte(timeout>>16)) 7401 msg = append(msg, byte(timeout>>24)) 7402 // max_results : in int32 7403 msg = append(msg, byte(max_results>>0)) 7404 msg = append(msg, byte(max_results>>8)) 7405 msg = append(msg, byte(max_results>>16)) 7406 msg = append(msg, byte(max_results>>24)) 7407 7408 r.performRequest(msg) 7409 7410 r.read() 7411 widx := 8 7412 // result_total : out int32 7413 *result_total = int32(binary.LittleEndian.Uint32(payload[widx:])) 7414 widx += 4 7415 7416 var result int32 7417 x := binary.LittleEndian.Uint32(payload[widx:]) 7418 result = int32(x) 7419 7420 r.seq++ 7421 return result 7422 } 7423 7424 func (r *rtl8720dn) rpc_mdns_query_ptr_result_basic(result_target int32, scan_result []byte) int32 { 7425 if r.debug { 7426 fmt.Printf("rpc_mdns_query_ptr_result_basic()\r\n") 7427 } 7428 msg := startWriteMessage(0x00, 0x12, 0x0B, uint32(r.seq)) 7429 7430 // result_target : in int32 7431 msg = append(msg, byte(result_target>>0)) 7432 msg = append(msg, byte(result_target>>8)) 7433 msg = append(msg, byte(result_target>>16)) 7434 msg = append(msg, byte(result_target>>24)) 7435 7436 r.performRequest(msg) 7437 7438 r.read() 7439 widx := 8 7440 // scan_result : out []byte 7441 scan_result_length := binary.LittleEndian.Uint32(payload[widx:]) 7442 widx += 4 7443 if scan_result_length > 0 { 7444 copy(scan_result, payload[widx:widx+int(scan_result_length)]) 7445 widx += int(scan_result_length) 7446 } 7447 7448 var result int32 7449 x := binary.LittleEndian.Uint32(payload[widx:]) 7450 result = int32(x) 7451 7452 r.seq++ 7453 return result 7454 } 7455 7456 func (r *rtl8720dn) rpc_mdns_query_ptr_result_txt(result_target int32, txt_target int32, txt []byte) int32 { 7457 if r.debug { 7458 fmt.Printf("rpc_mdns_query_ptr_result_txt()\r\n") 7459 } 7460 msg := startWriteMessage(0x00, 0x12, 0x0C, uint32(r.seq)) 7461 7462 // result_target : in int32 7463 msg = append(msg, byte(result_target>>0)) 7464 msg = append(msg, byte(result_target>>8)) 7465 msg = append(msg, byte(result_target>>16)) 7466 msg = append(msg, byte(result_target>>24)) 7467 // txt_target : in int32 7468 msg = append(msg, byte(txt_target>>0)) 7469 msg = append(msg, byte(txt_target>>8)) 7470 msg = append(msg, byte(txt_target>>16)) 7471 msg = append(msg, byte(txt_target>>24)) 7472 7473 r.performRequest(msg) 7474 7475 r.read() 7476 widx := 8 7477 // txt : out []byte 7478 txt_length := binary.LittleEndian.Uint32(payload[widx:]) 7479 widx += 4 7480 if txt_length > 0 { 7481 copy(txt, payload[widx:widx+int(txt_length)]) 7482 widx += int(txt_length) 7483 } 7484 7485 var result int32 7486 x := binary.LittleEndian.Uint32(payload[widx:]) 7487 result = int32(x) 7488 7489 r.seq++ 7490 return result 7491 } 7492 7493 func (r *rtl8720dn) rpc_mdns_query_ptr_result_addr(result_target int32, addr_target int32, addr []byte) int32 { 7494 if r.debug { 7495 fmt.Printf("rpc_mdns_query_ptr_result_addr()\r\n") 7496 } 7497 msg := startWriteMessage(0x00, 0x12, 0x0D, uint32(r.seq)) 7498 7499 // result_target : in int32 7500 msg = append(msg, byte(result_target>>0)) 7501 msg = append(msg, byte(result_target>>8)) 7502 msg = append(msg, byte(result_target>>16)) 7503 msg = append(msg, byte(result_target>>24)) 7504 // addr_target : in int32 7505 msg = append(msg, byte(addr_target>>0)) 7506 msg = append(msg, byte(addr_target>>8)) 7507 msg = append(msg, byte(addr_target>>16)) 7508 msg = append(msg, byte(addr_target>>24)) 7509 7510 r.performRequest(msg) 7511 7512 r.read() 7513 widx := 8 7514 // addr : out []byte 7515 addr_length := binary.LittleEndian.Uint32(payload[widx:]) 7516 widx += 4 7517 if addr_length > 0 { 7518 copy(addr, payload[widx:widx+int(addr_length)]) 7519 widx += int(addr_length) 7520 } 7521 7522 var result int32 7523 x := binary.LittleEndian.Uint32(payload[widx:]) 7524 result = int32(x) 7525 7526 r.seq++ 7527 return result 7528 } 7529 7530 func (r *rtl8720dn) rpc_mdns_query_results_free() int32 { 7531 if r.debug { 7532 fmt.Printf("rpc_mdns_query_results_free()\r\n") 7533 } 7534 msg := startWriteMessage(0x00, 0x12, 0x0E, uint32(r.seq)) 7535 7536 r.performRequest(msg) 7537 7538 r.read() 7539 widx := 8 7540 var result int32 7541 x := binary.LittleEndian.Uint32(payload[widx:]) 7542 result = int32(x) 7543 7544 r.seq++ 7545 return result 7546 } 7547 7548 func (r *rtl8720dn) rpc_wifi_event_callback(event []byte) { 7549 if r.debug { 7550 fmt.Printf("rpc_wifi_event_callback()\r\n") 7551 } 7552 msg := startWriteMessage(0x00, 0x13, 0x01, uint32(r.seq)) 7553 7554 // event : in []byte 7555 msg = append(msg, byte(len(event)), byte(len(event)>>8), byte(len(event)>>16), byte(len(event)>>24)) 7556 msg = append(msg, []byte(event)...) 7557 7558 r.performRequest(msg) 7559 7560 r.read() 7561 7562 r.seq++ 7563 return 7564 } 7565 7566 func (r *rtl8720dn) rpc_wifi_dns_found(hostname string, ipaddr []byte, arg []byte) { 7567 if r.debug { 7568 fmt.Printf("rpc_wifi_dns_found()\r\n") 7569 } 7570 msg := startWriteMessage(0x00, 0x13, 0x02, uint32(r.seq)) 7571 7572 // hostname : in string 7573 msg = append(msg, byte(len(hostname)), byte(len(hostname)>>8), byte(len(hostname)>>16), byte(len(hostname)>>24)) 7574 msg = append(msg, []byte(hostname)...) 7575 // ipaddr : in []byte 7576 msg = append(msg, byte(len(ipaddr)), byte(len(ipaddr)>>8), byte(len(ipaddr)>>16), byte(len(ipaddr)>>24)) 7577 msg = append(msg, []byte(ipaddr)...) 7578 // arg : in []byte nullable 7579 if len(arg) == 0 { 7580 msg = append(msg, 1) 7581 } else { 7582 msg = append(msg, 0) 7583 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7584 msg = append(msg, []byte(arg)...) 7585 } 7586 7587 r.performRequest(msg) 7588 7589 r.read() 7590 7591 r.seq++ 7592 return 7593 } 7594 7595 func (r *rtl8720dn) rpc_tcpip_api_call_fn(fn uint32, call []byte) int32 { 7596 if r.debug { 7597 fmt.Printf("rpc_tcpip_api_call_fn()\r\n") 7598 } 7599 msg := startWriteMessage(0x00, 0x13, 0x03, uint32(r.seq)) 7600 7601 // fn : in uint32 7602 msg = append(msg, byte(fn>>0)) 7603 msg = append(msg, byte(fn>>8)) 7604 msg = append(msg, byte(fn>>16)) 7605 msg = append(msg, byte(fn>>24)) 7606 // call : in []byte 7607 msg = append(msg, byte(len(call)), byte(len(call)>>8), byte(len(call)>>16), byte(len(call)>>24)) 7608 msg = append(msg, []byte(call)...) 7609 7610 r.performRequest(msg) 7611 7612 r.read() 7613 widx := 8 7614 7615 var result int32 7616 x := binary.LittleEndian.Uint32(payload[widx:]) 7617 result = int32(x) 7618 7619 r.seq++ 7620 return result 7621 } 7622 7623 func (r *rtl8720dn) rpc_tcp_connected_fn(fn uint32, arg []byte, tpcb []byte, err_val int32) int32 { 7624 if r.debug { 7625 fmt.Printf("rpc_tcp_connected_fn()\r\n") 7626 } 7627 msg := startWriteMessage(0x00, 0x13, 0x04, uint32(r.seq)) 7628 7629 // fn : in uint32 7630 msg = append(msg, byte(fn>>0)) 7631 msg = append(msg, byte(fn>>8)) 7632 msg = append(msg, byte(fn>>16)) 7633 msg = append(msg, byte(fn>>24)) 7634 // arg : in []byte 7635 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7636 msg = append(msg, []byte(arg)...) 7637 // tpcb : in []byte 7638 msg = append(msg, byte(len(tpcb)), byte(len(tpcb)>>8), byte(len(tpcb)>>16), byte(len(tpcb)>>24)) 7639 msg = append(msg, []byte(tpcb)...) 7640 // err_val : in int32 7641 msg = append(msg, byte(err_val>>0)) 7642 msg = append(msg, byte(err_val>>8)) 7643 msg = append(msg, byte(err_val>>16)) 7644 msg = append(msg, byte(err_val>>24)) 7645 7646 r.performRequest(msg) 7647 7648 r.read() 7649 widx := 8 7650 7651 var result int32 7652 x := binary.LittleEndian.Uint32(payload[widx:]) 7653 result = int32(x) 7654 7655 r.seq++ 7656 return result 7657 } 7658 7659 func (r *rtl8720dn) rpc_tcp_recv_fn(fn uint32, arg []byte, tpcb []byte, p_data []byte, p_addr []byte, err_val int32) int32 { 7660 if r.debug { 7661 fmt.Printf("rpc_tcp_recv_fn()\r\n") 7662 } 7663 msg := startWriteMessage(0x00, 0x13, 0x05, uint32(r.seq)) 7664 7665 // fn : in uint32 7666 msg = append(msg, byte(fn>>0)) 7667 msg = append(msg, byte(fn>>8)) 7668 msg = append(msg, byte(fn>>16)) 7669 msg = append(msg, byte(fn>>24)) 7670 // arg : in []byte 7671 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7672 msg = append(msg, []byte(arg)...) 7673 // tpcb : in []byte 7674 msg = append(msg, byte(len(tpcb)), byte(len(tpcb)>>8), byte(len(tpcb)>>16), byte(len(tpcb)>>24)) 7675 msg = append(msg, []byte(tpcb)...) 7676 // p_data : in []byte 7677 msg = append(msg, byte(len(p_data)), byte(len(p_data)>>8), byte(len(p_data)>>16), byte(len(p_data)>>24)) 7678 msg = append(msg, []byte(p_data)...) 7679 // p_addr : in []byte 7680 msg = append(msg, byte(len(p_addr)), byte(len(p_addr)>>8), byte(len(p_addr)>>16), byte(len(p_addr)>>24)) 7681 msg = append(msg, []byte(p_addr)...) 7682 // err_val : in int32 7683 msg = append(msg, byte(err_val>>0)) 7684 msg = append(msg, byte(err_val>>8)) 7685 msg = append(msg, byte(err_val>>16)) 7686 msg = append(msg, byte(err_val>>24)) 7687 7688 r.performRequest(msg) 7689 7690 r.read() 7691 widx := 8 7692 7693 var result int32 7694 x := binary.LittleEndian.Uint32(payload[widx:]) 7695 result = int32(x) 7696 7697 r.seq++ 7698 return result 7699 } 7700 7701 func (r *rtl8720dn) rpc_tcp_accept_fn(fn uint32, arg []byte, newpcb []byte, err_val int32) int32 { 7702 if r.debug { 7703 fmt.Printf("rpc_tcp_accept_fn()\r\n") 7704 } 7705 msg := startWriteMessage(0x00, 0x13, 0x06, uint32(r.seq)) 7706 7707 // fn : in uint32 7708 msg = append(msg, byte(fn>>0)) 7709 msg = append(msg, byte(fn>>8)) 7710 msg = append(msg, byte(fn>>16)) 7711 msg = append(msg, byte(fn>>24)) 7712 // arg : in []byte 7713 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7714 msg = append(msg, []byte(arg)...) 7715 // newpcb : in []byte 7716 msg = append(msg, byte(len(newpcb)), byte(len(newpcb)>>8), byte(len(newpcb)>>16), byte(len(newpcb)>>24)) 7717 msg = append(msg, []byte(newpcb)...) 7718 // err_val : in int32 7719 msg = append(msg, byte(err_val>>0)) 7720 msg = append(msg, byte(err_val>>8)) 7721 msg = append(msg, byte(err_val>>16)) 7722 msg = append(msg, byte(err_val>>24)) 7723 7724 r.performRequest(msg) 7725 7726 r.read() 7727 widx := 8 7728 7729 var result int32 7730 x := binary.LittleEndian.Uint32(payload[widx:]) 7731 result = int32(x) 7732 7733 r.seq++ 7734 return result 7735 } 7736 7737 func (r *rtl8720dn) rpc_tcp_err_fn(fn uint32, arg []byte, err_val int32) int32 { 7738 if r.debug { 7739 fmt.Printf("rpc_tcp_err_fn()\r\n") 7740 } 7741 msg := startWriteMessage(0x00, 0x13, 0x07, uint32(r.seq)) 7742 7743 // fn : in uint32 7744 msg = append(msg, byte(fn>>0)) 7745 msg = append(msg, byte(fn>>8)) 7746 msg = append(msg, byte(fn>>16)) 7747 msg = append(msg, byte(fn>>24)) 7748 // arg : in []byte 7749 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7750 msg = append(msg, []byte(arg)...) 7751 // err_val : in int32 7752 msg = append(msg, byte(err_val>>0)) 7753 msg = append(msg, byte(err_val>>8)) 7754 msg = append(msg, byte(err_val>>16)) 7755 msg = append(msg, byte(err_val>>24)) 7756 7757 r.performRequest(msg) 7758 7759 r.read() 7760 widx := 8 7761 7762 var result int32 7763 x := binary.LittleEndian.Uint32(payload[widx:]) 7764 result = int32(x) 7765 7766 r.seq++ 7767 return result 7768 } 7769 7770 func (r *rtl8720dn) rpc_tcp_sent_fn(fn uint32, arg []byte, tpcb []byte, length uint16) int32 { 7771 if r.debug { 7772 fmt.Printf("rpc_tcp_sent_fn()\r\n") 7773 } 7774 msg := startWriteMessage(0x00, 0x13, 0x08, uint32(r.seq)) 7775 7776 // fn : in uint32 7777 msg = append(msg, byte(fn>>0)) 7778 msg = append(msg, byte(fn>>8)) 7779 msg = append(msg, byte(fn>>16)) 7780 msg = append(msg, byte(fn>>24)) 7781 // arg : in []byte 7782 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7783 msg = append(msg, []byte(arg)...) 7784 // tpcb : in []byte 7785 msg = append(msg, byte(len(tpcb)), byte(len(tpcb)>>8), byte(len(tpcb)>>16), byte(len(tpcb)>>24)) 7786 msg = append(msg, []byte(tpcb)...) 7787 // length : in uint16 7788 msg = append(msg, byte(length>>0)) 7789 msg = append(msg, byte(length>>8)) 7790 7791 r.performRequest(msg) 7792 7793 r.read() 7794 widx := 8 7795 7796 var result int32 7797 x := binary.LittleEndian.Uint32(payload[widx:]) 7798 result = int32(x) 7799 7800 r.seq++ 7801 return result 7802 } 7803 7804 func (r *rtl8720dn) rpc_tcp_poll_fn(fn uint32, arg []byte, tpcb []byte) int32 { 7805 if r.debug { 7806 fmt.Printf("rpc_tcp_poll_fn()\r\n") 7807 } 7808 msg := startWriteMessage(0x00, 0x13, 0x09, uint32(r.seq)) 7809 7810 // fn : in uint32 7811 msg = append(msg, byte(fn>>0)) 7812 msg = append(msg, byte(fn>>8)) 7813 msg = append(msg, byte(fn>>16)) 7814 msg = append(msg, byte(fn>>24)) 7815 // arg : in []byte 7816 msg = append(msg, byte(len(arg)), byte(len(arg)>>8), byte(len(arg)>>16), byte(len(arg)>>24)) 7817 msg = append(msg, []byte(arg)...) 7818 // tpcb : in []byte 7819 msg = append(msg, byte(len(tpcb)), byte(len(tpcb)>>8), byte(len(tpcb)>>16), byte(len(tpcb)>>24)) 7820 msg = append(msg, []byte(tpcb)...) 7821 7822 r.performRequest(msg) 7823 7824 r.read() 7825 widx := 8 7826 7827 var result int32 7828 x := binary.LittleEndian.Uint32(payload[widx:]) 7829 result = int32(x) 7830 7831 r.seq++ 7832 return result 7833 }