00001 /* Copyright 2015 Institute of Digital Communication Systems - Ruhr-University Bochum 00002 * Author: Adrian Bauer 00003 * 00004 * This program is free software; you can redistribute it and/or modify it under the terms of 00005 * the GNU General Public License as published by the Free Software Foundation; 00006 * either version 3 of the License, or (at your option) any later version. 00007 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00008 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00009 * See the GNU General Public License for more details. 00010 * You should have received a copy of the GNU General Public License along with this program; 00011 * if not, see <http://www.gnu.org/licenses/>. 00012 * 00013 **/ 00014 00015 #include <ros/ros.h> 00016 #include <heatmap/wifi_signal.h> 00017 #include <heatmap/signal_service.h> 00018 00019 namespace heatmap 00020 { 00025 class SignalSimulator 00026 { 00027 private: 00028 heatmap::wifi_signal ws; 00029 ros::NodeHandle nh; 00030 00031 bool srvGetSignal(heatmap::signal_service::Request &req, heatmap::signal_service::Response &res) 00032 { 00033 res.signal = ws; 00034 00035 return true; 00036 } 00037 public: 00038 SignalSimulator() : nh() 00039 { 00040 ros::Publisher signal_pub = nh.advertise<heatmap::wifi_signal>("signal", 1000); 00041 ros::ServiceServer service = nh.advertiseService("get_wifi_signal", &SignalSimulator::srvGetSignal, this); 00042 00043 ros::Rate loop_rate(10); 00044 00045 ws.essid = "Sim WIFI"; 00046 ws.link_quality_max = 70; 00047 00048 while(nh.ok()) 00049 { 00050 ws.link_quality = rand() % 71; 00051 signal_pub.publish(ws); 00052 00053 ros::spinOnce(); 00054 loop_rate.sleep(); 00055 } 00056 } 00057 }; 00058 } 00059 00060 int main(int argc, char** argv) 00061 { 00062 ros::init(argc, argv, "signal_meter_sim"); 00063 00064 heatmap::SignalSimulator sig_sim; 00065 00066 return 0; 00067 }