libdballe  5.18
aof_codec.h
Go to the documentation of this file.
00001 /*
00002  * dballe/aof_codec - AOF import
00003  *
00004  * Copyright (C) 2005--2010  ARPA-SIM <urpsim@smr.arpa.emr.it>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00018  *
00019  * Author: Enrico Zini <enrico@enricozini.com>
00020  */
00021 
00022 #ifndef DBALLE_AOF_CODEC_H
00023 #define DBALLE_AOF_CODEC_H
00024 
00048 #include <dballe/msg/codec.h>
00049 #include <stdint.h>
00050 
00051 namespace dballe {
00052 struct Msg;
00053 
00054 namespace msg {
00055 
00056 class AOFImporter : public Importer
00057 {
00058 protected:
00059     // Message-specific code
00060     static void read_synop(const uint32_t* obs, int obs_len, Msg& msg);
00061     static void read_flight(const uint32_t* obs, int obs_len, Msg& msg);
00062     static void read_satob(const uint32_t* obs, int obs_len, Msg& msg);
00063     static void read_dribu(const uint32_t* obs, int obs_len, Msg& msg);
00064     static void read_temp(const uint32_t* obs, int obs_len, Msg& msg);
00065     static void read_pilot(const uint32_t* obs, int obs_len, Msg& msg);
00066     static void read_satem(const uint32_t* obs, int obs_len, Msg& msg);
00067 
00069     static void parse_st_block_station(const uint32_t* obs, Msg& msg);
00071     static void parse_altitude(const uint32_t* obs, Msg& msg);
00073     static void parse_st_ident(const uint32_t* obs, Msg& msg);
00079     static int parse_lat_lon_datetime(const uint32_t* obs, Msg& msg);
00081     static void parse_weather_group(const uint32_t* obs, Msg& msg, int hour);
00083     static void parse_general_cloud_group(const uint32_t* obs, Msg& msg);
00085     static void parse_cloud_group(uint32_t val, int* ns, int* c, int* h);
00086 
00087 
00088 public:
00089     AOFImporter(const Options& opts=Options());
00090     virtual ~AOFImporter();
00091 
00102     virtual void from_rawmsg(const Rawmsg& msg, Msgs& msgs) const;
00103 
00107     virtual void from_bulletin(const wreport::Bulletin& msg, Msgs& msgs) const;
00108 
00119     static void get_category(const Rawmsg& msg, int* category, int* subcategory);
00120 
00129     static void dump(const Rawmsg& msg, FILE* out);
00130 };
00131 
00132 } // namespace msg
00133 } // namespace dballe
00134 
00135 /* vim:set ts=4 sw=4: */
00136 #endif