Project fixes and correct MARTe style makefile and source structure
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#include "BasicTCPSocket.h"
|
||||
#include "BasicUDPSocket.h"
|
||||
#include "DebugService.h"
|
||||
#include "DebugCore.h"
|
||||
#include "ObjectRegistryDatabase.h"
|
||||
#include "StandardParser.h"
|
||||
#include "StreamString.h"
|
||||
#include "BasicUDPSocket.h"
|
||||
#include "HighResolutionTimer.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@@ -12,20 +12,22 @@ using namespace MARTe;
|
||||
|
||||
void TestFullTracePipeline() {
|
||||
printf("Starting Full Trace Pipeline Test...\n");
|
||||
printf("sizeof(TraceHeader) = %lu\n", sizeof(TraceHeader));
|
||||
|
||||
ObjectRegistryDatabase::Instance()->Purge();
|
||||
|
||||
// 1. Setup Service
|
||||
DebugService service;
|
||||
ConfigurationDatabase config;
|
||||
config.Write("ControlPort", (uint16)8080);
|
||||
config.Write("StreamPort", (uint16)8081);
|
||||
config.Write("LogPort", (uint16)8082);
|
||||
config.Write("ControlPort", (uint16)8082);
|
||||
config.Write("StreamPort", (uint16)8083);
|
||||
config.Write("LogPort", (uint16)8084);
|
||||
config.Write("StreamIP", "127.0.0.1");
|
||||
assert(service.Initialise(config));
|
||||
Sleep::MSec(500);
|
||||
|
||||
// 2. Register a mock signal
|
||||
uint32 mockValue = 0;
|
||||
DebugSignalInfo* sig = service.RegisterSignal(&mockValue, UnsignedInteger32Bit, "Test.Signal");
|
||||
DebugSignalInfo* sig = service.RegisterSignal(&mockValue, UnsignedInteger32Bit, "TraceTest.Signal");
|
||||
assert(sig != NULL_PTR(DebugSignalInfo*));
|
||||
printf("Signal registered with ID: %u\n", sig->internalID);
|
||||
|
||||
@@ -36,7 +38,7 @@ void TestFullTracePipeline() {
|
||||
// 4. Setup a local UDP listener
|
||||
BasicUDPSocket listener;
|
||||
assert(listener.Open());
|
||||
assert(listener.Listen(8081));
|
||||
assert(listener.Listen(8083));
|
||||
|
||||
// 5. Simulate cycles
|
||||
printf("Simulating cycles...\n");
|
||||
@@ -53,13 +55,7 @@ void TestFullTracePipeline() {
|
||||
TimeoutType timeout(1000); // 1s
|
||||
if (listener.Read(buffer, size, timeout)) {
|
||||
printf("SUCCESS: Received %u bytes over UDP!\n", size);
|
||||
for(uint32 i=0; i<size; i++) {
|
||||
printf("%02X ", (uint8)buffer[i]);
|
||||
if((i+1)%4 == 0) printf("| ");
|
||||
if((i+1)%16 == 0) printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
|
||||
TraceHeader *h = (TraceHeader*)buffer;
|
||||
printf("Header: Magic=0x%X, Count=%u, Seq=%u\n", h->magic, h->count, h->seq);
|
||||
|
||||
@@ -68,7 +64,7 @@ void TestFullTracePipeline() {
|
||||
uint32 recId = *(uint32*)(&buffer[offset]);
|
||||
uint64 recTs = *(uint64*)(&buffer[offset + 4]);
|
||||
uint32 recSize = *(uint32*)(&buffer[offset + 12]);
|
||||
printf("Data: ID=%u, TS=%lu, Size=%u\n", recId, recTs, recSize);
|
||||
printf("Data: ID=%u, TS=%llu, Size=%u\n", recId, (unsigned long long)recTs, recSize);
|
||||
if (size >= offset + 16 + recSize) {
|
||||
if (recSize == 4) {
|
||||
uint32 recVal = *(uint32*)(&buffer[offset + 16]);
|
||||
@@ -82,8 +78,3 @@ void TestFullTracePipeline() {
|
||||
|
||||
listener.Close();
|
||||
}
|
||||
|
||||
int main() {
|
||||
TestFullTracePipeline();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user