Files
scandocs/uni/masterarbeit/source/moversight/simutils/wirelessConnectivityObserver/WirelessConnectivityObserver.h
2014-06-30 13:58:10 +02:00

124 lines
4.2 KiB
C++

//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
/*
* File: WirelessConnectivityObserver.cc
* Author: thandreg
* Author: jgaebler
*
* Created on October 16, 2012, 1:30 PM
*/
#ifndef WIRELESSCONNECTIVITYOBSERVER_H_
#define WIRELESSCONNECTIVITYOBSERVER_H_
#include "Node.h"
//omnet and inet includes
#include <omnetpp.h>
#include "INETDefs.h"
#include "base/INotifiable.h"
#include "linklayer/contract/MACAddress.h"
#include "networklayer/autorouting/ipv4/FlatNetworkConfigurator.h"
#include "world/radio/IChannelControl.h"
namespace ubeeme {
namespace moversight {
class WirelessConnectivityObserver : public INotifiable, public FlatNetworkConfigurator {
protected:
/*
* @brief Configures IPv4 addresses and routing tables for a "flat" network
* and initialize wirelessConnectivityObserver, means register for Notificationboard, initialize Nodelist of wireless hosts,
* @param stage stage of Initialization
*/
virtual void initialize(int stage);
/*
* @brief gets only self messages to update in an interval sets in ini-file
* updates positions, distances to other nodes and time calculation of nodes in node-list
* @param msg self message
*/
void handleMessage(cMessage *msg);
/*
* @brief reads transmission Power from ini, starts after initialization to avoid error
*/
void initalizeNodes();
/*
* @brief calculates the range of a Node for a faultless communication
* @param NodesIndex the number of the editing Node in NodeList to simplify access
* @param transmissionPower Power for transmisson, set in ini
*/
double calcDistFreeSpace(size_t nodesIndex, double transmissionPower);
/*
* @brief updates the current Position and Speed of wireless Node
* @param i number of editing Node in nodeList to simplify access
*/
void updatePositons(size_t i);
/*
* @brief updates Distance to relative nodes
* @param i number of editing node in nodeList to simplify access
*/
void updateDistance(size_t i);
/*
* @brief notes which Node has a established connection to another, also
* calculate the time it will probably be even more connected, based on the coordinates and speed
* @param nodeNum number of editing Node in nodeList to simplify access
*/
void timeLeft(size_t nodeNum);
/**
* @brief receive Notification from notificationBoard
* @param category to identifiy the matter of changed Notification
* @param details obtains information about the owner of notification
*/
void receiveChangeNotification(int category, const cPolymorphic *details);
/**
* @brief adds/delete Routes to routing tables
* @param i number of editing Node in nodeList to simplify access
*/
void addRoute(size_t nodeNum);
private:
IChannelControl* cc; // Pointer to the ChannelControl module
cPar& getChannelControlPar(const char *parName);
static IChannelControl *getChannelControl();
std::vector<Node> nodeList;
NodeInfoVector nodeInfo;
cMessage * selfTrigger;
double updateFrequency;
int modulNumber;
cTopology topo;
};
}
}
#endif