void ds3t::ParameterInt64::set_value (int64_t val) { value = val; if (ui_control != nullptr) ui_control->set_value_str (get_value_str ()); }
void ds3t::ParameterFloat::set_value (float val) { value = val; if (ui_control != nullptr) ui_control->set_value_str (get_value_str ()); }
void ds3t::ParameterBool::set_value (bool val) { value = val; if (ui_control != nullptr) ui_control->set_value_str (get_value_str ()); }
void ds3t::ParameterInt64::set_value_str (std::wstring str) { value = _wtol (str.c_str ()); if (ui_control != nullptr) { ui_control->set_value_str (get_value_str ()); } }
void ds3t::ParameterFloat::set_value_str (std::wstring str) { value = (float)wcstod (str.c_str (), NULL); if (ui_control != nullptr) { ui_control->set_value_str (get_value_str ()); } }
void ds3t::ParameterBool::set_value_str (std::wstring str) { if (str.length () == 1 && str [0] == L'1') value = true; else if (str.length () == 4 && towlower (str [0]) == L't' && towlower (str [1]) == L'r' && towlower (str [2]) == L'u' && towlower (str [3]) == L'e') value = true; else value = false; if (ui_control != nullptr) { ui_control->set_value_str (get_value_str ()); } }
int xcmd_set_bdinfo(char * buffer) { uint16_t data,idx; uint8_t bdtype; CalibMsg *msg = (CalibMsg *)buffer; msg->seq_no = g_seq_no; msg->dest = 0xffff;//g_dest; msg->inst[0].cmd=XCOMMAND_CALIBRATION; msg->inst[0].subcmd=CALIB_SETBDINFO; calib_set_header(buffer); if (g_argument) { idx=GetDataValue(g_argument,0); if(idx==0xffff) { printf("error: Value type is not right.\n"); return 0; } switch(idx) { case 0: case 1: msg->inst[0].param.calibration.valtype=(uint8_t)(idx); data=GetDataValue(g_argument,1); if(data==0xffff) { printf("error: Info type is not right.\n"); return 0; } msg->inst[0].param.calibration.infotype=(uint16_t)(data); data=GetDataValue(g_argument,2); if(data==0xffff || data>255) { printf("error: Offset is not right.\n"); return 0; } msg->inst[0].param.calibration.offset=(uint8_t)(data); data=GetDataValue(g_argument,3); if(data==0xffff) { printf("error: Value is not right.\n"); return 0; } msg->inst[0].param.calibration.data=(uint16_t)(data); break; case 2: GetDataChar(g_argument,1); bdtype=get_board_type(value); if(bdtype==0) { printf("error: Board name is not right.\n"); return 0; } data=GetDataValue(g_argument,3); if(data==0xffff) { printf("error: Value is not right.\n"); return 0; } msg->inst[0].param.calibration.data=(uint16_t)(data); GetDataChar(g_argument,2); name=get_value_str(bdtype,value); if(name==NULL) { printf("\n error: Could not find the name in the table.\n"); return 0; } data=GetDataValue((char*)name,0); if(idx==0xffff) { printf("error: Value type is not right.\n"); return 0; } msg->inst[0].param.calibration.valtype=(uint8_t)(data); data=GetDataValue((char*)name,1); if(data==0xffff) { printf("error: Info type is not right.\n"); return 0; } msg->inst[0].param.calibration.infotype=(uint16_t)(data); data=GetDataValue((char*)name,2); if(data==0xffff || data>255) { printf("error: Offset is not right.\n"); return 0; } msg->inst[0].param.calibration.offset=(uint8_t)(data); break; default: break; } } else { printf("error: No right parameters found.\n"); return 0; } return sizeof(CalibMsg); }