Arduino  1.8.10
MailboxClass クラス

#include <Mailbox.h>

公開メンバ関数

 MailboxClass (BridgeClass &b=Bridge)
 
void begin ()
 
void end ()
 
unsigned int readMessage (uint8_t *buffer, unsigned int size)
 
void readMessage (String &str, unsigned int maxLength=128)
 
void writeMessage (const uint8_t *buffer, unsigned int size)
 
void writeMessage (const String &str)
 
void writeJSON (const String &str)
 
unsigned int messageAvailable ()
 

詳解

Mailbox.h24 行目に定義があります。

構築子と解体子

◆ MailboxClass()

MailboxClass::MailboxClass ( BridgeClass b = Bridge)
inline

Mailbox.h26 行目に定義があります。

26 : bridge(b) { }

関数詳解

◆ begin()

void MailboxClass::begin ( void  )
inline

Mailbox.h28 行目に定義があります。

28 { }

◆ end()

void MailboxClass::end ( void  )
inline

Mailbox.h29 行目に定義があります。

29 { }

◆ messageAvailable()

unsigned int MailboxClass::messageAvailable ( )

Mailbox.cpp49 行目に定義があります。

49  {
50  uint8_t tmp[] = {'n'};
51  uint8_t res[2];
52  bridge.transfer(tmp, 1, res, 2);
53  return (res[0] << 8) + res[1];
54 }
uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, const uint8_t *buff3, uint16_t len3, uint8_t *rxbuff, uint16_t rxlen)
Definition: Bridge.cpp:168

◆ readMessage() [1/2]

unsigned int MailboxClass::readMessage ( uint8_t *  buffer,
unsigned int  size 
)

Mailbox.cpp21 行目に定義があります。

21  {
22  uint8_t tmp[] = { 'm' };
23  return bridge.transfer(tmp, 1, buff, size);
24 }
#define buff
uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, const uint8_t *buff3, uint16_t len3, uint8_t *rxbuff, uint16_t rxlen)
Definition: Bridge.cpp:168

◆ readMessage() [2/2]

void MailboxClass::readMessage ( String &  str,
unsigned int  maxLength = 128 
)

Mailbox.cpp26 行目に定義があります。

26  {
27  uint8_t tmp[] = { 'm' };
28  // XXX: Is there a better way to create the string?
29  uint8_t buff[maxLength + 1];
30  int l = bridge.transfer(tmp, 1, buff, maxLength);
31  buff[l] = 0;
32  str = (const char *)buff;
33 }
const char * str
Definition: console.c:41
#define buff
uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, const uint8_t *buff3, uint16_t len3, uint8_t *rxbuff, uint16_t rxlen)
Definition: Bridge.cpp:168

◆ writeJSON()

void MailboxClass::writeJSON ( const String &  str)

Mailbox.cpp44 行目に定義があります。

44  {
45  uint8_t cmd[] = {'J'};
46  bridge.transfer(cmd, 1, (uint8_t*) str.c_str(), str.length(), NULL, 0);
47 }
const char * str
Definition: console.c:41
#define NULL
Definition: def.h:44
uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, const uint8_t *buff3, uint16_t len3, uint8_t *rxbuff, uint16_t rxlen)
Definition: Bridge.cpp:168

◆ writeMessage() [1/2]

void MailboxClass::writeMessage ( const uint8_t *  buffer,
unsigned int  size 
)

Mailbox.cpp35 行目に定義があります。

35  {
36  uint8_t cmd[] = {'M'};
37  bridge.transfer(cmd, 1, buff, size, NULL, 0);
38 }
#define buff
#define NULL
Definition: def.h:44
uint16_t transfer(const uint8_t *buff1, uint16_t len1, const uint8_t *buff2, uint16_t len2, const uint8_t *buff3, uint16_t len3, uint8_t *rxbuff, uint16_t rxlen)
Definition: Bridge.cpp:168

◆ writeMessage() [2/2]

void MailboxClass::writeMessage ( const String &  str)

Mailbox.cpp40 行目に定義があります。

40  {
41  writeMessage((uint8_t*) str.c_str(), str.length());
42 }
const char * str
Definition: console.c:41
void writeMessage(const uint8_t *buffer, unsigned int size)
Definition: Mailbox.cpp:35

このクラス詳解は次のファイルから抽出されました: