-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathSimulatorInterface.cpp
More file actions
31 lines (25 loc) · 1.3 KB
/
SimulatorInterface.cpp
File metadata and controls
31 lines (25 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2020 Charles Tytler
#include "SimulatorInterface.h"
#include "Utilities/StringUtilities.h"
SimulatorAddress::SimulatorAddress() : type(AddressType::UNDEFINED) {}
SimulatorAddress::SimulatorAddress(unsigned int address) : type(AddressType::ADDRESS_ONLY), address(address) {}
SimulatorAddress::SimulatorAddress(unsigned int address, unsigned int mask, uint8_t shift)
: type(AddressType::INTEGER), address(address), mask(mask), shift(shift)
{
}
SimulatorAddress::SimulatorAddress(unsigned int address, unsigned int max_length)
: type(AddressType::STRING), address(address), max_length(max_length)
{
}
SimulatorInterface::SimulatorInterface(const SimulatorConnectionSettings &settings)
: simulator_socket_(settings.ip_address, settings.rx_port, settings.tx_port, settings.multicast_address),
connection_settings_(settings)
{
}
bool SimulatorInterface::connection_settings_match(const SimulatorConnectionSettings &settings) const
{
return ((settings.rx_port == connection_settings_.rx_port) && (settings.tx_port == connection_settings_.tx_port) &&
(settings.ip_address == connection_settings_.ip_address) &&
(settings.multicast_address == connection_settings_.multicast_address));
}
std::string SimulatorInterface::get_current_module() const { return current_module_; }