Example #1
0
 Writer& Writer::writeBeginObject(const std::string& name,
                                  Formatting formatting)
 {
     setValueName(name);
     writeBeginObject(formatting);
     return *this;
 }
Example #2
0
/*!
    Constructs a command line option object with the given arguments.

    The name of the option is set to \a name.
    The name can be either short or long. If the name is one character in
    length, it is considered a short name. Option names must not be empty,
    must not start with a dash or a slash character, must not contain a \c{=}
    and cannot be repeated.

    The description is set to \a description. It is customary to add a "."
    at the end of the description.

    In addition, the \a valueName can be set if the option expects a value.
    The default value for the option is set to \a defaultValue.

    \sa setDescription(), setValueName(), setDefaultValues()
*/
QCommandLineOption::QCommandLineOption(const QString &name, const QString &description,
                                       const QString &valueName,
                                       const QString &defaultValue)
   : d(new QCommandLineOptionPrivate)
{
   d->setNames(QStringList(name));
   setValueName(valueName);
   setDescription(description);
   setDefaultValue(defaultValue);
}
Example #3
0
 Writer& Writer::writeBase64(const std::string& name,
                             const void* data, size_t size)
 {
     setValueName(name);
     return writeValue(toBase64(data, size));
 }
Example #4
0
 Writer& Writer::writeRawValue(const std::string& name,
                               const std::string& value)
 {
     setValueName(name);
     return writeRawValue(value);
 }
Example #5
0
 Writer& Writer::writeBool(const std::string& name, bool value)
 {
     setValueName(name);
     return writeBool(value);
 }
Example #6
0
 Writer& Writer::writeNull(const std::string& name)
 {
     setValueName(name);
     return writeNull();
 }
void TemperatureSensor::init(sensorModule m, SensorPins& p) {
	/* Each temperature sensor has a maximum of two channels. The first channel
	 * is always Temperature. The second channel may or may not be used. For
	 * DHT11/22 devices, the second channel is humidity.
	 */
	setModule(m);
	setPins(p);

	// Configure Sensor Parameters
	setStaleAge_ms(10000);	// timeout of the value if not update for 10 seconds.

	// Channel 1 is always defined like this
	setCalEnable(TEMP_CAL_INDEX_TEMP_SLOPE, true);
	setCalName(TEMP_CAL_INDEX_TEMP_SLOPE, "Temperature Gain");
	setCalEnable(TEMP_CAL_INDEX_TEMP_OFFSET, true);
	setCalName(TEMP_CAL_INDEX_TEMP_OFFSET, "Temperature Offset");
	setValueEnable(TEMP_VALUE_INDEX_TEMPERATURE, true);
	setValueName(TEMP_VALUE_INDEX_TEMPERATURE, "temp");
	setType(TEMP_VALUE_INDEX_TEMPERATURE, valueType::temperature);
	setUOM(TEMP_VALUE_INDEX_TEMPERATURE, uomType::celsius);

	// Channel 2 defaults -- assume not used
	setCalEnable(TEMP_CAL_INDEX_HUMIDITY_SLOPE, false);
	setCalName(TEMP_CAL_INDEX_HUMIDITY_SLOPE, "not used");
	setCalEnable(TEMP_CAL_INDEX_HUMIDITY_OFFSET, false);
	setCalName(TEMP_CAL_INDEX_HUMIDITY_OFFSET, "not used");
	setValueEnable(TEMP_VALUE_INDEX_HUMIDITY, false);
	setValueName(TEMP_VALUE_INDEX_HUMIDITY, "not used");
	setType(TEMP_VALUE_INDEX_HUMIDITY, valueType::undefined);
	setUOM(TEMP_VALUE_INDEX_HUMIDITY, uomType::undefined);

	if (m == sensorModule::dht11 || m == sensorModule::dht22 || m == sensorModule::htu21d_si7102) {
		setCalEnable(TEMP_CAL_INDEX_HUMIDITY_SLOPE, true);
		setCalName(TEMP_CAL_INDEX_HUMIDITY_SLOPE, "Humidity Gain");
		setCalEnable(TEMP_CAL_INDEX_HUMIDITY_OFFSET, true);
		setCalName(TEMP_CAL_INDEX_HUMIDITY_OFFSET, "Humidity Offset");
		setValueEnable(TEMP_VALUE_INDEX_HUMIDITY, true);
		setValueName(TEMP_VALUE_INDEX_HUMIDITY, "rH%");
		setType(TEMP_VALUE_INDEX_HUMIDITY, valueType::humidity);
		setUOM(TEMP_VALUE_INDEX_HUMIDITY, uomType::rh);
	}

	// The pins used to interact with the sensor
	digital_pin = static_cast<uint8_t>(p.digital);
	sda_pin = static_cast<uint8_t>(p.sda);
	scl_pin = static_cast<uint8_t>(p.scl);

	// Create and initialize the sensor objects
	//lint -e{788} Many modules are intentionally omitted from the switch. Don't complain about it.
	switch (m) {
		case sensorModule::dht11:
			dht = new DHT(digital_pin, DHT11);
			dht->begin();
			setWaitTimeBetweenAcquireSetupMS(2000);
			setWaitTimeAfterAcquireSetupMS(250);
			setWaitTimeAfterAcquire1MS(250);
			break;
		case sensorModule::dht22:
			dht = new DHT(digital_pin, DHT22);
			dht->begin();
			setWaitTimeBetweenAcquireSetupMS(2000);
			setWaitTimeAfterAcquireSetupMS(250);
			setWaitTimeAfterAcquire1MS(250);
			break;
		case sensorModule::ds18b20:
			ow = new OneWire(digital_pin);	// specify pin on creation
			dallas = new DallasTemperature(ow);
			setWaitTimeBetweenAcquireSetupMS(2000);
			setWaitTimeAfterAcquireSetupMS(0);
			setWaitTimeAfterAcquire1MS(800);
			// do the begin later since it takes a while
			break;
		case sensorModule::htu21d_si7102:
			htu21d = new HTU21D();
//			htu21d->begin(callbackfunction);
			htu21d->begin();
			setWaitTimeBetweenAcquireSetupMS(2000);
			setWaitTimeAfterAcquireSetupMS(0);
			setWaitTimeAfterAcquire1MS(0);
			break;
		default:
			break;  // none of these sensors are supported by this module
	}
}