COSA
An Object-Oriented Platform for Arduino Programming
Ciao Class Reference

#include <Ciao.hh>

Inheritance diagram for Ciao:
Inheritance graph
Collaboration diagram for Ciao:
Collaboration graph

Classes

class  Descriptor
 
struct  header_t
 

Public Types

enum  {
  MASK_ATTR = 0x0f, COUNT0_ATTR = 0x00, COUNT4_MASK = 0x07, COUNT8_ATTR = 0x08,
  COUNT16_ATTR = 0x09, END_SEQUENCE_ATTR = 0x0f
}
 
enum  {
  MASK_TYPE = 0xf0, UINT8_TYPE = 0x00, UINT16_TYPE = 0x10, UINT32_TYPE = 0x20,
  UINT64_TYPE = 0x30, USER8_DESC_START = 0x40, USER8_DESC_END = USER8_DESC_START | END_SEQUENCE_ATTR, USER16_DESC_START = 0x50,
  USER16_DESC_END = USER16_DESC_START | END_SEQUENCE_ATTR, USER8_TYPE = 0x60, USER16_TYPE = 0x70, INT8_TYPE = 0x80,
  INT16_TYPE = 0x90, INT32_TYPE = 0xa0, INT64_TYPE = 0xb0, FLOAT16_TYPE = 0xc0,
  FLOAT32_TYPE = 0xd0, FLOAT64_TYPE = 0xe0, FLOAT80_TYPE = 0xf0
}
 
enum  { LITTLE_ENDIAN = 0, BIG_ENDIAN = 1 }
 

Public Member Functions

 Ciao (IOStream::Device *dev=NULL)
 
void set (IOStream::Device *dev)
 
void begin ()
 
void write (char *s)
 
void write (str_P s)
 
void write (uint8_t value)
 
void write (uint8_t *buf, uint16_t count)
 
void write (uint16_t value)
 
void write (uint16_t *buf, uint16_t count)
 
void write (uint32_t value)
 
void write (uint32_t *buf, uint16_t count)
 
void write (uint64_t value)
 
void write (uint64_t *buf, uint16_t count)
 
void write (int8_t value)
 
void write (int8_t *buf, uint16_t count)
 
void write (int16_t value)
 
void write (int16_t *buf, uint16_t count)
 
void write (int32_t value)
 
void write (int32_t *buf, uint16_t count)
 
void write (int64_t value)
 
void write (int64_t *buf, uint16_t count)
 
void write (float value)
 
void write (float *buf, uint16_t count)
 
void write (const Descriptor::user_t *desc)
 
void write (const Descriptor::user_t *desc, void *buf, uint16_t count)
 

Protected Member Functions

void write (uint8_t type, uint16_t count)
 

Protected Attributes

IOStream::Devicem_dev
 

Detailed Description

The Cosa Ciao data stream handler. Please see CIAO.txt for details.

Limitations

The Ciao class handles only output. The data types 16, 64 and 80-bit floating point are not supported.

Also

Requires an IOSteam::Device. This is used in binary/8-bit character mode. See also Cosa/Fai.hh for details on board state reporting.

References

[1] Sun Microsystems (1987). "XDR: External Data Representation Standard". RFC 1014. Network Working Group. Retrieved July 11,

  1. http://tools.ietf.org/html/rfc1014
    [2] Boost Serialization, http://www.boost.org/doc/libs/1_46_1/libs/serialization/doc/index.html
    [3] Java Stream Format, http://docs.oracle.com/javase/7/docs/platform/serialization/spec/protocol.html#10258
    [4] Arduino/Firmata, http://www.firmata.org

Definition at line 47 of file Ciao.hh.

Member Enumeration Documentation

anonymous enum

Tag attribute: Number for data values in sequence[count]. User defined data type name as value or end of used defined data type sequence.

Enumerator
MASK_ATTR 
COUNT0_ATTR 
COUNT4_MASK 
COUNT8_ATTR 
COUNT16_ATTR 
END_SEQUENCE_ATTR 

Definition at line 54 of file Ciao.hh.

anonymous enum

Data type tag: Predefined data types and tags for extension. NB: Arduino/AVR does not implement FLOAT16/64/80.

Enumerator
MASK_TYPE 
UINT8_TYPE 
UINT16_TYPE 
UINT32_TYPE 
UINT64_TYPE 
USER8_DESC_START 
USER8_DESC_END 
USER16_DESC_START 
USER16_DESC_END 
USER8_TYPE 
USER16_TYPE 
INT8_TYPE 
INT16_TYPE 
INT32_TYPE 
INT64_TYPE 
FLOAT16_TYPE 
FLOAT32_TYPE 
FLOAT64_TYPE 
FLOAT80_TYPE 

