Aria  2.8.0
ArLCDMTX Class Reference

Interface to LCD interface panel on an MTX-type robot. More...

#include <ArLCDMTX.h>

Inherits ArASyncTask.

Public Types

enum  Screens { BOOT_SCREEN =0x00, STATUS_SCREEN =0x01 }
 
- Public Types inherited from ArThread
typedef std::map< ThreadType, ArThread * > MapType
 
enum  Status {
  STATUS_FAILED =1, STATUS_NORESOURCE, STATUS_NO_SUCH_THREAD, STATUS_INVALID,
  STATUS_JOIN_SELF, STATUS_ALREADY_DETATCHED
}
 
typedef pthread_t ThreadType
 

Public Member Functions

void addDisconnectOnErrorCB (ArFunctor *functor, int position=51)
 Adds a callback for when disconnection happens because of an error.
 
 ArLCDMTX (int lcdBoardNum=0, const char *name="MTXLCD", ArDeviceConnection *conn=NULL, ArRobot *robot=NULL)
 Constructor.
 
virtual bool blockingConnect (bool sendTracking, bool recvTracking, int lcdNumber, ArFunctor1< int > *onCallback, ArFunctor1< int > *offCallback)
 
bool checkLostConnection (void)
 check for lost connections More...
 
virtual bool disconnect (void)
 
void disconnectOnError (void)
 disconnect
 
int getBoardNum (void)
 
virtual double getConnectionTimeoutSeconds (void)
 Gets the number of seconds without a response until connection assumed lost.
 
const char * getDefaultPortType (void)
 Gets the default port type for the lcd.
 
const char * getDefaultTcpPort (void)
 Gets the default port type for the lcd.
 
ArDeviceConnectiongetDeviceConnection (void)
 Gets the device this instance receives packets from.
 
const char * getFirmwareVersion (void) const
 
ArTime getLastReadingTime (void)
 Gets the time data was last receieved.
 
virtual const char * getName (void) const
 
int getReadingCount (void)
 Gets the number of lcd readings received in the last second.
 
bool internalMTXLCDOverrideBacklight (bool backlight)
 internal call (don't use it) that updates from the calling thread instead of the correct thread
 
bool internalMTXLCDOverrideBootScreenText (const char *status)
 internal call (don't use it) that updates from the calling thread instead of the correct thread
 
bool internalMTXLCDOverrideMainScreenText (const char *status)
 internal call (don't use it) that updates from the calling thread instead of the correct thread
 
virtual bool isConnected (void)
 
virtual bool isTryingToConnect (void)
 
virtual int lockDevice ()
 Lock this device.
 
void remDisconnectOnErrorCB (ArFunctor *functor)
 Removes a callback for when disconnection happens because of an error.
 
virtual void setConnectionTimeoutSeconds (double seconds)
 Sets the numter of seconds without a response until connection assumed lost.
 
void setDeviceConnection (ArDeviceConnection *conn)
 Sets the device this instance receives packets from.
 
void setIdentifier (const char *identifier)
 
void setInfoLogLevel (ArLog::LogLevel infoLogLevel)
 
bool setMTXLCDBackLight (bool backLight)
 
bool setMTXLCDBootScreenText (const char *status)
 
bool setMTXLCDMainScreenText (const char *status)
 exposed routines to set the various screen status(s) text size is limited to 247 characters... More...
 
bool setMTXLCDScreenNumber (unsigned char screenNumber)
 
virtual void setRobot (ArRobot *robot)
 Sets the robot pointer, also attaches its process function to the robot as a Sensor Interpretation task. More...
 
virtual int tryLockDevice ()
 Try to lock this device.
 
virtual int unlockDevice ()
 Unlock this device.
 
bool verifyFwVersion ()
 
virtual ~ArLCDMTX ()
 Destructor.
 
- Public Member Functions inherited from ArASyncTask
 ArASyncTask ()
 Constructor.
 
virtual int create (bool joinable=true, bool lowerPriority=true)
 Create the task and start it going.
 
virtual const char * getThreadActivity (void)
 Gets a string that describes what the thread is doing, or NULL if it doesn't know. More...
 
virtual void run (void)
 Run without creating a new thread. More...
 
virtual void runAsync (void)
 Run in its own thread.
 
virtual void * runInThisThread (void *arg=0)
 Internal function used with system threading system to run the new thread. More...
 
virtual void stopRunning (void)
 Stop the thread.
 
virtual ~ArASyncTask ()
 Destructor.
 
- Public Member Functions inherited from ArThread
 ArThread (bool blockAllSignals=true)
 Constructor.
 
 ArThread (ThreadType thread, bool joinable, bool blockAllSignals=true)
 Constructor - starts the thread.
 
 ArThread (ArFunctor *func, bool joinable=true, bool blockAllSignals=true)
 Constructor - starts the thread.
 
virtual void cancel (void)
 Cancel the thread.
 
virtual int detach (void)
 Detatch the thread so it cant be joined.
 
bool getBlockAllSignals (void)
 Do we block all process signals at startup?
 
virtual ArFunctorgetFunc (void) const
 Get the functor that the thread runs.
 
virtual bool getJoinable (void) const
 Get the joinable status of the thread.
 
virtual ThreadType getOSThread (void) const
 Get the underlying os thread type.
 
pid_t getPID (void)
 
virtual bool getRunning (void) const
 Get the running status of the thread.
 
virtual bool getRunningWithLock (void)
 Get the running status of the thread, locking around the variable.
 
virtual const ThreadType * getThread (void) const
 Get the underlying thread type.
 
virtual const char * getThreadName (void)
 Gets the name of the thread.
 
pid_t getTID (void)
 
virtual bool isThreadFinished () const
 Returns whether the thread has been completed and can be deleted. More...
 
virtual bool isThreadStarted () const
 Returns whether the thread has been started. More...
 
virtual int join (void **ret=NULL)
 Join on the thread.
 
int lock (void)
 Lock the thread instance. More...
 
virtual void logThreadInfo (void)
 Logs the information about this thread.
 
virtual void setRunning (bool running)
 Set the running value on the thread.
 
virtual void setThreadName (const char *name)
 Sets the name of the thread.
 
virtual void threadFinished (void)
 Marks the thread as finished and logs useful debugging information. More...
 
virtual void threadStarted (void)
 Marks the thread as started and logs useful debugging information. More...
 
int tryLock (void)
 Try to lock the thread instance without blocking. More...
 
int unlock (void)
 Unlock the thread instance. More...
 
virtual ~ArThread ()
 Destructor.
 

Protected Types

enum  Commands {
  KEEP_ALIVE =0x00, VERSION =0x01, SYSTEM_INFO =0x02, REBOOT =0x03,
  GET_CURRENT_SCREEN_NUM =0x10, GET_TEXT_FIELD =0x11, GET_BACKLIGHT =0x12, GET_SYSTEM_METERS =0x13,
  SET_SCREEN_NUM =0x20, SET_TEXT_FIELD =0x21, SET_BACKLIGHT =0x22, SET_BATTERY_WIFI =0x23
}
 
enum  Headers { HEADER1 =0xfa, HEADER2 =0xcd }
 
enum  SYS_INFO { SYS_INFO_STOP =0x00, SYS_INFO_ONCE =0x01, SYS_INFO_CONTINUOUS =0x02 }
 
enum  TextNumbers {
  BOOT_STATUS_TEXT =0x00, MAIN_STATUS_TEXT =0x01, MODE_TEXT =0x02, ROBOT_ID_TEXT =0x03,
  ROBOT_IP_TEXT =0x04
}
 

Protected Member Functions

void clear (void)
 
bool downloadFirmware ()
 
void failedToConnect (void)
 
bool getBacklight (unsigned char *backlight)
 
unsigned char getBatteryPercentage ()
 
bool getBootStatus (const char *status)
 
void getIpAddress ()
 
bool getMainStatus (const char *status)
 
bool getScreenNumber (unsigned char *currentScreenNumber)
 
bool getSystemMeters (unsigned char *battery, unsigned char *wifi)
 
bool getTextField (unsigned char textNumber, char *text)
 
bool getTextStatus (const char *status)
 
unsigned char getWifiPercentage ()
 
virtual void internalGotReading (void)
 
virtual void lcdSetName (const char *name)
 
void log (void)
 Logs the information about the sensor.
 
virtual void * runThread (void *arg)
 
std::string searchForFile (const char *dirToLookIn, const char *prefix, const char *suffix)
 
bool sendKeepAlive ()
 
bool sendReboot ()
 
bool sendSystemInfo (unsigned char command)
 
bool sendVersion ()
 
void sensorInterp (void)
 
bool setBacklight (bool backlight)
 
bool setBootStatus (const char *status)
 
bool setMainStatus (const char *status)
 
bool setRobotIdStatus (const char *status)
 
bool setRobotIPStatus (const char *status)
 
bool setScreenNumber (unsigned char screenNumber)
 
bool setSystemMeters (unsigned char battery, unsigned char wifi)
 
bool setTextField (unsigned char textNumber, const char *text)
 
bool setTextStatus (const char *status)
 
void writeToLCD ()
 
- Protected Member Functions inherited from ArThread
virtual int doJoin (void **ret=NULL)
 

Protected Attributes

ArRetFunctorC< bool, ArLCDMTXmyAriaExitCB
 
bool myBackLightChanged
 
int myBoardNum
 
bool myBootTextChanged
 
bool myChangedBackLight
 
char myChangedBootText [248]
 
char myChangedModeText [248]
 
unsigned char myChangedScreenNumber
 
char myChangedStatusText [248]
 
ArRobot::ChargeState myChargeState
 
ArDeviceConnectionmyConn
 
bool myConnFailOption
 
unsigned char myCurrentScreen
 
long long myCurrentTime
 
ArMutex myDataMutex
 
std::string myDefaultPortType
 
std::string myDefaultTcpPort
 
ArMutex myDeviceMutex
 
ArCallbackList myDisconnectOnErrorCBList
 
std::string myFirmwareVersion
 
unsigned char myId
 
ArLog::LogLevel myInfoLogLevel
 
std::string myIpAddress
 
bool myIsConnected
 
ArTime myLastReading
 
ArLog::LogLevel myLogLevel
 
bool myMainScreenModeChanged
 
bool myMainScreenStatusChanged
 
std::string myName
 
std::string myNewFwFile
 
bool myOnCharger
 
std::list< ArRobotPacket * > myPackets
 
ArMutex myPacketsMutex
 
ArTime myPrevLCDIntTime
 
ArFunctorC< ArLCDMTXmyProcessCB
 
int myReadingCount
 
int myReadingCurrentCount
 
ArRobotPacketReceivermyReceiver
 
bool myRecvTracking
 
bool myRequestedCellInfoLCDPackets
 
bool myRequestedSysInfoLCDPackets
 
ArRobotmyRobot
 
std::string myRobotIdentifier
 
bool myRobotIdentifierChanged
 
bool myRobotRunningAndConnected
 
bool myScreenNumberChanged
 
ArRobotPacketSendermySender
 
bool mySendTracking
 
ArFunctorC< ArLCDMTXmySensorInterpTask
 
unsigned int mySerialNumber
 
bool myStartConnect
 
unsigned char myStatusFlags
 
time_t myTimeLastReading
 
double myTimeoutSeconds
 
bool myTryingToConnect
 
unsigned char myVersion
 
- Protected Attributes inherited from ArThread
bool myBlockAllSignals
 
bool myFinished
 
ArFunctormyFunc
 
bool myJoinable
 
ArMutex myMutex
 
std::string myName
 
pid_t myPID
 
bool myRunning
 State variable to denote when the thread should continue or exit.
 
bool myStarted
 
ArStrMap myStrMap
 
ThreadType myThread
 
pid_t myTID
 

Additional Inherited Members

- Static Public Member Functions inherited from ArThread
static void cancelAll (void)
 Cancel all threads.
 
static ArLog::LogLevel getLogLevel (void)
 Gets the logging level for thread information.
 
static ThreadType getThisOSThread (void)
 Get the underlying os thread type of this thread.
 
static const ThreadType * getThisThread (void)
 Get the underlying thread type of this thread.
 
static const char * getThisThreadName (void)
 Gets the name of the this thread.
 
static void init (void)
 Initialize the internal book keeping structures. More...
 
static void joinAll (void)
 Join on all threads.
 
static ThreadType osSelf (void)
 Returns the os self of the current thread. More...
 
static ArThreadself (void)
 Returns the instance of your own thread (the current one) More...
 
static void setLogLevel (ArLog::LogLevel level)
 Sets the logging level for thread information.
 
static void shutdown ()
 Shuts down and deletes the last remaining thread; call after joinAll.
 
static void stopAll ()
 Stop all threads.
 
static void yieldProcessor (void)
 Yield the processor to another thread.
 
- Static Protected Member Functions inherited from ArThread
static void addThreadToMap (ThreadType pt, ArThread *at)
 
static ArThreadfindThreadInMap (ThreadType t)
 
static void removeThreadFromMap (ThreadType t)
 
- Static Protected Attributes inherited from ArThread
static ArLog::LogLevel ourLogLevel = ArLog::Verbose
 
static MapType ourThreads
 
static ArMutex ourThreadsMutex
 
static std::string ourUnknownThreadName = "unknown"
 

Detailed Description

Interface to LCD interface panel on an MTX-type robot.

This interface can be used to display text strings on the MTX LCD panel. One or more ArLCDMTX objects are automatically created by ArRobotConnector (or ArLCDConnector if used separately from ArRobotConnector) if connecting to an MTX robot, and a successful connection to the LCD panel was also made. A pointer to the first ArLCDMTX object can be obtained via ArRobot::findLCD(), passing an index of 1.

Since
2.8.0
Examples:
mtxLCDDisplay.cpp.

Member Function Documentation

◆ checkLostConnection()

bool ArLCDMTX::checkLostConnection ( void  )

check for lost connections

This will check if the lcd has lost connection.

If there is no robot it is a straightforward check of last reading time against getConnectionTimeoutSeconds. If there is a robot then it will not start the check until the lcd is running and connected.

◆ setMTXLCDMainScreenText()

bool ArLCDMTX::setMTXLCDMainScreenText ( const char *  status)

exposed routines to set the various screen status(s) text size is limited to 247 characters...

supports new lines (it can show up to 6 lines, with roughly 22-26 chars per line)

◆ setRobot()

void ArLCDMTX::setRobot ( ArRobot robot)
virtual

Sets the robot pointer, also attaches its process function to the robot as a Sensor Interpretation task.


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