code_app/app/scanner/HGVersion.h

57 lines
1.3 KiB
C
Raw Normal View History

2022-06-29 09:46:00 +00:00
#ifndef __HGVERSION_H__
#define __HGVERSION_H__
#include <string>
#include <list>
struct ServerConfig
{
// 是否上传崩溃日志
bool postCrashInfo;
// 是否上传用户使用习惯
bool postUserHabits;
};
struct VersionInfo
{
VersionInfo()
{
size = 0;
}
2022-06-29 09:46:00 +00:00
std::string version;
std::string desc;
std::string bugInfo;
std::string url;
unsigned long long size;
std::string md5;
};
/* http下载进度回调
* : 0;0
*/
typedef int (*HttpDownloadFunc)(long long totalSize, long long nowSize, void *param);
// 获取服务器配置
bool GetServerConfig(ServerConfig &cfg);
// 上传崩溃日志
bool PostCrashInfo(const char* crashFilePath);
// 上传用户使用习惯
bool PostUserHabits(const std::list<std::string>& habits);
2022-06-29 09:46:00 +00:00
// 获取当前版本号
std::string GetCurrVersion();
// 获取服务器上所有版本的信息
bool GetVersionInfoList(std::list<VersionInfo> &versionList);
// 比较版本号, 负数表示version1<version2, 0表示相等正数表示version1>version2
int CompareVersion(const std::string& version1, const std::string& version2);
// 下载HTTP文件
bool HttpDownload(const std::string& url, const std::string& saveFilePath, HttpDownloadFunc func, void *param);
2022-06-29 09:46:00 +00:00
#endif /* __HGVERSION_H__ */