remove bsp specific code
This commit is contained in:
parent
eb03bf52a6
commit
282704e0fd
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <cinttypes>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -16,8 +16,6 @@
|
|||||||
// to be implemented by bsp
|
// to be implemented by bsp
|
||||||
extern "C" void printChar(const char*, bool errStream);
|
extern "C" void printChar(const char*, bool errStream);
|
||||||
|
|
||||||
#ifndef UT699
|
|
||||||
|
|
||||||
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage, bool addCrToPreamble,
|
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage, bool addCrToPreamble,
|
||||||
bool buffered, bool errStream, uint16_t port)
|
bool buffered, bool errStream, uint16_t port)
|
||||||
: isActive(true),
|
: isActive(true),
|
||||||
@ -168,90 +166,3 @@ void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) {
|
|||||||
this->colorPrefix = colorPrefix;
|
this->colorPrefix = colorPrefix;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UT699
|
|
||||||
#include "../osal/rtems/Interrupt.h"
|
|
||||||
|
|
||||||
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string set_message, uint16_t port) {
|
|
||||||
this->log_message = set_message;
|
|
||||||
this->isActive = true;
|
|
||||||
setp(buf, buf + BUF_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
|
|
||||||
char array[BUF_SIZE];
|
|
||||||
uint32_t length = end - begin;
|
|
||||||
if (length > sizeof(array)) {
|
|
||||||
length = sizeof(array);
|
|
||||||
}
|
|
||||||
memcpy(array, begin, length);
|
|
||||||
|
|
||||||
if (!Interrupt::isInterruptInProgress()) {
|
|
||||||
std::cout << array;
|
|
||||||
} else {
|
|
||||||
// Uncomment the following line if you need ISR debug output.
|
|
||||||
// printk(array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // UT699
|
|
||||||
|
|
||||||
#ifdef ML505
|
|
||||||
#include <bsp_flp/network/networkconfig.h>
|
|
||||||
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string set_message, uint16_t port)
|
|
||||||
: isActive(true),
|
|
||||||
log_message(set_message),
|
|
||||||
udpSocket(0),
|
|
||||||
remoteAddressLength(sizeof(remoteAddress)) {
|
|
||||||
setp(buf, buf + BUF_SIZE);
|
|
||||||
memset((uint8_t*)&remoteAddress, 0, sizeof(remoteAddress));
|
|
||||||
remoteAddress.sin_family = AF_INET;
|
|
||||||
remoteAddress.sin_port = htons(port);
|
|
||||||
remoteAddress.sin_addr.s_addr = htonl(inet_addr("192.168.250.100"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
|
|
||||||
char array[BUF_SIZE];
|
|
||||||
uint32_t length = end - begin;
|
|
||||||
if (length > sizeof(array)) {
|
|
||||||
length = sizeof(array);
|
|
||||||
}
|
|
||||||
memcpy(array, begin, length);
|
|
||||||
|
|
||||||
if (udpSocket <= 0) {
|
|
||||||
initSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (udpSocket > 0) {
|
|
||||||
sendto(udpSocket, array, length, 0, (sockaddr*)&remoteAddress, sizeof(remoteAddress));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceInterfaceBuffer::initSocket() {
|
|
||||||
sockaddr_in address;
|
|
||||||
memset((uint8_t*)&address, 0, sizeof(address));
|
|
||||||
address.sin_family = AF_INET;
|
|
||||||
address.sin_port = htons(0);
|
|
||||||
address.sin_addr.s_addr = htonl(INADDR_ANY);
|
|
||||||
|
|
||||||
udpSocket = socket(PF_INET, SOCK_DGRAM, 0);
|
|
||||||
if (socket < 0) {
|
|
||||||
printf("Error opening socket!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
timeval timeout = {0, 20};
|
|
||||||
if (setsockopt(udpSocket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0) {
|
|
||||||
printf("Error setting SO_RCVTIMEO socket options!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (setsockopt(udpSocket, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) < 0) {
|
|
||||||
printf("Error setting SO_SNDTIMEO socket options!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (bind(udpSocket, (sockaddr*)&address, sizeof(address)) < 0) {
|
|
||||||
printf("Error binding socket!\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ML505
|
|
||||||
|
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user