Ejemplo n.º 1
0
bool checkVout()
{
    // rev point: MAX_CHARGE_V
    AnalogInputs::ValueType adcMax;
    adcMax = AnalogInputs::reverseCalibrateValue(AnalogInputs::Vout_plus_pin, ANALOG_VOLT(1.000));
    adcMax *= MAX_CHARGE_V/ANALOG_VOLT(1.000);
    return checkMax(MAX_CHARGE_V, adcMax, AnalogInputs::Vout_plus_pin);
}
Ejemplo n.º 2
0
bool checkIcharge(AnalogInputs::Name name)
{
    // rev point: MAX_CHARGE_I
    AnalogInputs::ValueType adcMax;
    adcMax = AnalogInputs::reverseCalibrateValue(name, CALIBRATION_CHARGE_POINT1_mA);
    adcMax *= MAX_CHARGE_I/CALIBRATION_CHARGE_POINT1_mA;
    return checkMax(MAX_CHARGE_I, adcMax, name);
}
Ejemplo n.º 3
0
bool checkIdischarge(AnalogInputs::Name name)
{
    // rev point: CALIBRATION_DISCHARGE_POINT1_mA
    // we don't use MAX_DISCHARGE_I because on some chargers (imaxB6-clone) it's very off.
    AnalogInputs::ValueType adcMax;
    adcMax = AnalogInputs::reverseCalibrateValue(name, CALIBRATION_DISCHARGE_POINT0_mA);
    adcMax *= CALIBRATION_DISCHARGE_POINT1_mA/CALIBRATION_DISCHARGE_POINT0_mA;
    return checkMax(CALIBRATION_DISCHARGE_POINT1_mA, adcMax, name);
}
Ejemplo n.º 4
0
bool checkIcharge(AnalogInputs::Name name)
{
    // rev point: MAX_CHARGE_I
    uint32_t adcMax;
    adcMax = AnalogInputs::reverseCalibrateValue(name, CALIBRATION_CHARGE_POINT1_mA);
    adcMax *= settings.maxIc;
    adcMax /= CALIBRATION_CHARGE_POINT1_mA;
    return checkMax(settings.maxIc, adcMax, name);
}
Ejemplo n.º 5
0
static int cb_exec(struct ast_channel *chan, void *data)
{
	int res=0, i=0, pos=0, optLen=0;
	struct userkeyin dtmfinput;
	struct roomdetails dtmfmatch;
	char confno[AST_MAX_EXTENSION] = "";
	char *notdata, *info;

	if (ast_strlen_zero(data)){
		notdata = "";
	} else {
		notdata = data;
	}
	
	info = ast_strdupa(notdata);

	if (info){
		char *tmp = strsep(&info, ",");
		ast_copy_string(confno, tmp, sizeof(confno));
	}

	if (!ast_strlen_zero(confno)){
		strcpy(dtmfinput.inroom, confno);
	} else {
	strcpy(dtmfinput.inroom, "");
	}

	strcpy(dtmfinput.inpass, "");

	/*
	if (!DBOpts) {
	    strcpy(dtmfmatch.roomtype, OptsUsr);
	}
	*/
	

	
	res = getConf(chan, dtmfinput, &dtmfmatch);
	ast_log(LOG_NOTICE, "getConf: %i\n", res);
	if (res == -1) {
		return -1;
	} else {
		if(res==1){
			res = getPass(chan, dtmfinput, &dtmfmatch);
			ast_log(LOG_NOTICE, "getPass: %i\n", res);
		} else {

			optLen = strlen(dtmfmatch.uFlags);
			for (pos = 0; pos < optLen; pos++){
				if ((dtmfmatch.uFlags[pos] != 'm') &&
				    (dtmfmatch.uFlags[pos] != 'w') &&
				    (dtmfmatch.uFlags[pos] != 'l') ) {
					dtmfmatch.roomtype[i++] = dtmfmatch.uFlags[pos];
					dtmfmatch.roomtype[i] = '\0';
				}
			}

			if(strchr(dtmfmatch.aFlags, 'r'))
				strcat(dtmfmatch.roomtype, "r");

			ast_log(LOG_NOTICE, "No User or Admin passwords\n");
			res = 1;
		}
	}
	if(res==1 || res==2 ){
		res = checkMax(chan, &dtmfmatch);
	ast_log(LOG_NOTICE, "checkMax: %i\n", res);}
	if(res==1){
		res = enterConf(chan, &dtmfmatch);
	ast_log(LOG_NOTICE, "enterConf: %i\n", res);}

	return res;
}