mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-28 18:27:08 -04:00
* [EGD-2404] Handling incoming SMS. * [EGD-2404-db-modem] WiP onf db handling. * [EGD-2404-db-modem] service-db notification + SmsDB::Add. * WiP handling service-db notification in service-cellular. * WiP on cellular<->db. * Fix in usc2, handlig incoming message. * Code cleanup pt 1. * Improvements in service-csllular. * Fixed compilation error on target, small cleanup. * Small claenup. * Fixes after rebase. * Fixed incoming sms date parsing on target. * Fix after rebase. * PR suggestions added. * dynamic_cast + nullptr check.
69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
|
|
/*
|
|
* @file SMSRecord.hpp
|
|
* @author Mateusz Piesta (mateusz.piesta@mudita.com)
|
|
* @date 29.05.19
|
|
* @brief
|
|
* @copyright Copyright (C) 2019 mudita.com
|
|
* @details
|
|
*/
|
|
|
|
|
|
#ifndef PUREPHONE_SMSRECORD_HPP
|
|
#define PUREPHONE_SMSRECORD_HPP
|
|
|
|
#include "Record.hpp"
|
|
#include <stdint.h>
|
|
#include "../Databases/SmsDB.hpp"
|
|
#include "../Databases/ContactsDB.hpp"
|
|
#include "utf8/UTF8.hpp"
|
|
#include "../Common/Common.hpp"
|
|
|
|
struct SMSRecord{
|
|
uint32_t dbID;
|
|
uint32_t date;
|
|
uint32_t dateSent;
|
|
uint32_t errorCode;
|
|
UTF8 number;
|
|
UTF8 body;
|
|
bool isRead;
|
|
SMSType type;
|
|
uint32_t threadID;
|
|
uint32_t contactID;
|
|
};
|
|
|
|
enum class SMSRecordField{
|
|
Number,
|
|
ThreadID,
|
|
ContactID
|
|
};
|
|
|
|
class SMSRecordInterface : public RecordInterface<SMSRecord,SMSRecordField > {
|
|
public:
|
|
|
|
SMSRecordInterface(SmsDB* smsDb,ContactsDB* contactsDb);
|
|
~SMSRecordInterface();
|
|
|
|
bool Add(const SMSRecord& rec) override final;
|
|
bool RemoveByID(uint32_t id) override final;
|
|
bool RemoveByField(SMSRecordField field,const char* str) override final;
|
|
bool Update(const SMSRecord& rec) override final;
|
|
SMSRecord GetByID(uint32_t id) override final;
|
|
|
|
uint32_t GetCount() override final;
|
|
uint32_t GetLastID(void);
|
|
std::unique_ptr<std::vector<SMSRecord>> GetLimitOffset(uint32_t offset,uint32_t limit) override final;
|
|
|
|
std::unique_ptr<std::vector<SMSRecord>> GetLimitOffsetByField(uint32_t offset,uint32_t limit,SMSRecordField field, const char* str) override final;
|
|
|
|
private:
|
|
const uint32_t snippetLength = 45;
|
|
SmsDB* smsDB;
|
|
ContactsDB* contactsDB;
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif //PUREPHONE_SMSRECORD_HPP
|