Moved updateRecords method to class tempalte.

This commit is contained in:
Robert Borzecki
2019-08-12 13:56:44 +02:00
parent d92372280b
commit 9fd6cc5b87
4 changed files with 108 additions and 88 deletions

View File

@@ -26,9 +26,6 @@ ApplicationNotes::~ApplicationNotes() {
// Invoked upon receiving data message
sys::Message_t ApplicationNotes::DataReceivedHandler(sys::DataMessage* msgl,sys::ResponseMessage* resp) {
uint32_t msgType = msgl->messageType;
LOG_WARN("msg id: %d looking for: %d", msgType, static_cast<uint32_t>(MessageType::DBNotesGetLimitOffset) );
auto retMsg = Application::DataReceivedHandler(msgl);
//if message was handled by application's template there is no need to process further.
if( (reinterpret_cast<sys::ResponseMessage*>( retMsg.get() )->retCode ==
@@ -38,11 +35,15 @@ sys::Message_t ApplicationNotes::DataReceivedHandler(sys::DataMessage* msgl,sys:
bool handled = false;
switch( msgType ) {
case static_cast<uint32_t>(MessageType::DBNotesGetLimitOffset): {
DBNotesResponseMessage* msg = reinterpret_cast<DBNotesResponseMessage*>( msgl );
notesModel->updateRecords( std::move(msg->records), msg->offset, msg->limit, msg->count );
}break;
//handle database response
if( resp != nullptr ) {
uint32_t msgType = resp->responseTo;
switch( msgType ) {
case static_cast<uint32_t>(MessageType::DBNotesGetLimitOffset): {
DBNotesResponseMessage* msg = reinterpret_cast<DBNotesResponseMessage*>( resp );
notesModel->updateRecords( std::move(msg->records), msg->offset, msg->limit, msg->count );
}break;
}
}
if( handled )