Upload files to "/"
This commit is contained in:
65
test_handler.h
Normal file
65
test_handler.h
Normal file
@@ -0,0 +1,65 @@
|
||||
// test_handler.h - Hardware Test Handler for CAN FD Logger
|
||||
|
||||
#ifndef TEST_HANDLER_H
|
||||
#define TEST_HANDLER_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "types.h"
|
||||
|
||||
#define TEST_MAX_FRAMES 10000
|
||||
#define TEST_DEFAULT_INTERVAL 1
|
||||
|
||||
enum TestMode {
|
||||
TEST_MODE_IDLE = 0,
|
||||
TEST_MODE_LOOPBACK,
|
||||
TEST_MODE_STRESS,
|
||||
TEST_MODE_SEQUENCE
|
||||
};
|
||||
|
||||
struct TestConfig {
|
||||
TestMode mode;
|
||||
uint32_t frameCount;
|
||||
uint32_t intervalUs;
|
||||
uint32_t canId;
|
||||
uint8_t dataLen;
|
||||
bool useFD;
|
||||
bool running;
|
||||
};
|
||||
|
||||
struct TestResult {
|
||||
uint32_t framesSent;
|
||||
uint32_t framesReceived;
|
||||
uint32_t framesLost;
|
||||
uint32_t errors;
|
||||
uint32_t startTime;
|
||||
uint32_t endTime;
|
||||
uint32_t durationMs;
|
||||
float frameRate;
|
||||
float lossRate;
|
||||
bool passed;
|
||||
};
|
||||
|
||||
extern TestConfig testConfig;
|
||||
extern TestResult testResult;
|
||||
|
||||
void initTestHandler();
|
||||
|
||||
bool startLoopbackTest(uint32_t frameCount, uint32_t intervalUs);
|
||||
bool startStressTest(uint32_t frameCount, uint8_t dataLen, bool useFD);
|
||||
bool startSequenceTest(uint32_t frameCount, uint32_t canId);
|
||||
|
||||
void stopTest();
|
||||
void updateTest();
|
||||
|
||||
bool isTestRunning();
|
||||
TestMode getTestMode();
|
||||
TestResult getTestResult();
|
||||
|
||||
void getTestResultJSON(char* buffer, size_t bufferSize);
|
||||
|
||||
void testTxTask(void *pvParameters);
|
||||
|
||||
uint32_t generateTestFrame(uint32_t sequence, CanFrame& frame);
|
||||
bool validateTestFrame(const CanFrame& frame, uint32_t& expectedSeq);
|
||||
|
||||
#endif // TEST_HANDLER_H
|
||||
Reference in New Issue
Block a user