mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-03-02 02:43:56 +08:00
* initial version
* print all message's in ncurses window
* show download progress bar
* move all to class ConsoleUI
* timeline
* improve timeline&stats
* fix logMessage
* add warning indicator
* continue
* cleanup
* cast type to int
* simplify seekToFlag
* more
* <=
* handle enter
* add box to logging window
* fix multiple threads problem
* fix concurrency issues
* draw indicator
* many improvements
* more
* fix multipe threads logging
* stop replay before exit
* use lambda instead of std::bind
* cleanup
* small cleanup
* use carFingerPrint
* don't emit signal in replay::stream
* merge car_events into timeline
* cleanup DonloadStats
* cleanup
* rename carname to carFingerprint
* improve alert
* add comments
* add help functions
templete function
* handle term resize
* display replaying status
* rename to INSTANT
* helper function pauseReplay
* more
* cleanup
use rDebug
* no template
* less colors
* remove function mv_add_str
* use BORDER_SIZE
* tune colors
* add spaces
* apply reviews
use /
old-commit-hash: 3ca8e3653b
35 lines
1.5 KiB
C++
35 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
enum class ReplyMsgType {
|
|
Info,
|
|
Debug,
|
|
Warning,
|
|
Critical
|
|
};
|
|
|
|
typedef std::function<void(ReplyMsgType type, const std::string msg)> ReplayMessageHandler;
|
|
void installMessageHandler(ReplayMessageHandler);
|
|
void logMessage(ReplyMsgType type, const char* fmt, ...);
|
|
|
|
#define rInfo(fmt, ...) ::logMessage(ReplyMsgType::Info, fmt, ## __VA_ARGS__)
|
|
#define rDebug(fmt, ...) ::logMessage(ReplyMsgType::Debug, fmt, ## __VA_ARGS__)
|
|
#define rWarning(fmt, ...) ::logMessage(ReplyMsgType::Warning, fmt, ## __VA_ARGS__)
|
|
#define rError(fmt, ...) ::logMessage(ReplyMsgType::Critical , fmt, ## __VA_ARGS__)
|
|
|
|
std::string sha256(const std::string &str);
|
|
void precise_nano_sleep(long sleep_ns);
|
|
std::string decompressBZ2(const std::string &in, std::atomic<bool> *abort = nullptr);
|
|
std::string decompressBZ2(const std::byte *in, size_t in_size, std::atomic<bool> *abort = nullptr);
|
|
std::string getUrlWithoutQuery(const std::string &url);
|
|
size_t getRemoteFileSize(const std::string &url, std::atomic<bool> *abort = nullptr);
|
|
std::string httpGet(const std::string &url, size_t chunk_size = 0, std::atomic<bool> *abort = nullptr);
|
|
|
|
typedef std::function<void(uint64_t cur, uint64_t total, bool success)> DownloadProgressHandler;
|
|
void installDownloadProgressHandler(DownloadProgressHandler);
|
|
bool httpDownload(const std::string &url, const std::string &file, size_t chunk_size = 0, std::atomic<bool> *abort = nullptr);
|
|
std::string formattedDataSize(size_t size);
|