00001 00009 /* 00010 * Copyright 2014 Vladimir Ermakov. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 3 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, but 00018 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00019 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00020 * for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License along 00023 * with this program; if not, write to the Free Software Foundation, Inc., 00024 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 */ 00026 00027 #pragma once 00028 00029 #include <diagnostic_updater/diagnostic_updater.h> 00030 #include <mavconn/interface.h> 00031 00032 namespace mavros { 00033 00034 class MavlinkDiag : public diagnostic_updater::DiagnosticTask 00035 { 00036 public: 00037 explicit MavlinkDiag(std::string name); 00038 00039 void run(diagnostic_updater::DiagnosticStatusWrapper &stat); 00040 00041 void set_mavconn(const mavconn::MAVConnInterface::Ptr &link) { 00042 weak_link = link; 00043 } 00044 00045 void set_connection_status(bool connected) { 00046 is_connected = connected; 00047 } 00048 00049 private: 00050 mavconn::MAVConnInterface::WeakPtr weak_link; 00051 unsigned int last_drop_count; 00052 bool is_connected; 00053 }; 00054 00055 }; // namespace mavros 00056