Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions inc/iso22133object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ class TestObject {
std::string getLocalIP() const {
return localIP;
}
uint32_t getTransmitterID() const {
std::uint32_t getTransmitterID() const {
return transmitterID;
}
uint32_t getReceiverID() const {
std::uint32_t getReceiverID() const {
return receiverID;
}
ObjectSettingsType getObjectSettings() const {
Expand All @@ -132,7 +132,7 @@ class TestObject {
//! Wrapper for handling tcp messages when using an iso connector for simulation
int handleTCPMessage(char* buffer, int bufferLen);
//! Wrapper for handling udp message when using an iso connector for simulation
int handleUDPMessage(char* buffer, int bufferLen, int udpSocket, char* addr, const uint32_t port);
int handleUDPMessage(char* buffer, int bufferLen, int udpSocket, char* addr, const std::uint32_t port);

//! Used to start the threads
void startHandleTCP() {
Expand Down
10 changes: 5 additions & 5 deletions inc/tcpServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class TcpServer {
public:
TcpServer(std::string ip, uint32_t port) :
TcpServer(std::string ip, std::uint32_t port) :
acceptor(context, boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4::from_string(ip), port)),
socket(context),
acceptIncoming(true) {
Expand Down Expand Up @@ -65,10 +65,10 @@ class TcpServer {
context.restart();
}

void setBufferSize(size_t size) {
void setBufferSize(std::size_t size) {
dataBuffer.resize(size);
}
size_t getBuffferSize() const {
std::size_t getBuffferSize() const {
return dataBuffer.size();
}

Expand Down Expand Up @@ -99,7 +99,7 @@ class TcpServer {
}
}

void send(std::vector<char> data, size_t nbytes) {
void send(std::vector<char> data, std::size_t nbytes) {
std::vector<char> sendBuffer(data);
sendBuffer.resize(nbytes);
socket.async_send(boost::asio::buffer(sendBuffer, nbytes),
Expand All @@ -115,7 +115,7 @@ class TcpServer {

private:
std::vector<char> dataBuffer;
size_t defaultBufferSize = 4096;
std::size_t defaultBufferSize = 4096;
bool acceptIncoming;

boost::asio::io_context context;
Expand Down
8 changes: 4 additions & 4 deletions inc/udpServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class UdpServer {
public:
UdpServer(const std::string& ip, uint32_t port) :
UdpServer(const std::string& ip, std::uint32_t port) :
socket(context, boost::asio::ip::udp::endpoint(boost::asio::ip::address_v4::from_string(ip), port)) {
setBufferSize(defaultBufferSize);
}
Expand All @@ -29,7 +29,7 @@ class UdpServer {
senderEndpoint = ep;
}

void setBufferSize(size_t size) {
void setBufferSize(std::size_t size) {
dataBuffer.resize(size);
}

Expand All @@ -55,7 +55,7 @@ class UdpServer {
}
}

size_t send(std::vector<char> data, size_t nbytes) {
std::size_t send(std::vector<char> data, size_t nbytes) {
try {
std::vector<char> sendBuffer(data);
sendBuffer.resize(nbytes);
Expand All @@ -71,7 +71,7 @@ class UdpServer {

private:
std::vector<char> dataBuffer;
size_t defaultBufferSize = 4096;
std::size_t defaultBufferSize = 4096;

boost::asio::io_context context;
boost::asio::ip::udp::socket socket;
Expand Down
3 changes: 1 addition & 2 deletions src/iso22133object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int TestObject::handleTCPMessage(char* buffer, int bufferLen) {
return num_bytes_handled;
}

int TestObject::handleUDPMessage(char* buffer, int bufferLen, int udpSocket, char* addr, const uint32_t port) {
int TestObject::handleUDPMessage(char* buffer, int bufferLen, int udpSocket, char* addr, const std::uint32_t port) {
if (awaitingFirstHeab) {
boost::asio::ip::udp::endpoint udpEp =
boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(addr), port);
Expand Down Expand Up @@ -431,7 +431,6 @@ void TestObject::handleHEAB(HeabMessageDataType& heab) {
break;
}
ccStatus = heab.controlCenterStatus;
return;
}

std::chrono::milliseconds TestObject::getNetworkDelay() {
Expand Down
9 changes: 3 additions & 6 deletions src/iso22133state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ void ISO22133::State::handleOSEM(TestObject& obj, ObjectSettingsType& osem) {
std::cout << msg.str();

obj.osemSig(osem);
return;
}

/**
Expand All @@ -160,8 +159,8 @@ void ISO22133::State::handleSTRT(TestObject& obj, StartMessageType& strt) {

struct timeval diff;
timersub(&strt.startTime, &currentTime, &diff);
uint32_t diffmySec = diff.tv_sec * 1e6 + diff.tv_usec;
int diffint = diff.tv_sec * 1e6 + diff.tv_usec;
std::uint32_t diffmySec = diff.tv_sec * 1e6 + diff.tv_usec;
int diffint = diff.tv_sec * 1e6 + diff.tv_usec;

// Start time already passed. Request abort from Control Center
// resolution is 0,25ms (250 microseconds) in ISO spec.
Expand All @@ -187,12 +186,10 @@ void ISO22133::State::handleSTRT(TestObject& obj, StartMessageType& strt) {
ss << "Current time: " << currentTime.tv_sec << " seconds, " << currentTime.tv_usec << " mySecs." << std::endl;
ss << "Estimated network delay: " << obj.getNetworkDelay().count() << " mySecs." << std::endl;
std::cout << ss.str();
uint8_t error = 0;
std::uint8_t error = 0;
error |= 1 << 7; // Abort request is MSB of error mask
obj.setErrorState(error);
return;
}
return;
}

/**
Expand Down