Structure, that runs simulation for one node in network and contains some info about that node.
More...
|
| NodeSimulator () |
| Constructor.
|
|
| NodeSimulator (Emulator *emulator, int index, MeshMAC nodeMACAddress) |
| Constructor. More...
|
|
| NodeSimulator (Emulator *emulator, int index) |
| Constructor. More...
|
|
| NodeSimulator (const NodeSimulator &)=default |
|
| ~NodeSimulator () |
| Destructor.
|
|
NodeSimulator & | operator= (const NodeSimulator &)=default |
|
MeshNet * | Node () |
| Gets pointer to node, which is simulated by current NodeSimulator.
|
|
Emulator * | getParentPtr () |
| Gets pointer to emulator, which owns this instance.
|
|
int | getIndex () |
| Gets index of node in emulator array of nodes.
|
|
uint64_t | getCyclesCount () |
| Gets count of cycles, that were done in infinity loop, where is MeshNet code executed.
|
|
void | ExecuteCycle () |
| Executes current node's one cycle.
|
|
bool | BeginSimulation (NodeSettings settings_, std::chrono::nanoseconds simulationTimeOffset=std::chrono::nanoseconds::zero()) |
| Turns on simulation for current node. More...
|
|
bool | BeginSimulation (std::chrono::nanoseconds simulationTimeOffset=std::chrono::nanoseconds::zero()) |
| Turns on simulation for current node with old or default settings. More...
|
|
void | EndSimulation () |
| Turns off simulation for current node.
|
|
void | SleepFor (std::chrono::nanoseconds sleepDelay) |
| Makes current node sleep for specified delay. More...
|
|
bool | IsSimulationRunning () |
| Checks if simulation is running for current node. More...
|
|
bool | IsSimulationEnabled () |
| Checks if simulation has been started, but it does not mean it is currently running. More...
|
|
std::chrono::nanoseconds | getSimulationTime () |
| Gets current node simulation time. More...
|
|
std::chrono::nanoseconds | getNodeWorkTime () |
| Gets work time of current node. More...
|
|
std::chrono::nanoseconds | getLastSentTime () |
| Gets simulation time, when last sent occoured. More...
|
|
const std::vector< NeighborNode > & | GetNeighborNodes () |
| Gets reference to vector, which has pointers to all neighbor nodes. This return valid value only when simulation is running.
|
|
NodeSettings | GetSettings () |
| Gets node settings.
|
|
|
bool | IsFree (std::chrono::nanoseconds time) |
| Check if node is not receiving at current simulation time. Use this from inside in simulation. More...
|
|
bool | IsFreeEx (std::chrono::nanoseconds time) |
| Check if node is not receiving at current simulation time. Use this from outside of simulation. More...
|
|
uint8_t | Available () |
| Checks how many bytes are available to receive. More...
|
|
uint16_t | GetLastAvailableBytes () |
| Gets last available bytes in one frame from Available() method.
|
|
bool | Receive (uint8_t *message, uint8_t &messageLength, float &RSSI) |
| Receives message when available. More...
|
|
void | Send (uint8_t *message, uint8_t messageLength) |
| Sends data to the environment. More...
|
|
void | OnScanResponse (const MeshNetScanResult &result) |
| This method is called on every scan response by node. More...
|
|
void | CreateRandomInterference (std::chrono::microseconds interferingDuration) |
|
void | PauseSimulationTimer () |
| Call this if cycle is going to be paused. It stops counting instructions done on current thread.
|
|
void | ResumeSimulationTimer () |
| Call this if cycle is going to be resumed. It restarts counting instructions done on current thread.
|
|
int | CheckForSentMessages () |
| Checks received messages, puts them in FIFO and clears FIFO from interference and overflow messages. More...
|
|
void | ReportInterference (RawMessageDescriptor &msg1, RawMessageDescriptor &msg2, MeshMAC currentNode) |
| Reports Hidden terminal interference of two messages. More...
|
|
void | ReportCollision (RawMessageDescriptor &msg, RawMessage &msg2) |
| Reports half-duplex collision of message, which was received during sending. More...
|
|
void | ReportMessageLost (RawMessageDescriptor &msg, MeshMAC receiverNode) |
| Reports, that sent message was lost due to bad link quality. More...
|
|
void | OnNodeConnected () |
| This method is called when node is connected to new network. More...
|
|
void | OnNodeDisconnected (MeshDisconnectReason reason, MeshMAC oldBSSID, uint8_t oldAddress) |
| This method is called when node is disconnected from any network. More...
|
|
void | OnReceive (MeshPacket &packet) |
| This method is called when node has received data packet. More...
|
|
void | OnPingResp (uint8_t pingID, uint8_t pingAddr, MeshPacketError pingStat, uint8_t hops, uint32_t duration, const uint8_t *testData, int16_t testDataLength) |
| This method is called when ping response is received. More...
|
|
|
static void | OnNodeConnectedStatic (MeshNet *mesh) |
| Static function, which can be used as callback. In this function correct OnNodeConnected() method is called.
|
|
static void | OnNodeDisconnectedStatic (MeshNet *mesh, MeshDisconnectReason reason, MeshMAC oldBSSID, uint8_t oldAddress) |
| Static function, which can be used as callback. In this function correct OnNodeDisconnected() method is called.
|
|
static void | OnReceiveStatic (MeshNet *mesh, MeshPacket &packet) |
| Static function, which can be used as callback. In this function correct OnReceive() method is called.
|
|
static void | OnPingRespStatic (MeshNet *mesh, uint8_t pingID, uint8_t pingAddr, MeshPacketError pingStat, uint8_t hops, uint32_t duration, const uint8_t *testData, int16_t testDataLength) |
| Static function, which can be used as callback. In this function correct OnPingResp() method is called.
|
|
|
NodeSettings | settings |
| Node settings.
|
|
Emulator * | em = NULL |
| Pointer to emulator, which owns this instance.
|
|
int | index = 0 |
| Index of node in emulator array of nodes.
|
|
uint64_t | numberOfCycles = 0 |
| Number of cycles done from start of the simulation.
|
|
std::vector< NeighborNode > | neighborNodes |
| Vector with pointers to all neighbor nodes.
|
|
std::chrono::nanoseconds | FreeFromTime = std::chrono::nanoseconds::zero() |
|
std::chrono::nanoseconds | FreeSenderFromTime = std::chrono::nanoseconds::zero() |
|
std::deque< RawMessageDescriptor > | inputFIFO |
| FIFO, that acts as FIFO on receiver module.
|
|
std::list< RawMessageDescriptor > | receivedMessagesList |
| List of received messages, that was not processed yet.
|
|
uint64_t | lastCycles = 0 |
| Last count of processor cycles, which are used to calculate properly timing of simulation.
|
|
std::chrono::nanoseconds | simulationTime = std::chrono::nanoseconds::zero() |
| Simulation time elapsed in nanoseconds.
|
|
std::chrono::nanoseconds | lastSentTime = std::chrono::nanoseconds::zero() |
| Simulation time, when last message was sent.
|
|
std::chrono::nanoseconds | simulationOffset = std::chrono::nanoseconds::zero() |
| Simulation start offset.
|
|
std::atomic< bool > | CycleLock { true } |
| True when current cycle is locked. Cycle can be executed only when it is unlocked.
|
|
std::condition_variable_any | CycleLockCV |
| Conditional variable for cycle lock.
|
|
bool | simulationStarted = false |
| True if BeginSimulation() was called.
|
|
int | lastAvailableBytes = 0 |
| Count of bytes, that was returned last time by Available() method.
|
|
bool | simulationTimerPaused = true |
| True if current simulation timer is running (ResumeSimulationTimer() was called) and false if simulation timer is not running (PauseSimulationTimer() was called).
|
|
MeshNet * | currentNode = NULL |
| Pointer to speficied node.
|
|
Simulation_RFI * | currentRFI = NULL |
| Pointer to speficied RF interface.
|
|
friend | Emulator |
|
friend | Simulation_RFI |
|
Structure, that runs simulation for one node in network and contains some info about that node.