diff --git a/inc/iso22133object.hpp b/inc/iso22133object.hpp index 31d0f87..d683e9c 100644 --- a/inc/iso22133object.hpp +++ b/inc/iso22133object.hpp @@ -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 { @@ -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() { diff --git a/inc/tcpServer.hpp b/inc/tcpServer.hpp index 173d60a..c90ad6f 100644 --- a/inc/tcpServer.hpp +++ b/inc/tcpServer.hpp @@ -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) { @@ -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(); } @@ -99,7 +99,7 @@ class TcpServer { } } - void send(std::vector data, size_t nbytes) { + void send(std::vector data, std::size_t nbytes) { std::vector sendBuffer(data); sendBuffer.resize(nbytes); socket.async_send(boost::asio::buffer(sendBuffer, nbytes), @@ -115,7 +115,7 @@ class TcpServer { private: std::vector dataBuffer; - size_t defaultBufferSize = 4096; + std::size_t defaultBufferSize = 4096; bool acceptIncoming; boost::asio::io_context context; diff --git a/inc/udpServer.hpp b/inc/udpServer.hpp index a9e4812..77e7db1 100644 --- a/inc/udpServer.hpp +++ b/inc/udpServer.hpp @@ -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); } @@ -29,7 +29,7 @@ class UdpServer { senderEndpoint = ep; } - void setBufferSize(size_t size) { + void setBufferSize(std::size_t size) { dataBuffer.resize(size); } @@ -55,7 +55,7 @@ class UdpServer { } } - size_t send(std::vector data, size_t nbytes) { + std::size_t send(std::vector data, size_t nbytes) { try { std::vector sendBuffer(data); sendBuffer.resize(nbytes); @@ -71,7 +71,7 @@ class UdpServer { private: std::vector dataBuffer; - size_t defaultBufferSize = 4096; + std::size_t defaultBufferSize = 4096; boost::asio::io_context context; boost::asio::ip::udp::socket socket; diff --git a/src/iso22133object.cpp b/src/iso22133object.cpp index 94c5e9b..2a0dafb 100644 --- a/src/iso22133object.cpp +++ b/src/iso22133object.cpp @@ -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); @@ -431,7 +431,6 @@ void TestObject::handleHEAB(HeabMessageDataType& heab) { break; } ccStatus = heab.controlCenterStatus; - return; } std::chrono::milliseconds TestObject::getNetworkDelay() { diff --git a/src/iso22133state.cpp b/src/iso22133state.cpp index 986e9d0..7bbe5a4 100644 --- a/src/iso22133state.cpp +++ b/src/iso22133state.cpp @@ -133,7 +133,6 @@ void ISO22133::State::handleOSEM(TestObject& obj, ObjectSettingsType& osem) { std::cout << msg.str(); obj.osemSig(osem); - return; } /** @@ -160,8 +159,8 @@ void ISO22133::State::handleSTRT(TestObject& obj, StartMessageType& strt) { struct timeval diff; timersub(&strt.startTime, ¤tTime, &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. @@ -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; } /**