Electroneum
Loading...
Searching...
No Matches
hw::trezor::Transport Class Referenceabstract

#include <transport.hpp>

Inheritance diagram for hw::trezor::Transport:

Public Member Functions

 Transport ()
virtual ~Transport ()=default
virtual bool ping ()
virtual std::string get_path () const
virtual void enumerate (t_transport_vect &res)
virtual void open ()
virtual void close ()
virtual void write (const google::protobuf::Message &req)=0
virtual void read (std::shared_ptr< google::protobuf::Message > &msg, messages::MessageType *msg_type=nullptr)=0
virtual std::shared_ptr< Transportfind_debug ()
virtual void write_chunk (const void *buff, size_t size)
virtual size_t read_chunk (void *buff, size_t size)
virtual std::ostream & dump (std::ostream &o) const

Protected Member Functions

virtual bool pre_open ()
virtual bool pre_close ()

Protected Attributes

long m_open_counter

Detailed Description

Definition at line 137 of file transport.hpp.

Constructor & Destructor Documentation

◆ Transport()

hw::trezor::Transport::Transport ( )

Definition at line 275 of file transport.cpp.

275 : m_open_counter(0) {
276
277 }

◆ ~Transport()

virtual hw::trezor::Transport::~Transport ( )
virtualdefault

Member Function Documentation

◆ close()

virtual void hw::trezor::Transport::close ( )
inlinevirtual

Reimplemented in hw::trezor::BridgeTransport, and hw::trezor::UdpTransport.

Definition at line 146 of file transport.hpp.

146{};

◆ dump()

virtual std::ostream & hw::trezor::Transport::dump ( std::ostream & o) const
inlinevirtual

Reimplemented in hw::trezor::BridgeTransport, and hw::trezor::UdpTransport.

Definition at line 153 of file transport.hpp.

153{ return o << "Transport<>"; }
Here is the caller graph for this function:

◆ enumerate()

virtual void hw::trezor::Transport::enumerate ( t_transport_vect & res)
inlinevirtual

Reimplemented in hw::trezor::BridgeTransport, and hw::trezor::UdpTransport.

Definition at line 144 of file transport.hpp.

144{};

◆ find_debug()

virtual std::shared_ptr< Transport > hw::trezor::Transport::find_debug ( )
inlinevirtual

Reimplemented in hw::trezor::UdpTransport.

Definition at line 149 of file transport.hpp.

149{ return nullptr; };

◆ get_path()

virtual std::string hw::trezor::Transport::get_path ( ) const
inlinevirtual

Reimplemented in hw::trezor::BridgeTransport, and hw::trezor::UdpTransport.

Definition at line 143 of file transport.hpp.

143{ return ""; };

◆ open()

virtual void hw::trezor::Transport::open ( )
inlinevirtual

Reimplemented in hw::trezor::BridgeTransport, and hw::trezor::UdpTransport.

Definition at line 145 of file transport.hpp.

145{};

◆ ping()

virtual bool hw::trezor::Transport::ping ( )
inlinevirtual

Reimplemented in hw::trezor::UdpTransport.

Definition at line 142 of file transport.hpp.

142{ return false; };

◆ pre_close()

bool hw::trezor::Transport::pre_close ( )
protectedvirtual

Definition at line 295 of file transport.cpp.

295 {
296 m_open_counter -= 1;
297
298 if (m_open_counter < 0){
299 MDEBUG("Already closed. Counter " << m_open_counter);
300
301 } else if (m_open_counter == 0) {
302 return true;
303
304 }
305
306 return false;
307 }
#define MDEBUG(x)
Definition misc_log_ex.h:76
Here is the caller graph for this function:

◆ pre_open()

bool hw::trezor::Transport::pre_open ( )
protectedvirtual

Definition at line 279 of file transport.cpp.

279 {
280 if (m_open_counter > 0){
281 MTRACE("Already opened, count: " << m_open_counter);
282 m_open_counter += 1;
283 return false;
284
285 } else if (m_open_counter < 0){
286 MTRACE("Negative open value: " << m_open_counter);
287
288 }
289
290 // Caller should set m_open_counter to 1 after open
291 m_open_counter = 0;
292 return true;
293 }
#define MTRACE(x)
Definition misc_log_ex.h:77
Here is the caller graph for this function:

◆ read()

virtual void hw::trezor::Transport::read ( std::shared_ptr< google::protobuf::Message > & msg,
messages::MessageType * msg_type = nullptr )
pure virtual

◆ read_chunk()

virtual size_t hw::trezor::Transport::read_chunk ( void * buff,
size_t size )
inlinevirtual

Reimplemented in hw::trezor::UdpTransport.

Definition at line 152 of file transport.hpp.

152{ return 0; };

◆ write()

virtual void hw::trezor::Transport::write ( const google::protobuf::Message & req)
pure virtual

◆ write_chunk()

virtual void hw::trezor::Transport::write_chunk ( const void * buff,
size_t size )
inlinevirtual

Reimplemented in hw::trezor::UdpTransport.

Definition at line 151 of file transport.hpp.

151{ };

Member Data Documentation

◆ m_open_counter

long hw::trezor::Transport::m_open_counter
protected

Definition at line 155 of file transport.hpp.


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/device_trezor/trezor/transport.hpp
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/device_trezor/trezor/transport.cpp