/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#include "multi_format_msg_sink_impl.h"
namespace gr {
namespace satnogs {
multi_format_msg_sink::sptr
multi_format_msg_sink::make(size_t format)
{
return gnuradio::get_initial_sptr
(new multi_format_msg_sink_impl(format));
}
void
multi_format_msg_sink_impl::msg_handler (pmt::pmt_t msg)
{
std::string s((const char *)pmt::blob_data(msg), pmt::blob_length(msg));
switch(d_format){
case 0:
std::cout << "Received text sequence:" << s << " " << std::endl;
break;
case 1:
//for(size_t i=0; i< pmt::blob_length(msg); i++)
for (size_t i = 0; i < s.length(); ++i)
printf("0x%02x ",s[i]);
std::cout<(((uint8_t*)pmt::blob_data(msg))[i]);
std::cout<