12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef JNI_CALL_LOG_H_
- #define JNI_CALL_LOG_H_
- #include <string>
- #include <vector>
- #include "sqlite.hpp"
- /**
- * 最大通话记录条数
- */
- #define CALL_LOG_COUNT_MAX 50
- /**
- * 存储通话记录数据库文件的位置
- * 这里默认保存在/data目录下
- * 由于/data 分区空间有限,默认限制最多保存50条通话记录。
- * 如果有TF卡,可以将文件保存到TF卡内,就能保存更多的记录
- */
- #define CALL_LOG_DATABASE "/data/call_log.db"
- /**
- * 通话记录
- */
- struct CallLogEntry {
- int id;
- /**
- * ip
- */
- std::string uri;
- /**
- * 联系人
- */
- std::string contact;
- /**
- * 通话时长
- */
- int duration;
- /**
- * 创建时间
- */
- int created_at;
- };
- typedef std::vector<CallLogEntry> CallLogEntries;
- /**
- * 保存一条通话记录
- */
- int PutCallLog(const CallLogEntry& record);
- /**
- * 获取所有的通话记录
- */
- int GetCallLog(CallLogEntries* records);
- /**
- * 获得通话记录数量
- */
- int GetCallLogCount();
- /**
- * 删除前n条通话记录
- */
- int DeleteOldCallLog(int n);
- #endif /* JNI_CALL_LOG_H_ */
|