QuadroCopter  0.1.4
quadro::overlays::overlayBase Class Reference

#include <overlayBase.h>

Inheritance diagram for quadro::overlays::overlayBase:
quadro::analog::analogOverlay quadro::overlays::pinOverlay quadro::pwm::pwmOverlay quadro::pwm::pwmDevice quadro::pwm::motors quadro::pwm::dji_2212

Public Member Functions

 overlayBase ()
 
bool isLoaded (const char *searchFile)
 
bool load (const char *Overlay)
 

Public Attributes

int fileHandle
 
char errMessage [1024]
 
struct stat sb
 

Constructor & Destructor Documentation

overlayBase::overlayBase ( )
25 {
26 }

Member Function Documentation

bool overlayBase::isLoaded ( const char *  searchFile)
29 {
30 #ifdef DEBUG
31  cout << "Searching for : " << searchFile << endl;
32 #endif
33  if ( stat( searchFile, &sb ) == 0 ) {
34 #ifdef DEBUG
35  cout << "-- Found it..." << endl;
36 #endif
37  return true;
38  }
39 #ifdef DEBUG
40  cout << "-- File not found..." << endl;
41 #endif
42  return false;
43 }
struct stat sb
Definition: overlayBase.h:72
bool overlayBase::load ( const char *  Overlay)
46 {
47  try {
48 #ifdef DEBUG
49  cout << "-- overlay not loaded yet, attempting to load : " << overlay << endl;
50 #endif
51  this->fileHandle = open( SLOTS_DIR, O_WRONLY );
52  if ( write( this->fileHandle, Overlay, 1024 ) > 0 ) {
53  close( this->fileHandle );
54 #ifdef DEBUG
55  cout << "--- overlay loaded successfully." << endl;
56 #endif
57  return true;
58  }
59  else {
60 #ifdef DEBUG
61  cout << "--- Failed to load overlay." << endl;
62 #endif
63  return false;
64  }
65  }
66  catch ( exception& e ) {
67  cerr << "Exception : " << e.what() << endl;
68  }
69 }
int fileHandle
Definition: overlayBase.h:68
#define SLOTS_DIR
Full system path to SLOTS, used to export device tree overlays.
Definition: overlayBase.h:37

Member Data Documentation

char quadro::overlays::overlayBase::errMessage[1024]
int quadro::overlays::overlayBase::fileHandle
struct stat quadro::overlays::overlayBase::sb

The documentation for this class was generated from the following files:
  • /Users/michaelbrookes/ClionProjects/Quadro/lib/overlays/overlayBase.h
  • /Users/michaelbrookes/ClionProjects/Quadro/lib/overlays/overlayBase.cpp