| |
libFAUDES
Sections
Index
|
faudes::nDevice Class Reference |
Command on tcp server port | Reply |
<Cmd> "Info" </Cmd> | Configuration of node as token string |
<Cmd> "Status" </Cmd> | Up/StartUop/Down/ShutDown |
<Subscribe> "ev1" ... "evN" </Subscribe> | Positive Acknowledge to accept subscription of events |
Broadcast on simplenet udp port | Reply |
<Request> "network" </Request> | Advertisement of networkname, nodename and ip-address:port |
<SimplenetDevice> "simplemachine" % node id 1000 % time scale (ms/ftu) "localhost:40000" % server tcp port "simpleloop" % network id <Network> "simplemachine" % other nodes .., "simplesupervisor" % ... in this network </Network> <SimplenetEvents> "alpha" <Input></Input> "beta" <Output></Output> "mue" <Output></Output> "lambda" <Input></Input> </SimplenetEvents> </SimplenetDevice>
Definition at line 409 of file iop_simplenet.h.
Public Member Functions | |
nDevice (void) | |
Default constructor. | |
virtual | ~nDevice (void) |
Explicit destructor. | |
virtual void | Clear (void) |
Clear all configuration. | |
virtual void | Compile (void) |
Set up internal data structures. | |
void | InsertNodeAddress (const std::string &rNode, const SimplenetAddress &rAddress) |
Add entry to node name resolution. | |
virtual void | Start (void) |
Activate the device. | |
virtual void | Stop (void) |
Deactivate the device. | |
virtual void | Reset (void) |
Reset device. | |
virtual void | WriteActuator (Idx actuator) |
Run actuator command. | |
Protected Member Functions | |
virtual void | DoReadPreface (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Actual method to read device configuration from tokenreader. | |
virtual void | DoWritePreface (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Actual method to write the device configuration to a TokenWriter. | |
Protected Attributes | |
TaNameSet < AttributeSimplenetEvent > * | pConfiguration |
Overall configuration (with actual type). | |
std::string | mNetwork |
Simplenet: network id. | |
SimplenetAddress | mAddress |
Simplenet: address of my server port. | |
SimplenetAddress | mEffectiveAddress |
Simplenet: effective address of my server port. | |
std::set< std::string > | mNetworkNodes |
Simplenet: list of nodes in this network. | |
std::set< std::string > | mSensorServers |
Simplenet: list of event server addresses. | |
std::map< std::string, EventSet > | mSensorSubscriptions |
Compiled data: map subscriptions. | |
pthread_mutex_t | mMutex |
Background: mutex for below shared variables. | |
pthread_t | mThreadListen |
Background: thread handle (global). | |
bool | mStopListen |
Background: request to join via flag (mutexed). | |
int | mServerSocket |
Background: server socket to listen (background only). | |
struct sockaddr_in | mServerAddress |
Background: server port to bind (background only). | |
int | mBroadcastSocket |
Background: udp broadcast socket (background only). | |
std::map< int, ClientState > | mActuatorClientStates |
Background: map sockets to connection states (shared). | |
std::map< std::string, ServerState > | mSensorServerStates |
Background: connection states to event servers (by node name). | |
Friends | |
void * | NDeviceListen (void *) |
void * | NDeviceServer (void *) |
void * | NDeviceReply (void *) |
Classes | |
struct | ClientState |
Background: state of a connection to a client (shared). More... | |
struct | ServerState |
Background: state of a connection to an event server (shared). More... |
faudes::nDevice::nDevice | ( | void | ) |
faudes::nDevice::~nDevice | ( | void | ) | [virtual] |
void faudes::nDevice::Clear | ( | void | ) | [virtual] |
Clear all configuration.
This implies Stop().
Reimplemented from faudes::vDevice.
Definition at line 297 of file iop_simplenet.cpp.
void faudes::nDevice::Compile | ( | void | ) | [virtual] |
Set up internal data structures.
Reimplemented from faudes::vDevice.
Definition at line 325 of file iop_simplenet.cpp.
void faudes::nDevice::InsertNodeAddress | ( | const std::string & | rNode, | |
const SimplenetAddress & | rAddress | |||
) |
Add entry to node name resolution.
rNode | Name of node to register | |
rAddress | Address incl port |
Definition at line 307 of file iop_simplenet.cpp.
void faudes::nDevice::Start | ( | void | ) | [virtual] |
Activate the device.
This function enables actuator execution and sensor reading. It starts the background thread for incomming connections and tries to connect to relevant servers.
Exception |
|
Reimplemented from faudes::vDevice.
Definition at line 429 of file iop_simplenet.cpp.
void faudes::nDevice::Stop | ( | void | ) | [virtual] |
Deactivate the device.
This function disables actuator execution and sensor reading. It stops the backhround thread to provide connections and disconnects from any servers.
Reimplemented from faudes::vDevice.
Definition at line 530 of file iop_simplenet.cpp.
void faudes::nDevice::Reset | ( | void | ) | [virtual] |
Reset device.
Resets buffered sensor events and current time.
Reimplemented from faudes::vDevice.
Definition at line 1048 of file iop_simplenet.cpp.
void faudes::nDevice::WriteActuator | ( | Idx | actuator | ) | [virtual] |
Run actuator command.
Exception |
|
Implements faudes::vDevice.
Definition at line 385 of file iop_simplenet.cpp.
void faudes::nDevice::DoReadPreface | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [protected, virtual] |
Actual method to read device configuration from tokenreader.
This method calls the base class to read the device name and the the timescale. It then reads address, networkid and nodes. Overall device configuration is consists of DoReadPreface, DoReadConfiguration and Compile. It isimplemented in vDevice. The label and context parameters are ignored.
rTr | TokenReader to read from | |
rLabel | Section to read | |
pContext | Read context to provide contextual information |
Exception |
|
Reimplemented from faudes::vDevice.
Definition at line 350 of file iop_simplenet.cpp.
void faudes::nDevice::DoWritePreface | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Actual method to write the device configuration to a TokenWriter.
This method calls the base class vDevice to write the device name and the time scale. It then writes network related data. The label and context parameters are ignored.
rTw | Reference to TokenWriter | |
rLabel | Label of section to write | |
pContext | Read context to provide contextual information |
Exception |
|
Reimplemented from faudes::vDevice.
Definition at line 334 of file iop_simplenet.cpp.
void* NDeviceListen | ( | void * | ) | [friend] |
Definition at line 565 of file iop_simplenet.cpp.
void* NDeviceServer | ( | void * | ) | [friend] |
void* NDeviceReply | ( | void * | ) | [friend] |
Definition at line 926 of file iop_simplenet.cpp.
TaNameSet<AttributeSimplenetEvent>* faudes::nDevice::pConfiguration [protected] |
std::string faudes::nDevice::mNetwork [protected] |
SimplenetAddress faudes::nDevice::mAddress [protected] |
SimplenetAddress faudes::nDevice::mEffectiveAddress [protected] |
std::set<std::string> faudes::nDevice::mNetworkNodes [protected] |
std::set<std::string> faudes::nDevice::mSensorServers [protected] |
std::map<std::string,EventSet> faudes::nDevice::mSensorSubscriptions [protected] |
pthread_mutex_t faudes::nDevice::mMutex [protected] |
pthread_t faudes::nDevice::mThreadListen [protected] |
bool faudes::nDevice::mStopListen [protected] |
int faudes::nDevice::mServerSocket [protected] |
Background: server socket to listen (background only).
Definition at line 556 of file iop_simplenet.h.
struct sockaddr_in faudes::nDevice::mServerAddress [read, protected] |
int faudes::nDevice::mBroadcastSocket [protected] |
std::map<int, ClientState> faudes::nDevice::mActuatorClientStates [protected] |
Background: map sockets to connection states (shared).
Definition at line 573 of file iop_simplenet.h.
std::map<std::string,ServerState> faudes::nDevice::mSensorServerStates [protected] |
Background: connection states to event servers (by node name).
Definition at line 584 of file iop_simplenet.h.
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6