Definition at line 67 of file Ciao.hh.

anonymous enum
Enumerator
LITTLE_ENDIAN 
BIG_ENDIAN 

Definition at line 128 of file Ciao.hh.

Constructor & Destructor Documentation

Ciao::Ciao ( IOStream::Device dev = NULL)
inline

Construct data streaming for given device.

Parameters
[in]devoutput device.

Definition at line 138 of file Ciao.hh.

Member Function Documentation

void Ciao::begin ( )

Start the data stream with a version string and endian information.

Definition at line 76 of file Ciao.cpp.

void Ciao::set ( IOStream::Device dev)
inline

Set io-stream device.

Parameters
[in]devstream device.

Definition at line 144 of file Ciao.hh.

void Ciao::write ( char *  s)

Write given string to data stream.

Parameters
[in]sstring to write

Definition at line 87 of file Ciao.cpp.

void Ciao::write ( str_P  s)

Write given string from program memory to data stream.

Parameters
[in]sprogram memory string to write

Definition at line 95 of file Ciao.cpp.

void Ciao::write ( uint8_t  value)

Write given unsigned 8-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 103 of file Ciao.cpp.

void Ciao::write ( uint8_t *  buf,
uint16_t  count 
)

Write given unsigned 8-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 110 of file Ciao.cpp.

void Ciao::write ( uint16_t  value)

Write given unsigned 16-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 117 of file Ciao.cpp.

void Ciao::write ( uint16_t *  buf,
uint16_t  count 
)

Write given unsigned 16-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 124 of file Ciao.cpp.

void Ciao::write ( uint32_t  value)

Write given unsigned 32-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 131 of file Ciao.cpp.

void Ciao::write ( uint32_t *  buf,
uint16_t  count 
)

Write given unsigned 32-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 138 of file Ciao.cpp.

void Ciao::write ( uint64_t  value)

Write given unsigned 64-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 145 of file Ciao.cpp.

void Ciao::write ( uint64_t *  buf,
uint16_t  count 
)

Write given unsigned 64-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 152 of file Ciao.cpp.

void Ciao::write ( int8_t  value)

Write given signed 8-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 159 of file Ciao.cpp.

void Ciao::write ( int8_t *  buf,
uint16_t  count 
)

Write given signed 8-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 166 of file Ciao.cpp.

void Ciao::write ( int16_t  value)

Write given signed 16-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 173 of file Ciao.cpp.

void Ciao::write ( int16_t *  buf,
uint16_t  count 
)

Write given signed 16-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 179 of file Ciao.cpp.

void Ciao::write ( int32_t  value)

Write given signed 32-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 186 of file Ciao.cpp.

void Ciao::write ( int32_t *  buf,
uint16_t  count 
)

Write given signed 32-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 193 of file Ciao.cpp.

void Ciao::write ( int64_t  value)

Write given signed 64-bit integer to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 200 of file Ciao.cpp.

void Ciao::write ( int64_t *  buf,
uint16_t  count 
)

Write given signed 64-bit integer vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 207 of file Ciao.cpp.

void Ciao::write ( float  value)

Write given 32-bit floating point to data stream.

Parameters
[in]valueto write to data stream.

Definition at line 214 of file Ciao.cpp.

void Ciao::write ( float *  buf,
uint16_t  count 
)

Write given 32-bit floating vector to data stream.

Parameters
[in]bufpointer to integer vector.
[in]countsize of vector.

Definition at line 221 of file Ciao.cpp.

void Ciao::write ( const Descriptor::user_t desc)

Write given user defined data type descriptor to data stream.

Parameters
[in]descdescriptor structure to write (progam memory).

Definition at line 250 of file Ciao.cpp.

void Ciao::write ( const Descriptor::user_t desc,
void *  buf,
uint16_t  count 
)

Write given user defined data type value to data stream.

Parameters
[in]descuser defined data type (program memory).
[in]bufpointer to value(s) to write.
[in]countsize of sequence to write.

Definition at line 304 of file Ciao.cpp.

void Ciao::write ( uint8_t  type,
uint16_t  count 
)
protected

Write data tag to given stream.

Parameters
[in]typedata type tag.
[in]countnumber of elements in sequence.

Definition at line 228 of file Ciao.cpp.

Member Data Documentation

IOStream::Device* Ciao::m_dev
protected

Definition at line 307 of file Ciao.hh.


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