LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::platform_android::AdbClient Class Reference

#include <AdbClient.h>

Classes

class  SyncService
 

Public Types

enum  UnixSocketNamespace { UnixSocketNamespaceAbstract , UnixSocketNamespaceFileSystem }
 
using DeviceIDList = std::list< std::string >
 

Public Member Functions

 AdbClient ()
 
 AdbClient (const std::string &device_id)
 
virtual ~AdbClient ()
 
const std::string & GetDeviceID () const
 
Status GetDevices (DeviceIDList &device_list)
 
Status SetPortForwarding (const uint16_t local_port, const uint16_t remote_port)
 
Status SetPortForwarding (const uint16_t local_port, llvm::StringRef remote_socket_name, const UnixSocketNamespace socket_namespace)
 
Status DeletePortForwarding (const uint16_t local_port)
 
Status Shell (const char *command, std::chrono::milliseconds timeout, std::string *output)
 
virtual Status ShellToFile (const char *command, std::chrono::milliseconds timeout, const FileSpec &output_file_spec)
 
virtual std::unique_ptr< SyncServiceGetSyncService (Status &error)
 
Status SwitchDeviceTransport ()
 

Static Public Member Functions

static Status CreateByDeviceID (const std::string &device_id, AdbClient &adb)
 

Private Member Functions

Status Connect ()
 
void SetDeviceID (const std::string &device_id)
 
Status SendMessage (const std::string &packet, const bool reconnect=true)
 
Status SendDeviceMessage (const std::string &packet)
 
Status ReadMessage (std::vector< char > &message)
 
Status ReadMessageStream (std::vector< char > &message, std::chrono::milliseconds timeout)
 
Status GetResponseError (const char *response_id)
 
Status ReadResponseStatus ()
 
Status Sync ()
 
Status StartSync ()
 
Status internalShell (const char *command, std::chrono::milliseconds timeout, std::vector< char > &output_buf)
 
Status ReadAllBytes (void *buffer, size_t size)
 

Private Attributes

std::string m_device_id
 
std::unique_ptr< Connectionm_conn
 

Detailed Description

Definition at line 26 of file AdbClient.h.

Member Typedef Documentation

◆ DeviceIDList

Definition at line 33 of file AdbClient.h.

Member Enumeration Documentation

◆ UnixSocketNamespace

Enumerator
UnixSocketNamespaceAbstract 
UnixSocketNamespaceFileSystem 

Definition at line 28 of file AdbClient.h.

Constructor & Destructor Documentation

◆ AdbClient() [1/2]

AdbClient::AdbClient ( )
default

◆ AdbClient() [2/2]

AdbClient::AdbClient ( const std::string &  device_id)
explicit

Definition at line 119 of file AdbClient.cpp.

◆ ~AdbClient()

AdbClient::~AdbClient ( )
virtualdefault

Member Function Documentation

◆ Connect()

Status AdbClient::Connect ( )
private

Definition at line 129 of file AdbClient.cpp.

References error(), and m_conn.

Referenced by SendMessage().

◆ CreateByDeviceID()

Status AdbClient::CreateByDeviceID ( const std::string &  device_id,
AdbClient adb 
)
static

◆ DeletePortForwarding()

Status AdbClient::DeletePortForwarding ( const uint16_t  local_port)

Definition at line 201 of file AdbClient.cpp.

References error(), ReadResponseStatus(), and SendDeviceMessage().

Referenced by DeleteForwardPortWithAdb().

◆ GetDeviceID()

const std::string & AdbClient::GetDeviceID ( ) const

◆ GetDevices()

Status AdbClient::GetDevices ( DeviceIDList device_list)

Definition at line 142 of file AdbClient.cpp.

References error(), m_conn, ReadMessage(), ReadResponseStatus(), and SendMessage().

Referenced by CreateByDeviceID().

◆ GetResponseError()

Status AdbClient::GetResponseError ( const char *  response_id)
private

Definition at line 300 of file AdbClient.cpp.

References error(), kFAIL, and ReadMessage().

Referenced by ReadResponseStatus().

◆ GetSyncService()

