moccos mizuki / ATP3011F4

Description: for testing ATP3011F4

Embed: (wiki syntax)

« Back to documentation index

ATP3011F4UART Class Reference

ATP3011F4UART Class Reference

Control ATP3011F4 through UART. More...

#include <ATP3011F4UART.h>

Inherits ATP3011F4.

Public Member Functions

virtual bool init ()
 Initialize connection.
virtual bool send (const char *str)
 Send string.
virtual bool sendr (const char *str)
 Send string with ''.
virtual void waitCompletion ()
 Wait until finishing talk.
void putc (const char c)
 Puts one character.
const char * getReturnCodePtr ()
 Gets previous error code.
int getErrorCode ()
 Send chime J.
void chimeJ ()
 Send chime J.
void chimeK ()
 Send chime K.
void version ()
 Ask version.
void sendBreak ()
 Send break.
bool sendNumPlain (int val)
 send <NUM val="val">
bool sendNumPlain (const char *val)
 send <NUM val="val">
bool sendNum (const char *val, const char *counter=NULL)
 Send <NUMK val="val" counter="counter"> If counter is null, send <NUMK val="val">
bool sendNum (int val, const char *counter=NULL)
 Send <NUMK val="val" counter="counter"> If counter is null, send <NUMK val="val">
bool sendAlpha (const char *val)
 send <ALPHA val="val">

Detailed Description

Control ATP3011F4 through UART.

Author:
moccos <tt.izawa, gmail> Example:
 int main() {
     Serial ch(p9, p10);
     Serial pc(USBTX, USBRX);
     char cmd;
 
     ATP3011F4UART aq(&ch);
     aq.init();
     aq.waitCompletion();
 
     while (1) {
         if (pc.readable()) {
             cmd = pc.getc();
             if (cmd == '\r' || cmd == '\n') {
                 cmd = '\r';
             }
             // pc.putc(cmd);  // echo back
             aq.putc(cmd);
             if (cmd == '\r') {
                 aq.waitCompletion();
                 aq.chimeJ();
                 aq.waitCompletion();
             }
         }
     }
 }

Definition at line 37 of file ATP3011F4UART.h.


Member Function Documentation

void chimeJ (  ) [inherited]

Send chime J.

Definition at line 40 of file ATP3011F4.h.

void chimeK (  ) [inherited]

Send chime K.

Definition at line 43 of file ATP3011F4.h.

int getErrorCode (  ) [inherited]

Send chime J.

Definition at line 5 of file ATP3011F4.cpp.

const char* getReturnCodePtr (  ) [inherited]

Gets previous error code.

Return values:
-1if previous response is not error code.
Returns:
error code

Definition at line 34 of file ATP3011F4.h.

bool init (  ) [virtual]

Initialize connection.

Implements ATP3011F4.

Definition at line 8 of file ATP3011F4UART.cpp.

void putc ( const char  c )

Puts one character.

Definition at line 47 of file ATP3011F4UART.h.

bool send ( const char *  str ) [virtual]

Send string.

Implements ATP3011F4.

Definition at line 16 of file ATP3011F4UART.cpp.

bool sendAlpha ( const char *  val ) [inherited]

send <ALPHA val="val">

Definition at line 46 of file ATP3011F4.cpp.

void sendBreak (  ) [inherited]

Send break.

Definition at line 10 of file ATP3011F4.cpp.

bool sendNum ( int  val,
const char *  counter = NULL 
) [inherited]

Send <NUMK val="val" counter="counter"> If counter is null, send <NUMK val="val">

Definition at line 29 of file ATP3011F4.cpp.

bool sendNum ( const char *  val,
const char *  counter = NULL 
) [inherited]

Send <NUMK val="val" counter="counter"> If counter is null, send <NUMK val="val">

Definition at line 35 of file ATP3011F4.cpp.

bool sendNumPlain ( int  val ) [inherited]

send <NUM val="val">

Definition at line 15 of file ATP3011F4.cpp.

bool sendNumPlain ( const char *  val ) [inherited]

send <NUM val="val">

Definition at line 21 of file ATP3011F4.cpp.

bool sendr ( const char *  str ) [virtual]

Send string with ''.

Implements ATP3011F4.

Definition at line 21 of file ATP3011F4UART.cpp.

void version (  ) [inherited]

Ask version.

Definition at line 46 of file ATP3011F4.h.

void waitCompletion (  ) [virtual]

Wait until finishing talk.

Implements ATP3011F4.

Definition at line 30 of file ATP3011F4UART.cpp.