View Single Post
Old September 28th, 2006   #1
sjackman
Task Group Member
 
Join Date: Sep 2006
Posts: 26
Default Sensor string tables

Following are the string tables used for sensors. The text encoding is UTF-8. Hope this is useful.

Cheers,
Shaun Jackman
Pathway Connectivity

Code:
static const char *types[] = {
	"Temperature", "Voltage", "Current", "Frequency",
	"Resistance", "Power", "Mass", "Length", "Area", "Volume",
	"Density", "Velocity", "Acceleration", "Force", "Energy",
	"Pressure", "Time", "Angle",
	"Position X", "Position Y", "Position Z", "Angular velocity",
	"Luminous intensity", "Luminous flux", "Illuminance",
	"Chrominance red", "Chrominance green", "Chrominance blue",
	"Contact", "Memory", "Item", "Humidity", "Counter 16 bit",
	"Other", "Manufacturer-specific",
};

static const char *units[] = {
	"", "°C",
	"V (DC)", "V (AC peak)", "V (AC RMS)",
	"A (DC)", "A (AC peak)", "A (AC RMS)",
	"Hz", "Ω", "W", "kg",
	"m", "m²", "m³", "kg/m³", "m/s", "m/s²",
	"N", "J", "Pa", "s", "°",
	"sr", "cd", "lm", "lx", "IRE", "B",
};

static const char *prefixes[] = {
	"",
	"d", "c", "m", "µ", "n", "p", "f", "a", "z", "y",
	"da", "h", "k", "M", "G", "T", "P", "E", "Z", "Y",
};

static const float factors[] = {
	1,
	1e-1, 1e-2, 1e-3, 1e-6, 1e-9,
	1e-12, 1e-15, 1e-18, 1e-21, 1e-24,
	1e1, 1e2, 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24,
};

struct sensor_definition {
	uint8_t sensor;
	uint8_t type;
	uint8_t unit;
	uint8_t prefix;
	uint16_t range_min;
	uint16_t range_max;
	uint16_t normal_min;
	uint16_t normal_max;
	uint8_t recorded_value_support;
	char description[32];
};

struct sensor_value {
	uint8_t sensor;
	uint16_t present;
	uint16_t lowest;
	uint16_t highest;
	uint16_t recorded;
} __attribute__((packed));
sjackman is offline   Reply With Quote