9c10a1c3b0
- Added WifiStatusSnapshot struct to track connection status, SSID, IP, and RSSI. - Introduced methods in WifiManager for connecting, reconnecting, and JSON serialization of status and scan results. - Implemented WifiCredentialsStorage for saving and loading WiFi credentials. refactor: Consolidate DTMF tests into main test file - Moved DTMF tests from test_dtmf.cpp to test_main.cpp for better organization. - Removed redundant setup and loop functions from test_dtmf.cpp. docs: Create comprehensive documentation structure - Added README.md for project documentation, detailing agent roles, architecture plans, QA procedures, and reports. - Established a changelog for tracking major changes. feat: Implement A252ConfigStore for configuration management - Created A252ConfigStore class for managing pin, audio, and MQTT configurations. - Added validation methods for configuration integrity. feat: Introduce CommandDispatcher for command handling - Developed CommandDispatcher class to register and dispatch commands with response handling. - Added normalization and help text generation for commands. feat: Implement Es8388Driver for audio codec control - Created Es8388Driver class for managing ES8388 audio codec operations including volume, mute, and routing. chore: Organize test files and remove obsolete tests - Moved audio codec tests to a dedicated test file. - Cleaned up unused test files and consolidated test cases. style: Improve code formatting and comments across the project - Enhanced code readability with consistent formatting and added comments for clarity.
60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
|
|
|
|
#include <unity.h>
|
|
#include "../src/AudioCodec.h"
|
|
#include "telephony/DtmfDecoder.h"
|
|
#include "props/PropsBridge.h"
|
|
|
|
// --- AudioCodec tests ---
|
|
void test_init() {
|
|
GenericCodec codec;
|
|
TEST_ASSERT_TRUE(codec.init());
|
|
}
|
|
void test_volume() {
|
|
GenericCodec codec;
|
|
TEST_ASSERT_TRUE(codec.setVolume(42));
|
|
}
|
|
void test_mute() {
|
|
GenericCodec codec;
|
|
TEST_ASSERT_TRUE(codec.mute(true));
|
|
TEST_ASSERT_TRUE(codec.mute(false));
|
|
}
|
|
void test_route() {
|
|
GenericCodec codec;
|
|
TEST_ASSERT_TRUE(codec.setRoute(ROUTE_RTC));
|
|
TEST_ASSERT_TRUE(codec.setRoute(ROUTE_BLUETOOTH));
|
|
TEST_ASSERT_TRUE(codec.setRoute(ROUTE_NONE));
|
|
}
|
|
|
|
// --- DTMF tests ---
|
|
void test_dtmf_no_digit_on_silence() {
|
|
DtmfDecoder decoder;
|
|
bool called = false;
|
|
decoder.setDigitCallback([&](char d){ called = true; });
|
|
int16_t silence[160] = {0};
|
|
decoder.feedAudioSamples(silence, 160);
|
|
TEST_ASSERT_FALSE(called);
|
|
}
|
|
|
|
// --- PropsBridge tests ---
|
|
void test_props_handle_ping() {
|
|
PropsBridge bridge;
|
|
JsonDocument doc;
|
|
doc["cmd"] = "PING";
|
|
bridge.handleCommand(doc.as<JsonVariantConst>());
|
|
TEST_ASSERT_TRUE(true); // Placeholder
|
|
}
|
|
|
|
void setup() {
|
|
UNITY_BEGIN();
|
|
RUN_TEST(test_init);
|
|
RUN_TEST(test_volume);
|
|
RUN_TEST(test_mute);
|
|
RUN_TEST(test_route);
|
|
RUN_TEST(test_dtmf_no_digit_on_silence);
|
|
RUN_TEST(test_props_handle_ping);
|
|
UNITY_END();
|
|
}
|
|
|
|
void loop() {}
|