41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 48 #define __FILE_ID__ "files" 67 if (!strcmp(j.
token,
"name")) {
75 }
else if(!strcmp(j.
token,
"crc")) {
80 }
else if(!strcmp(j.
token,
"size")) {
117 ,_filesCount(FILESCOUNT_INVALID)
118 ,_freeSpace(FREESPACE_INVALID)
119 ,_valueCallbackFiles(NULL)
136 if(json_val->
has(
"filesCount")) {
139 if(json_val->
has(
"freeSpace")) {
167 }
catch (std::exception) {
196 }
catch (std::exception) {
244 }
catch (std::exception) {
266 if (callback != NULL) {
273 if (callback != NULL && this->
isOnline()) {
314 if (!(res ==
"ok")) {
337 vector<string> filelist;
338 vector<YFileRecord> res;
342 for (
unsigned ii = 0; ii < filelist.size(); ii++) {
360 vector<string> filelist;
361 if ((
int)(filename).length() == 0) {
366 if ((
int)filelist.size() > 0) {
399 return this->
_upload(pathname, content);
422 if (!(res ==
"ok")) {
441 vector<YFUN_DESCR> v_fundescr;
443 string serial, funcId, funcName, funcVal, errmsg;
446 v_fundescr.size() == 0 ||
string _json_get_key(const string &json, const string &data)
yCRITICAL_SECTION _this_cs
YRETCODE _load_unsafe(int msValidity)
YFileRecord(const string &json)
virtual bool fileExist(string filename)
void(* YFilesValueCallback)(YFiles *func, const string &functionValue)
YRETCODE _upload(const string &path, const string &content)
static int DefaultCacheValidity
void _throw(YRETCODE errType, string errMsg)
yJsonRetCode yJsonParse(yJsonStateMachine *j)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
string _download(const string &url)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
virtual string download(string pathname)
void yJsonSkip(yJsonStateMachine *j, int nitems)
YFiles(const string &func)
virtual int _parseAttr(YJSONObject *json_val)
static YFiles * FindFiles(string func)
virtual int remove(string pathname)
int getInt(const string &key)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
virtual int format_fs(void)
virtual int get_crc(void)
static const int FREESPACE_INVALID
static YFunction * _FindFromCache(const string &classname, const string &func)
vector< string > _json_get_array(const string &json)
virtual string get_name(void)
static string ysprintf(const char *fmt,...)
virtual vector< YFileRecord > get_list(string pattern)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
virtual int _invokeValueCallback(string value)
static const int FILESCOUNT_INVALID
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
virtual int get_size(void)
static YFiles * FirstFiles(void)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
virtual int _parseAttr(YJSONObject *json_val)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int upload(string pathname, string content)
virtual string sendCommand(string command)
bool has(const string &key)
virtual int registerValueCallback(YFilesValueCallback callback)
YFilesValueCallback _valueCallbackFiles
virtual int _invokeValueCallback(string value)