41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "multicellweighscale" 53 ,_cellCount(CELLCOUNT_INVALID)
54 ,_excitation(EXCITATION_INVALID)
55 ,_compTempAdaptRatio(COMPTEMPADAPTRATIO_INVALID)
56 ,_compTempAvg(COMPTEMPAVG_INVALID)
57 ,_compTempChg(COMPTEMPCHG_INVALID)
58 ,_compensation(COMPENSATION_INVALID)
59 ,_zeroTracking(ZEROTRACKING_INVALID)
60 ,_command(COMMAND_INVALID)
61 ,_valueCallbackMultiCellWeighScale(NULL)
62 ,_timedReportCallbackMultiCellWeighScale(NULL)
84 if(json_val->
has(
"cellCount")) {
87 if(json_val->
has(
"excitation")) {
90 if(json_val->
has(
"compTempAdaptRatio")) {
93 if(json_val->
has(
"compTempAvg")) {
96 if(json_val->
has(
"compTempChg")) {
99 if(json_val->
has(
"compensation")) {
102 if(json_val->
has(
"zeroTracking")) {
105 if(json_val->
has(
"command")) {
131 }
catch (std::exception) {
160 }
catch (std::exception) {
183 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
184 res =
_setAttr(
"cellCount", rest_val);
185 }
catch (std::exception) {
215 }
catch (std::exception) {
239 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
240 res =
_setAttr(
"excitation", rest_val);
241 }
catch (std::exception) {
267 char buf[32]; sprintf(buf,
"%d", (
int)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);
268 res =
_setAttr(
"compTempAdaptRatio", rest_val);
269 }
catch (std::exception) {
301 }
catch (std::exception) {
330 }
catch (std::exception) {
360 }
catch (std::exception) {
389 }
catch (std::exception) {
412 char buf[32]; sprintf(buf,
"%d", (
int)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);
413 res =
_setAttr(
"zeroTracking", rest_val);
414 }
catch (std::exception) {
445 }
catch (std::exception) {
467 }
catch (std::exception) {
482 res =
_setAttr(
"command", rest_val);
483 }
catch (std::exception) {
531 }
catch (std::exception) {
553 if (callback != NULL) {
560 if (callback != NULL && this->
isOnline()) {
594 if (callback != NULL) {
654 vector<YFUN_DESCR> v_fundescr;
656 string serial, funcId, funcName, funcVal, errmsg;
659 v_fundescr.size() == 0 ||
double _compTempAdaptRatio
double getDouble(const string &key)
yCRITICAL_SECTION _this_cs
double get_compensation(void)
static void _UpdateTimedReportCallbackList(YFunction *func, bool add)
YRETCODE _load_unsafe(int msValidity)
static const double COMPENSATION_INVALID
static const double COMPTEMPADAPTRATIO_INVALID
static YMultiCellWeighScale * FindMultiCellWeighScale(string func)
virtual int _invokeTimedReportCallback(YMeasure value)
static const double COMPTEMPAVG_INVALID
virtual int _parseAttr(YJSONObject *json_val)
void(* YMultiCellWeighScaleTimedReportCallback)(YMultiCellWeighScale *func, YMeasure measure)
static int DefaultCacheValidity
string getString(const string &key)
static const string COMMAND_INVALID
YMultiCellWeighScaleTimedReportCallback _timedReportCallbackMultiCellWeighScale
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static const double COMPTEMPCHG_INVALID
double get_compTempAdaptRatio(void)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
void(* YMultiCellWeighScaleValueCallback)(YMultiCellWeighScale *func, const string &functionValue)
double get_compTempChg(void)
#define YAPI_INVALID_STRING
int set_command(const string &newval)
double get_compTempAvg(void)
static const int CELLCOUNT_INVALID
int getInt(const string &key)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
#define YAPI_INVALID_DOUBLE
virtual int _invokeTimedReportCallback(YMeasure value)
int set_unit(const string &newval)
virtual int _invokeValueCallback(string value)
static YFunction * _FindFromCache(const string &classname, const string &func)
static string ysprintf(const char *fmt,...)
YMultiCellWeighScale(const string &func)
static const double ZEROTRACKING_INVALID
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
int set_compTempAdaptRatio(double newval)
virtual int _parseAttr(YJSONObject *json_val)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
Y_EXCITATION_enum get_excitation(void)
int set_excitation(Y_EXCITATION_enum newval)
double get_zeroTracking(void)
int set_cellCount(int newval)
int set_zeroTracking(double newval)
virtual int setupSpan(double currWeight, double maxWeight)
static const Y_EXCITATION_enum EXCITATION_INVALID
virtual int _invokeValueCallback(string value)
Y_EXCITATION_enum _excitation
YMultiCellWeighScaleValueCallback _valueCallbackMultiCellWeighScale
virtual int registerValueCallback(YMultiCellWeighScaleValueCallback callback)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int registerTimedReportCallback(YMultiCellWeighScaleTimedReportCallback callback)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
YMultiCellWeighScale * nextMultiCellWeighScale(void)
static YMultiCellWeighScale * FirstMultiCellWeighScale(void)