std::unique_ptr< AdbClient::SyncService > AdbClient::GetSyncService ( Status error)
virtual

Definition at line 417 of file AdbClient.cpp.

References error(), m_conn, and StartSync().

◆ internalShell()

Status AdbClient::internalShell ( const char *  command,
std::chrono::milliseconds  timeout,
std::vector< char > &  output_buf 
)
private

◆ ReadAllBytes()

Status AdbClient::ReadAllBytes ( void *  buffer,
size_t  size 
)
private

◆ ReadMessage()

Status AdbClient::ReadMessage ( std::vector< char > &  message)
private

Definition at line 240 of file AdbClient.cpp.

References error(), and ReadAllBytes().

Referenced by GetDevices(), and GetResponseError().

◆ ReadMessageStream()

Status AdbClient::ReadMessageStream ( std::vector< char > &  message,
std::chrono::milliseconds  timeout 
)
private

Definition at line 261 of file AdbClient.cpp.

References lldb::eConnectionStatusSuccess, elapsed(), error(), and m_conn.

Referenced by internalShell().

◆ ReadResponseStatus()

Status AdbClient::ReadResponseStatus ( )
private

◆ SendDeviceMessage()

Status AdbClient::SendDeviceMessage ( const std::string &  packet)
private

Definition at line 234 of file AdbClient.cpp.

References m_device_id, and SendMessage().

Referenced by DeletePortForwarding(), and SetPortForwarding().

◆ SendMessage()

Status AdbClient::SendMessage ( const std::string &  packet,
const bool  reconnect = true 
)
private

Definition at line 212 of file AdbClient.cpp.

References Connect(), error(), and m_conn.

Referenced by GetDevices(), internalShell(), SendDeviceMessage(), SwitchDeviceTransport(), and Sync().

◆ SetDeviceID()

void AdbClient::SetDeviceID ( const std::string &  device_id)
private

Definition at line 123 of file AdbClient.cpp.

References m_device_id.

Referenced by CreateByDeviceID().

◆ SetPortForwarding() [1/2]

Status AdbClient::SetPortForwarding ( const uint16_t  local_port,
const uint16_t  remote_port 
)

Definition at line 169 of file AdbClient.cpp.

References error(), ReadResponseStatus(), and SendDeviceMessage().

Referenced by ForwardPortWithAdb().

◆ SetPortForwarding() [2/2]

Status AdbClient::SetPortForwarding ( const uint16_t  local_port,
llvm::StringRef  remote_socket_name,
const UnixSocketNamespace  socket_namespace 
)

◆ Shell()

Status AdbClient::Shell ( const char *  command,
std::chrono::milliseconds  timeout,
std::string *  output 
)

Definition at line 384 of file AdbClient.cpp.

References error(), and internalShell().

◆ ShellToFile()

Status AdbClient::ShellToFile ( const char *  command,
std::chrono::milliseconds  timeout,
const FileSpec output_file_spec 
)
virtual

Definition at line 396 of file AdbClient.cpp.

References error(), lldb_private::FileSpec::GetPath(), and internalShell().

◆ StartSync()

Status AdbClient::StartSync ( )
private

Definition at line 324 of file AdbClient.cpp.

References error(), SwitchDeviceTransport(), and Sync().

Referenced by GetSyncService().

◆ SwitchDeviceTransport()

Status AdbClient::SwitchDeviceTransport ( )

Definition at line 313 of file AdbClient.cpp.

References error(), m_device_id, ReadResponseStatus(), and SendMessage().

Referenced by internalShell(), and StartSync().

◆ Sync()

Status AdbClient::Sync ( )
private

Definition at line 337 of file AdbClient.cpp.

References error(), ReadResponseStatus(), and SendMessage().

Referenced by StartSync().

Member Data Documentation

◆ m_conn

std::unique_ptr<Connection> lldb_private::platform_android::AdbClient::m_conn
private

◆ m_device_id

std::string lldb_private::platform_android::AdbClient::m_device_id
private

Definition at line 136 of file AdbClient.h.

Referenced by GetDeviceID(), SendDeviceMessage(), SetDeviceID(), and SwitchDeviceTransport().


The documentation for this class was generated from the following files: