MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / onReceive

Method onReceive

Tactility/Source/app/chat/ChatApp.cpp:71–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void ChatApp::onReceive(const esp_now_recv_info_t* receiveInfo, const uint8_t* data, int length) {
72 if (length <= 0) return;
73
74 ParsedMessage parsed;
75 if (!deserializeMessage(data, static_cast<size_t>(length), parsed)) {
76 return;
77 }
78
79 StoredMessage msg;
80 msg.displayText = parsed.senderName + ": " + parsed.message;
81 msg.target = parsed.target;
82 msg.isOwn = false;
83
84 state.addMessage(msg);
85
86 {
87 auto lock = lvgl::getSyncLock()->asScopedLock();
88 lock.lock();
89 view.displayMessage(msg);
90 }
91}
92
93void ChatApp::sendMessage(const std::string& text) {
94 if (text.empty()) return;

Callers

nothing calls this directly

Calls 6

deserializeMessageFunction · 0.85
getSyncLockFunction · 0.85
addMessageMethod · 0.80
asScopedLockMethod · 0.80
displayMessageMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected