Пример #1
0
int uv_light_set_uv_light_callback_threshold(UVLight *uv_light, char option, uint32_t min, uint32_t max) {
	DevicePrivate *device_p = uv_light->p;
	SetUVLightCallbackThreshold_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), UV_LIGHT_FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.option = option;
	request.min = leconvert_uint32_to(min);
	request.max = leconvert_uint32_to(max);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int ambient_light_v2_set_illuminance_callback_threshold(AmbientLightV2 *ambient_light_v2, char option, uint32_t min, uint32_t max) {
	DevicePrivate *device_p = ambient_light_v2->p;
	SetIlluminanceCallbackThreshold_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), AMBIENT_LIGHT_V2_FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.option = option;
	request.min = leconvert_uint32_to(min);
	request.max = leconvert_uint32_to(max);

	ret = device_send_request(device_p, (Packet *)&request, NULL);


	return ret;
}
Пример #3
0
int uv_light_set_uv_light_callback_period(UVLight *uv_light, uint32_t period) {
	DevicePrivate *device_p = uv_light->p;
	SetUVLightCallbackPeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), UV_LIGHT_FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int load_cell_calibrate(LoadCell *load_cell, uint32_t weight) {
	DevicePrivate *device_p = load_cell->p;
	Calibrate_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), LOAD_CELL_FUNCTION_CALIBRATE, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.weight = leconvert_uint32_to(weight);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int motion_detector_v2_write_uid(MotionDetectorV2 *motion_detector_v2, uint32_t uid) {
	DevicePrivate *device_p = motion_detector_v2->p;
	WriteUID_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), MOTION_DETECTOR_V2_FUNCTION_WRITE_UID, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.uid = leconvert_uint32_to(uid);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #6
0
int co2_set_debounce_period(CO2 *co2, uint32_t debounce) {
	DevicePrivate *device_p = co2->p;
	SetDebouncePeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), CO2_FUNCTION_SET_DEBOUNCE_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int air_quality_set_write_firmware_pointer(AirQuality *air_quality, uint32_t pointer) {
	DevicePrivate *device_p = air_quality->p;
	SetWriteFirmwarePointer_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), AIR_QUALITY_FUNCTION_SET_WRITE_FIRMWARE_POINTER, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.pointer = leconvert_uint32_to(pointer);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int analog_in_v2_set_debounce_period(AnalogInV2 *analog_in_v2, uint32_t debounce) {
	DevicePrivate *device_p = analog_in_v2->p;
	SetDebouncePeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), ANALOG_IN_V2_FUNCTION_SET_DEBOUNCE_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #9
0
int distance_ir_set_analog_value_callback_period(DistanceIR *distance_ir, uint32_t period) {
	SetAnalogValueCallbackPeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), DISTANCE_IR_FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, distance_ir->ipcon, distance_ir);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(distance_ir, (Packet *)&request, NULL);


	return ret;
}
Пример #10
0
int imu_set_acceleration_period(IMU *imu, uint32_t period) {
	SetAccelerationPeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_SET_ACCELERATION_PERIOD, imu->ipcon, imu);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(imu, (Packet *)&request, NULL);


	return ret;
}
Пример #11
0
int imu_set_all_data_period(IMU *imu, uint32_t period) {
	SetAllDataPeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_SET_ALL_DATA_PERIOD, imu->ipcon, imu);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(imu, (Packet *)&request, NULL);


	return ret;
}
Пример #12
0
int imu_set_angular_velocity_period(IMU *imu, uint32_t period) {
	SetAngularVelocityPeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, imu->ipcon, imu);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(imu, (Packet *)&request, NULL);


	return ret;
}
Пример #13
0
int imu_set_magnetic_field_period(IMU *imu, uint32_t period) {
	SetMagneticFieldPeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_SET_MAGNETIC_FIELD_PERIOD, imu->ipcon, imu);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(imu, (Packet *)&request, NULL);


	return ret;
}
Пример #14
0
int uv_light_set_debounce_period(UVLight *uv_light, uint32_t debounce) {
	DevicePrivate *device_p = uv_light->p;
	SetDebouncePeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), UV_LIGHT_FUNCTION_SET_DEBOUNCE_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int distance_us_set_debounce_period(DistanceUS *distance_us, uint32_t debounce) {
	DevicePrivate *device_p = distance_us->p;
	SetDebouncePeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), DISTANCE_US_FUNCTION_SET_DEBOUNCE_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #16
0
int distance_ir_set_debounce_period(DistanceIR *distance_ir, uint32_t debounce) {
	SetDebouncePeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), DISTANCE_IR_FUNCTION_SET_DEBOUNCE_PERIOD, distance_ir->ipcon, distance_ir);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(distance_ir, (Packet *)&request, NULL);


	return ret;
}
int analog_in_v2_set_analog_value_callback_period(AnalogInV2 *analog_in_v2, uint32_t period) {
	DevicePrivate *device_p = analog_in_v2->p;
	SetAnalogValueCallbackPeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), ANALOG_IN_V2_FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int humidity_v2_set_write_firmware_pointer(HumidityV2 *humidity_v2, uint32_t pointer) {
	DevicePrivate *device_p = humidity_v2->p;
	SetWriteFirmwarePointer_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), HUMIDITY_V2_FUNCTION_SET_WRITE_FIRMWARE_POINTER, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.pointer = leconvert_uint32_to(pointer);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int air_quality_write_uid(AirQuality *air_quality, uint32_t uid) {
	DevicePrivate *device_p = air_quality->p;
	WriteUID_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), AIR_QUALITY_FUNCTION_WRITE_UID, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.uid = leconvert_uint32_to(uid);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int humidity_v2_write_uid(HumidityV2 *humidity_v2, uint32_t uid) {
	DevicePrivate *device_p = humidity_v2->p;
	WriteUID_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), HUMIDITY_V2_FUNCTION_WRITE_UID, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.uid = leconvert_uint32_to(uid);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #21
0
int co2_set_co2_concentration_callback_period(CO2 *co2, uint32_t period) {
	DevicePrivate *device_p = co2->p;
	SetCO2ConcentrationCallbackPeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), CO2_FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #22
0
int load_cell_set_weight_callback_period(LoadCell *load_cell, uint32_t period) {
	DevicePrivate *device_p = load_cell->p;
	SetWeightCallbackPeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), LOAD_CELL_FUNCTION_SET_WEIGHT_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int motion_detector_v2_set_write_firmware_pointer(MotionDetectorV2 *motion_detector_v2, uint32_t pointer) {
	DevicePrivate *device_p = motion_detector_v2->p;
	SetWriteFirmwarePointer_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), MOTION_DETECTOR_V2_FUNCTION_SET_WRITE_FIRMWARE_POINTER, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.pointer = leconvert_uint32_to(pointer);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #24
0
int load_cell_set_debounce_period(LoadCell *load_cell, uint32_t debounce) {
	DevicePrivate *device_p = load_cell->p;
	SetDebouncePeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), LOAD_CELL_FUNCTION_SET_DEBOUNCE_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #25
0
int piezo_buzzer_beep(PiezoBuzzer *piezo_buzzer, uint32_t duration) {
	Beep_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), PIEZO_BUZZER_FUNCTION_BEEP, piezo_buzzer->ipcon, piezo_buzzer);

	if (ret < 0) {
		return ret;
	}

	request.duration = leconvert_uint32_to(duration);

	ret = device_send_request(piezo_buzzer, (Packet *)&request, NULL);


	return ret;
}
int distance_us_set_distance_callback_period(DistanceUS *distance_us, uint32_t period) {
	DevicePrivate *device_p = distance_us->p;
	SetDistanceCallbackPeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), DISTANCE_US_FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
Пример #27
0
int voltage_set_voltage_callback_period(Voltage *voltage, uint32_t period) {
	DevicePrivate *device_p = voltage->p;
	SetVoltageCallbackPeriod_Request request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), VOLTAGE_FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);

	return ret;
}
int led_strip_set_clock_frequency(LEDStrip *led_strip, uint32_t frequency) {
	DevicePrivate *device_p = led_strip->p;
	SetClockFrequency_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), LED_STRIP_FUNCTION_SET_CLOCK_FREQUENCY, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.frequency = leconvert_uint32_to(frequency);

	ret = device_send_request(device_p, (Packet *)&request, NULL);


	return ret;
}
int ambient_light_v2_set_debounce_period(AmbientLightV2 *ambient_light_v2, uint32_t debounce) {
	DevicePrivate *device_p = ambient_light_v2->p;
	SetDebouncePeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), AMBIENT_LIGHT_V2_FUNCTION_SET_DEBOUNCE_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.debounce = leconvert_uint32_to(debounce);

	ret = device_send_request(device_p, (Packet *)&request, NULL);


	return ret;
}
int ambient_light_v2_set_illuminance_callback_period(AmbientLightV2 *ambient_light_v2, uint32_t period) {
	DevicePrivate *device_p = ambient_light_v2->p;
	SetIlluminanceCallbackPeriod_ request;
	int ret;

	ret = packet_header_create(&request.header, sizeof(request), AMBIENT_LIGHT_V2_FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, device_p->ipcon_p, device_p);

	if (ret < 0) {
		return ret;
	}

	request.period = leconvert_uint32_to(period);

	ret = device_send_request(device_p, (Packet *)&request, NULL);


	return ret;
}