From 2e82359fa5bf7c34e9cbb3436fe9da0289710399 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 26 Feb 2012 19:25:42 +0100 Subject: initial code import --- libweatherstation.vapi | 291 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 libweatherstation.vapi (limited to 'libweatherstation.vapi') diff --git a/libweatherstation.vapi b/libweatherstation.vapi new file mode 100644 index 0000000..e509ae1 --- /dev/null +++ b/libweatherstation.vapi @@ -0,0 +1,291 @@ +/* libweatherstation.vapi + * Copyright (c) 2012, Sebastian Reichel + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +[CCode (cprefix = "weather_", cheader_filename = "weatherstation.h")] +namespace Weather { + [CCode (cname = "enum weather_wind_direction", cprefix = "")] + public enum WindDirection { + NORTH, + NORTH_EAST_NORTH, + NORTH_EAST, + EAST_NORTH_EAST, + EAST, + EAST_SOUTH_EAST, + SOUTH_EAST, + SOUTH_EAST_SOUTH, + SOUTH, + SOUTH_WEST_SOUTH, + SOUTH_WEST, + WEST_SOUTH_WEST, + WEST, + WEST_NORTH_WEST, + NORTH_WEST, + NORTH_WEST_NORTH; + + [CCode (cname = "weather_wind_direction_to_string")] + public unowned string to_string(); + } + + [Flag] + [CCode (cname = "enum weather_flag_status", cprefix = "WEATHER_STATUS_")] + public enum Status { + INVALID_DATA, + RAIN_OVERFLOW; + } + + [CCode (cname = "struct weather_data")] + public struct Data { + uint8 sample_time; + uint8 humidity_indoor; + uint16 temperature_indoor; + uint8 humidity_outdoor; + uint16 temperature_outdoor; + uint16 pressure; + uint8 avg_wind_speed; + uint8 gust_wind_speed; + uint8 high_nibble_wind_speed; + [CCode (ctype = "uint8_t")] + WindDirection wind_direction; + uint16 rain; + [CCode (ctype = "uint8_t")] + Status status; + } + + [Flag] + [CCode (cname = "enum weather_flag_unit_setting1", cprefix = "WEATHER_UNIT_")] + public enum UnitSetting1 { + IN_TEMP_FAHRENHEIT, + OUT_TEMP_FAHRENHEIT, + RAIN_INCH, + PRESSURE_HPA, + PRESSURE_INHG, + PRESSURE_MMHG; + } + + [Flag] + [CCode (cname = "enum weather_flag_unit_setting2", cprefix = "WEATHER_UNIT_")] + public enum UnitSetting2 { + WIND_SPEED_MS, + WIND_SPEED_KMH, + WIND_SPEED_KNOT, + WIND_SPEED_MH, + WIND_SPEED_BFT; + } + + [Flag] + [CCode (cname = "enum weather_flag_display_format1", cprefix = "WEATHER_DISPLAY_FORMAT_")] + public enum DisplayFormat1 { + PRESSURE_RELATIVE, + WIND_SPEED_GUST, + TIME_12H, + TIME_MMDDYY, + TIME_24H_SCALE, + COMPLETE_DATE, + DATE_WEEK, + ALARM; + } + + [Flag] + [CCode (cname = "enum weather_flag_display_format2", cprefix = "WEATHER_DISPLAY_FORMAT_")] + public enum DisplayFormat2 { + OUT_TEMP, + OUT_WINDCHILL, + OUT_DEW_POINT, + RAIN_1H, + RAIN_24H, + RAIN_WEEK, + RAIN_MONTH, + RAIN_TOTAL; + } + + [Flag] + [CCode (cname = "enum weather_flag_alarm1", cprefix = "WEATHER_ALARM_")] + public enum AlarmFlags1 { + TIME, + WIND_DIRECTION, + IN_HUMIDITY_LOW, + IN_HUMIDITY_HIGH, + OUT_HUMIDITY_LOW, + OUT_HUMIDITY_HIGH; + } + + [Flag] + [CCode (cname = "enum weather_flag_alarm2", cprefix = "WEATHER_ALARM_")] + public enum AlarmFlags2 { + AVERAGE_WIND_SPEED, + GUST_WIND_SPEED, + RAIN_1H, + RAIN_24H, + ABS_PRESSURE_LOW, + ABS_PRESSURE_HIGH, + REL_PRESSURE_LOW, + REL_PRESSURE_HIGH; + } + + [Flag] + [CCode (cname = "enum weather_flag_alarm3", cprefix = "WEATHER_ALARM_")] + public enum AlarmFlags3 { + IN_TEMP_LOW, + IN_TEMP_HIGH, + OUT_TEMP_LOW, + OUT_TEMP_HIGH, + WINDCHILL_LOW, + WINDCHILL_HIGH, + DEW_POINT_LOW, + DRW_POINT_HIGH; + } + + [CCode (cname = "struct weather_header_alarms")] + public struct Alarms { + uint8 in_humidity_high; + uint8 in_humidity_low; + uint16 inemp_high; + uint16 inemp_low; + uint8 out_humidity_high; + uint8 out_humidity_low; + uint16 outemp_high; + uint16 outemp_low; + uint16 wind_chill_high; + uint16 wind_chill_low; + uint16 dew_point_high; + uint16 dew_point_low; + uint16 absolute_pressure_high; + uint16 absolute_pressure_low; + uint16 relative_pressure_high; + uint16 relative_pressure_low; + uint8 average_bft_high; + uint16 average_wsp_high; + uint8 gust_bft_high; + uint16 gust_wsp_high; + uint8 wind_direction; + uint16 rain_1h_high; + uint16 rain_24h_high; + uint8 hour; + uint8 minute; + } + + [CCode (cname = "struct weather_header_records")] + public struct Records { + uint8 in_humidity_max; + uint8 in_humidity_min; + uint8 out_humidity_max; + uint8 out_humidity_min; + uint16 inemp_max; + uint16 inemp_min; + uint16 outemp_max; + uint16 outemp_min; + uint16 windchill_max; + uint16 windchill_min; + uint16 dew_point_max; + uint16 dew_point_min; + uint16 absolute_pressure_max; + uint16 absolute_pressure_min; + uint16 relative_pressure_max; + uint16 relative_pressure_min; + uint16 wsp_average_max; + uint16 wsp_gust_max; + uint16 rain_1h_max; + uint16 rain_24h_max; + uint16 rain_week_max; + uint16 rain_month_max; + uint16 rainotal_max; + uint8 nibble; + } + + [CCode (cname = "struct weather_time")] + public struct Time { + uint8 year; + uint8 month; + uint8 date; + uint8 hour; + uint8 minute; + } + + [CCode (cname = "struct weather_header_timestamps")] + public struct Timestamps { + Time in_humidity_max; + Time in_humidity_min; + Time out_humidity_max; + Time out_humidity_min; + Time in_temp_max; + Time in_temp_min; + Time out_temp_max; + Time out_temp_min; + Time wind_chill_max; + Time wind_chill_min; + Time dew_point_max; + Time dew_point_min; + Time absolute_pressure_max; + Time absolute_pressure_min; + Time relative_pressure_max; + Time relative_pressure_min; + Time wsp_average_max; + Time wsp_gust_max; + Time rain_1h_max; + Time rain_24h_max; + Time rain_week_max; + Time rain_month_max; + Time rain_total_max; + } + + [CCode (cname = "struct weather_header")] + public struct Header { + uint8 sampling_interval; + + [CCode (ctype = "uint8_t")] + UnitSetting1 unit_setting1; + + [CCode (ctype = "uint8_t")] + UnitSetting2 unit_setting2; + + [CCode (ctype = "uint8_t")] + DisplayFormat1 display_format1; + + [CCode (ctype = "uint8_t")] + DisplayFormat2 display_format2; + + [CCode (ctype = "uint8_t")] + AlarmFlags1 alarm_enable1; + + [CCode (ctype = "uint8_t")] + AlarmFlags2 alarm_enable2; + + [CCode (ctype = "uint8_t")] + AlarmFlags3 alarm_enable3; + + uint8 timezone; + + uint16 history_data_sets; + uint16 history_data_stack; + + uint16 relative_pressure; + uint16 absolute_pressure; + + Alarms alarm; + Records record; + Timestamps timestamp; + } + + [Compact] + [CCode (cname = "struct weather_station")] + public class Station { + [CCode (cname = "weather_station_init")] + public Station(); + public Data read_data(uint16 addr); + public Header read_header(); + public void write(uint16 addr, uint8 byte); + } +} -- cgit v1.2.3