adb_api.h revision dceaaa52cec11631c72cfea5fb74ee607602ecde
1/* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef ANDROID_USB_API_ADBWINAPI_H__ 18#define ANDROID_USB_API_ADBWINAPI_H__ 19/** \file 20 This file consists of declarations of routines exported by the API as well 21 as types, structures, and constants definitions used in the API. 22*/ 23 24// Enables compillation for "straight" C 25#ifdef __cplusplus 26 #define EXTERN_C extern "C" 27#else 28 #define EXTERN_C extern 29 typedef int bool; 30 #define true 1 31 #define false 0 32#endif 33 34/** \brief Enumerates ADB endpoint types. 35 36 This enum is taken from WDF_USB_PIPE_TYPE enum found in WDK. 37*/ 38typedef enum _AdbEndpointType { 39 /// Unknown (invalid, or not initialized) endpoint type. 40 AdbEndpointTypeInvalid = 0, 41 42 /// Endpoint is device control pipe. 43 AdbEndpointTypeControl, 44 45 /// Endpoint is isochronous r/w pipe. 46 AdbEndpointTypeIsochronous, 47 48 /// Endpoint is a bulk r/w pipe. 49 AdbEndpointTypeBulk, 50 51 /// Endpoint is an interrupt r/w pipe. 52 AdbEndpointTypeInterrupt, 53} AdbEndpointType; 54 55/** \brief Endpoint desriptor. 56 57 This structure is based on WDF_USB_PIPE_INFORMATION structure found in WDK. 58*/ 59typedef struct _AdbEndpointInformation { 60 /// Maximum packet size this endpoint is capable of. 61 unsigned long max_packet_size; 62 63 /// Maximum size of one transfer which should be sent to the host controller. 64 unsigned long max_transfer_size; 65 66 /// ADB endpoint type. 67 AdbEndpointType endpoint_type; 68 69 /// Raw endpoint address on the device as described by its descriptor. 70 unsigned char endpoint_address; 71 72 /// Polling interval. 73 unsigned char polling_interval; 74 75 /// Which alternate setting this structure is relevant for. 76 unsigned char setting_index; 77} AdbEndpointInformation; 78 79/// Shortcut to default write bulk endpoint in zero-based endpoint index API. 80#define ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX 0xFC 81 82/// Shortcut to default read bulk endpoint in zero-based endpoint index API. 83#define ADB_QUERY_BULK_READ_ENDPOINT_INDEX 0xFE 84 85// {F72FE0D4-CBCB-407d-8814-9ED673D0DD6B} 86/// Our USB class id that driver uses to register our device. 87#define ANDROID_USB_CLASS_ID \ 88{0xf72fe0d4, 0xcbcb, 0x407d, {0x88, 0x14, 0x9e, 0xd6, 0x73, 0xd0, 0xdd, 0x6b}}; 89 90/// Defines vendor ID for HCT devices. 91#define DEVICE_VENDOR_ID 0x0BB4 92 93/// Defines product ID for the device with single interface. 94#define DEVICE_SINGLE_PRODUCT_ID 0x0C01 95 96/// Defines product ID for the Dream composite device. 97#define DEVICE_COMPOSITE_PRODUCT_ID 0x0C02 98 99/// Defines product ID for the Magic composite device. 100#define DEVICE_MAGIC_COMPOSITE_PRODUCT_ID 0x0C03 101 102/// Defines interface ID for the device. 103#define DEVICE_INTERFACE_ID 0x01 104 105/// Defines vendor ID for the device 106#define DEVICE_EMULATOR_VENDOR_ID 0x18D1 107 108/// Defines product ID for a SoftUSB device simulator that is used to test 109/// the driver in isolation from hardware. 110#define DEVICE_EMULATOR_PROD_ID 0xDDDD 111 112// The following ifdef block is the standard way of creating macros which make 113// exporting from a DLL simpler. All files within this DLL are compiled with 114// the ADBWIN_EXPORTS symbol defined on the command line. this symbol should 115// not be defined on any project that uses this DLL. This way any other project 116// whose source files include this file see ADBWIN_API functions as being 117// imported from a DLL, whereas this DLL sees symbols defined with this macro 118// as being exported. 119#ifdef ADBWIN_EXPORTS 120#define ADBWIN_API EXTERN_C __declspec(dllexport) 121#else 122#define ADBWIN_API EXTERN_C __declspec(dllimport) 123#endif 124 125/** \brief Handle to an API object. 126 127 To access USB interface and its components clients must first obtain a 128 handle to the required object. API Objects that are represented by a 129 handle are: 130 1. Interface enumerator that provides access to a list of interfaces that 131 match certain criterias that were specified when interface enumerator 132 has been created. This handle is created in AdbEnumInterfaces routine. 133 2. Interface that is the major object this API deals with. In Windows 134 model of the USB stack each USB device (that is physical device, 135 attached to a USB port) exposes one or more interfaces that become the 136 major entities through which that device gets accessed. Each of these 137 interfaces are represented as Windows Device Objects on the USB stack. 138 So, to this extent, at least as this API is concerned, terms "interface" 139 and "device" are interchangeable, since each interface is represented by 140 a device object on the Windows USB stack. This handle is created in 141 either AdbCreateInterface or AdbCreateInterfaceByName routines. 142 3. Endpoint object (also called a pipe) represents an endpoint on interface 143 through which all I/O operations are performed. This handle is created in 144 one of these routines: AdbOpenEndpoint, AdbOpenDefaultBulkReadEndpoint, 145 or AdbOpenDefaultBulkWriteEndpoint. 146 4. I/O completion object that tracks completion information of asynchronous 147 I/O performed on an endpoint. When an endpoint object gets opened through 148 this API it is opened for asynchronous (or overlapped) I/O. And each time 149 an asynchronous I/O is performed by this API an I/O completion object is 150 created to track the result of that I/O when it gets completed. Clients 151 of the API can then use a handle to I/O completion object to query for 152 the status and result of asynchronous I/O as well as wait for this I/O 153 completion. This handle is created in one of these routines: 154 AdbReadEndpointAsync, or AdbWriteEndpointAsync. 155 After object is no longer needed by the client, its handle must be closed 156 using AdbCloseHandle routine. 157*/ 158typedef void* ADBAPIHANDLE; 159 160/** \brief Defines access type with which an I/O object (endpoint) 161 should be opened. 162*/ 163typedef enum _AdbOpenAccessType { 164 /// Opens for read and write access. 165 AdbOpenAccessTypeReadWrite, 166 167 /// Opens for read only access. 168 AdbOpenAccessTypeRead, 169 170 /// Opens for write only access. 171 AdbOpenAccessTypeWrite, 172 173 /// Opens for querying information. 174 AdbOpenAccessTypeQueryInfo, 175} AdbOpenAccessType; 176 177/** \brief Defines sharing mode with which an I/O object (endpoint) 178 should be opened. 179*/ 180typedef enum _AdbOpenSharingMode { 181 /// Shares read and write. 182 AdbOpenSharingModeReadWrite, 183 184 /// Shares only read. 185 AdbOpenSharingModeRead, 186 187 /// Shares only write. 188 AdbOpenSharingModeWrite, 189 190 /// Opens exclusive. 191 AdbOpenSharingModeExclusive, 192} AdbOpenSharingMode; 193 194/** \brief Provides information about an interface. 195*/ 196typedef struct _AdbInterfaceInfo { 197 /// Inteface's class id (see SP_DEVICE_INTERFACE_DATA for details) 198 GUID class_id; 199 200 /// Interface flags (see SP_DEVICE_INTERFACE_DATA for details) 201 unsigned long flags; 202 203 /// Device name for the interface (see SP_DEVICE_INTERFACE_DETAIL_DATA 204 /// for details) 205 wchar_t device_name[1]; 206} AdbInterfaceInfo; 207 208/** \brief Creates USB interface enumerator 209 210 This routine enumerates all USB interfaces that match provided class ID. 211 This routine uses SetupDiGetClassDevs SDK routine to enumerate devices that 212 match class ID and then SetupDiEnumDeviceInterfaces SDK routine is called 213 to enumerate interfaces on the devices. 214 @param[in] class_id Device class ID, assigned by the driver. 215 @param[in] exclude_not_present If true enumation will include only those 216 devices that are currently present. 217 @param[in] exclude_removed If true interfaces with SPINT_REMOVED flag set 218 will be not included in the enumeration. 219 @param[in] active_only If true only active interfaces (with flag 220 SPINT_ACTIVE set) will be included in the enumeration. 221 @return Handle to the enumerator object or NULL on failure. If NULL is 222 returned GetLastError() provides extended error information. 223*/ 224ADBWIN_API ADBAPIHANDLE __cdecl AdbEnumInterfaces(GUID class_id, 225 bool exclude_not_present, 226 bool exclude_removed, 227 bool active_only); 228 229/** \brief Gets next interface information 230 231 @param[in] adb_handle Handle to interface enumerator object obtained via 232 AdbEnumInterfaces call. 233 @param[out] info Upon successful completion will receive interface 234 information. Can be NULL. If it is NULL, upon return from this 235 routine size parameter will contain memory size required for the 236 next entry. 237 @param[in,out] size On the way in provides size of the memory buffer 238 addressed by info parameter. On the way out (only if buffer was not 239 big enough) will provide memory size required for the next entry. 240 @return true on success, false on error. If false is returned 241 GetLastError() provides extended error information. 242 ERROR_INSUFFICIENT_BUFFER indicates that buffer provided in info 243 parameter was not big enough and size parameter contains memory size 244 required for the next entry. ERROR_NO_MORE_ITEMS indicates that 245 enumeration is over and there are no more entries to return. 246*/ 247ADBWIN_API bool __cdecl AdbNextInterface(ADBAPIHANDLE adb_handle, 248 AdbInterfaceInfo* info, 249 unsigned long* size); 250 251/** \brief Resets enumerator so next call to AdbNextInterface will start 252 from the beginning. 253 254 @param[in] adb_handle Handle to interface enumerator object obtained via 255 AdbEnumInterfaces call. 256 @return true on success, false on error. If false is returned GetLastError() 257 provides extended error information. 258*/ 259ADBWIN_API bool __cdecl AdbResetInterfaceEnum(ADBAPIHANDLE adb_handle); 260 261/** \brief Creates USB interface object 262 263 This routine creates an object that represents a USB interface. 264 @param[in] interface_name Name of the interface. 265 @return Handle to the interface object or NULL on failure. If NULL is 266 returned GetLastError() provides extended error information. 267*/ 268ADBWIN_API ADBAPIHANDLE __cdecl AdbCreateInterfaceByName(const wchar_t* interface_name); 269 270/** \brief Creates USB interface object based on vendor, product and 271 interface IDs. 272 273 This routine creates and object that represents a USB interface on our 274 device. It uses AdbCreateInterfaceByName to actually do the create. 275 @param[in] class_id Device class ID, assigned by the driver. 276 @param[in] vendor_id Device vendor ID 277 @param[in] product_id Device product ID 278 @param[in] interface_id Device interface ID. This parameter is optional. 279 Value 0xFF indicates that interface should be addressed by vendor 280 and product IDs only. 281 @return Handle to the interface object or NULL on failure. If NULL is 282 returned GetLastError() provides extended error information. 283*/ 284ADBWIN_API ADBAPIHANDLE __cdecl AdbCreateInterface(GUID class_id, 285 unsigned short vendor_id, 286 unsigned short product_id, 287 unsigned char interface_id); 288 289/** \brief Gets interface name. 290 291 @param[in] adb_interface A handle to interface object created with 292 AdbCreateInterface call. 293 @param[out] buffer Buffer for the name. Can be NULL in which case 294 buffer_char_size will contain number of characters required for 295 the name. 296 @param[in,out] buffer_char_size On the way in supplies size (in characters) 297 of the buffer. On the way out, if method failed and GetLastError 298 reports ERROR_INSUFFICIENT_BUFFER, will contain number of characters 299 required for the name. 300 @param[in] ansi If true the name will be returned as single character 301 string. Otherwise name will be returned as wide character string. 302 @return true on success, false on failure. If false is returned 303 GetLastError() provides extended error information. 304*/ 305ADBWIN_API bool __cdecl AdbGetInterfaceName(ADBAPIHANDLE adb_interface, 306 void* buffer, 307 unsigned long* buffer_char_size, 308 bool ansi); 309 310/** \brief Gets serial number for interface's device. 311 312 @param[in] adb_interface A handle to interface object created with 313 AdbCreateInterface call. 314 @param[out] buffer Buffer for the serail number string. Can be NULL in which 315 case buffer_char_size will contain number of characters required for 316 the string. 317 @param[in,out] buffer_char_size On the way in supplies size (in characters) 318 of the buffer. On the way out, if method failed and GetLastError 319 reports ERROR_INSUFFICIENT_BUFFER, will contain number of characters 320 required for the name. 321 @param[in] ansi If true the name will be returned as single character 322 string. Otherwise name will be returned as wide character string. 323 @return true on success, false on failure. If false is returned 324 GetLastError() provides extended error information. 325*/ 326ADBWIN_API bool __cdecl AdbGetSerialNumber(ADBAPIHANDLE adb_interface, 327 void* buffer, 328 unsigned long* buffer_char_size, 329 bool ansi); 330 331/** \brief Gets device descriptor for the USB device associated with 332 the given interface. 333 334 @param[in] adb_interface A handle to interface object created with 335 AdbCreateInterface call. 336 @param[out] desc Upon successful completion will have usb device 337 descriptor. 338 @return true on success, false on failure. If false is returned 339 GetLastError() provides extended error information. 340*/ 341ADBWIN_API bool __cdecl AdbGetUsbDeviceDescriptor(ADBAPIHANDLE adb_interface, 342 USB_DEVICE_DESCRIPTOR* desc); 343 344/** \brief Gets descriptor for the selected USB device configuration. 345 346 @param[in] adb_interface A handle to interface object created with 347 AdbCreateInterface call. 348 @param[out] desc Upon successful completion will have usb device 349 configuration descriptor. 350 @return true on success, false on failure. If false is returned 351 GetLastError() provides extended error information. 352*/ 353ADBWIN_API bool __cdecl AdbGetUsbConfigurationDescriptor( 354 ADBAPIHANDLE adb_interface, 355 USB_CONFIGURATION_DESCRIPTOR* desc); 356 357/** \brief Gets descriptor for the given interface. 358 359 @param[in] adb_interface A handle to interface object created with 360 AdbCreateInterface call. 361 @param[out] desc Upon successful completion will have usb device 362 configuration descriptor. 363 @return true on success, false on failure. If false is returned 364 GetLastError() provides extended error information. 365*/ 366ADBWIN_API bool __cdecl AdbGetUsbInterfaceDescriptor(ADBAPIHANDLE adb_interface, 367 USB_INTERFACE_DESCRIPTOR* desc); 368 369/** \brief Gets information about an endpoint on the given interface. 370 371 @param[in] adb_interface A handle to interface object created with 372 AdbCreateInterface call. 373 @param[in] endpoint_index Zero-based endpoint index. There are two 374 shortcuts for this parameter: ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX 375 and ADB_QUERY_BULK_READ_ENDPOINT_INDEX that provide information 376 about bulk write and bulk read endpoints respectively. 377 @param[out] info Upon successful completion will have endpoint information. 378 @return true on success, false on failure. If false is returned 379 GetLastError() provides extended error information. 380*/ 381ADBWIN_API bool __cdecl AdbGetEndpointInformation(ADBAPIHANDLE adb_interface, 382 unsigned char endpoint_index, 383 AdbEndpointInformation* info); 384 385/** \brief Gets information about default bulk read endpoint on the given 386 interface. 387 388 @param[in] adb_interface A handle to interface object created with 389 AdbCreateInterface call. 390 @param[out] info Upon successful completion will have endpoint information. 391 @return true on success, false on failure. If false is returned 392 GetLastError() provides extended error information. 393*/ 394ADBWIN_API bool __cdecl AdbGetDefaultBulkReadEndpointInformation( 395 ADBAPIHANDLE adb_interface, 396 AdbEndpointInformation* info); 397 398/** \brief Gets information about default bulk write endpoint on the given 399 interface. 400 401 @param[in] adb_interface A handle to interface object created with 402 AdbCreateInterface call. 403 @param[out] info Upon successful completion will have endpoint information. 404 @return true on success, false on failure. If false is returned 405 GetLastError() provides extended error information. 406*/ 407ADBWIN_API bool __cdecl AdbGetDefaultBulkWriteEndpointInformation( 408 ADBAPIHANDLE adb_interface, 409 AdbEndpointInformation* info); 410 411/** \brief Opens an endpoint on the given interface. 412 413 Endpoints are always opened for overlapped I/O. 414 @param[in] adb_interface A handle to interface object created with 415 AdbCreateInterface call. 416 @param[in] endpoint_index Zero-based endpoint index. There are two 417 shortcuts for this parameter: ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX 418 and ADB_QUERY_BULK_READ_ENDPOINT_INDEX that provide information 419 about bulk write and bulk read endpoints respectively. 420 @param[in] access_type Desired access type. In the current implementation 421 this parameter has no effect on the way endpoint is opened. It's 422 always read / write access. 423 @param[in] sharing_mode Desired share mode. In the current implementation 424 this parameter has no effect on the way endpoint is opened. It's 425 always shared for read / write. 426 @return Handle to the opened endpoint object or NULL on failure. If NULL is 427 returned GetLastError() provides extended error information. 428*/ 429ADBWIN_API ADBAPIHANDLE __cdecl AdbOpenEndpoint(ADBAPIHANDLE adb_interface, 430 unsigned char endpoint_index, 431 AdbOpenAccessType access_type, 432 AdbOpenSharingMode sharing_mode); 433 434/** \brief Opens default bulk read endpoint on the given interface. 435 436 Endpoints are always opened for overlapped I/O. 437 @param[in] adb_interface A handle to interface object created with 438 AdbCreateInterface call. 439 @param[in] access_type Desired access type. In the current implementation 440 this parameter has no effect on the way endpoint is opened. It's 441 always read / write access. 442 @param[in] sharing_mode Desired share mode. In the current implementation 443 this parameter has no effect on the way endpoint is opened. It's 444 always shared for read / write. 445 @return Handle to the opened endpoint object or NULL on failure. If NULL is 446 returned GetLastError() provides extended error information. 447*/ 448ADBWIN_API ADBAPIHANDLE __cdecl AdbOpenDefaultBulkReadEndpoint( 449 ADBAPIHANDLE adb_interface, 450 AdbOpenAccessType access_type, 451 AdbOpenSharingMode sharing_mode); 452 453/** \brief Opens default bulk write endpoint on the given interface. 454 455 Endpoints are always opened for overlapped I/O. 456 @param[in] adb_interface A handle to interface object created with 457 AdbCreateInterface call. 458 @param[in] access_type Desired access type. In the current implementation 459 this parameter has no effect on the way endpoint is opened. It's 460 always read / write access. 461 @param[in] sharing_mode Desired share mode. In the current implementation 462 this parameter has no effect on the way endpoint is opened. It's 463 always shared for read / write. 464 @return Handle to the opened endpoint object or NULL on failure. If NULL is 465 returned GetLastError() provides extended error information. 466*/ 467ADBWIN_API ADBAPIHANDLE __cdecl AdbOpenDefaultBulkWriteEndpoint( 468 ADBAPIHANDLE adb_interface, 469 AdbOpenAccessType access_type, 470 AdbOpenSharingMode sharing_mode); 471 472/** \brief Gets handle to interface object for the given endpoint 473 474 @param[in] adb_endpoint A handle to opened endpoint object, obtained via one 475 of the AdbOpenXxxEndpoint calls. 476 @return Handle to the interface for this endpoint or NULL on failure. If NULL 477 is returned GetLastError() provides extended error information. 478*/ 479ADBWIN_API ADBAPIHANDLE __cdecl AdbGetEndpointInterface(ADBAPIHANDLE adb_endpoint); 480 481/** \brief Gets information about the given endpoint. 482 483 @param[in] adb_endpoint A handle to opened endpoint object, obtained via one 484 of the AdbOpenXxxEndpoint calls. 485 @param[out] info Upon successful completion will have endpoint information. 486 @return true on success, false on failure. If false is returned 487 GetLastError() provides extended error information. 488*/ 489ADBWIN_API bool __cdecl AdbQueryInformationEndpoint(ADBAPIHANDLE adb_endpoint, 490 AdbEndpointInformation* info); 491 492/** \brief Asynchronously reads from the given endpoint. 493 494 @param[in] adb_endpoint A handle to opened endpoint object, obtained via one 495 of the AdbOpenXxxEndpoint calls. 496 @param[out] buffer Pointer to the buffer that receives the data. 497 @param[in] bytes_to_read Number of bytes to be read. 498 @param[out] bytes_read Number of bytes read. Can be NULL. 499 @param[in] event_handle Event handle that should be signaled when async I/O 500 completes. Can be NULL. If it's not NULL this handle will be used to 501 initialize OVERLAPPED structure for this I/O. 502 @param[in] time_out A timeout (in milliseconds) required for this I/O to 503 complete. Zero value for this parameter means that there is no 504 timeout for this I/O. 505 @return A handle to IO completion object or NULL on failure. If NULL is 506 returned GetLastError() provides extended error information. 507*/ 508ADBWIN_API ADBAPIHANDLE __cdecl AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint, 509 void* buffer, 510 unsigned long bytes_to_read, 511 unsigned long* bytes_read, 512 unsigned long time_out, 513 HANDLE event_handle); 514 515/** \brief Asynchronously writes to the given endpoint. 516 517 @param[in] adb_endpoint A handle to opened endpoint object, obtained via one 518 of the AdbOpenXxxEndpoint calls. 519 @param[in] buffer Pointer to the buffer containing the data to be written. 520 @param[in] bytes_to_write Number of bytes to be written. 521 @param[out] bytes_written Number of bytes written. Can be NULL. 522 @param[in] event_handle Event handle that should be signaled when async I/O 523 completes. Can be NULL. If it's not NULL this handle will be used to 524 initialize OVERLAPPED structure for this I/O. 525 @param[in] time_out A timeout (in milliseconds) required for this I/O to 526 complete. Zero value for this parameter means that there is no 527 timeout for this I/O. 528 @return A handle to IO completion object or NULL on failure. If NULL is 529 returned GetLastError() provides extended error information. 530*/ 531ADBWIN_API ADBAPIHANDLE __cdecl AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint, 532 void* buffer, 533 unsigned long bytes_to_write, 534 unsigned long* bytes_written, 535 unsigned long time_out, 536 HANDLE event_handle); 537 538/** \brief Synchronously reads from the given endpoint. 539 540 @param[in] adb_endpoint A handle to opened endpoint object, obtained via one 541 of the AdbOpenXxxEndpoint calls. 542 @param[out] buffer Pointer to the buffer that receives the data. 543 @param[in] bytes_to_read Number of bytes to be read. 544 @param[out] bytes_read Number of bytes read. Can be NULL. 545 @param[in] time_out A timeout (in milliseconds) required for this I/O to 546 complete. Zero value for this parameter means that there is no 547 timeout for this I/O. 548 @return true on success and false on failure. If false is 549 returned GetLastError() provides extended error information. 550*/ 551ADBWIN_API bool __cdecl AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint, 552 void* buffer, 553 unsigned long bytes_to_read, 554 unsigned long* bytes_read, 555 unsigned long time_out); 556 557/** \brief Synchronously writes to the given endpoint. 558 559 @param[in] adb_endpoint A handle to opened endpoint object, obtained via one 560 of the AdbOpenXxxEndpoint calls. 561 @param[in] buffer Pointer to the buffer containing the data to be written. 562 @param[in] bytes_to_write Number of bytes to be written. 563 @param[out] bytes_written Number of bytes written. Can be NULL. 564 @param[in] time_out A timeout (in milliseconds) required for this I/O to 565 complete. Zero value for this parameter means that there is no 566 timeout for this I/O. 567 @return true on success and false on failure. If false is 568 returned GetLastError() provides extended error information. 569*/ 570ADBWIN_API bool __cdecl AdbWriteEndpointSync(ADBAPIHANDLE adb_endpoint, 571 void* buffer, 572 unsigned long bytes_to_write, 573 unsigned long* bytes_written, 574 unsigned long time_out); 575 576/** \brief Gets overlapped I/O result for async I/O performed on the 577 given endpoint. 578 579 @param[in] adb_io_completion A handle to an I/O completion object returned 580 from AdbRead/WriteAsync routines. 581 @param[out] ovl_data Buffer for the copy of this object's OVERLAPPED 582 structure. Can be NULL. 583 @param[out] bytes_transferred Pointer to a variable that receives the 584 number of bytes that were actually transferred by a read or write 585 operation. See SDK doc on GetOvelappedResult for more information. 586 Unlike regular GetOvelappedResult call this parameter can be NULL. 587 @param[in] wait If this parameter is true, the method does not return 588 until the operation has been completed. If this parameter is false 589 and the operation is still pending, the method returns false and 590 the GetLastError function returns ERROR_IO_INCOMPLETE. 591 @return true if I/O has been completed or false on failure or if request 592 is not yet completed. If false is returned GetLastError() provides 593 extended error information. If GetLastError returns 594 ERROR_IO_INCOMPLETE it means that I/O is not yet completed. 595*/ 596ADBWIN_API bool __cdecl AdbGetOvelappedIoResult(ADBAPIHANDLE adb_io_completion, 597 LPOVERLAPPED overlapped, 598 unsigned long* bytes_transferred, 599 bool wait); 600 601/** \brief Checks if overlapped I/O has been completed. 602 603 @param[in] adb_io_completion A handle to an I/O completion object returned 604 from AdbRead/WriteAsync routines. 605 @return true if I/O has been completed or false if it's still 606 incomplete. Regardless of the returned value, caller should 607 check GetLastError to validate that handle was OK. 608*/ 609ADBWIN_API bool __cdecl AdbHasOvelappedIoComplated(ADBAPIHANDLE adb_io_completion); 610 611/** \brief Closes handle previously opened with one of the API calls 612 613 @param[in] adb_handle ADB handle previously opened with one of the API calls 614 @return true on success or false on failure. If false is returned 615 GetLastError() provides extended error information. 616*/ 617ADBWIN_API bool __cdecl AdbCloseHandle(ADBAPIHANDLE adb_handle); 618 619#endif // ANDROID_USB_API_ADBWINAPI_H__ 620