示例#1
0
// Load a station file as used by the tomography code
stations *readStationList(char *filename)
{
	stations *ss;
	int j;
	FILE *in;

	float lon, lat, alt;
	char name[200], net[200];

	ss = malloc(sizeof(stations));
	ss->n = 0;
	ss->slist = NULL;

	in = fopen(filename, "r");
	if (in == NULL)
		return ss;

	j = fscanf(in, "%f\t%f\t%f\t%s\t%s", &lon, &lat, &alt, name, net);
	while (j == 5) {
		station *s = newStation(lon, lat, alt, name, net);
		if (s == NULL)
			return NULL;
		addss(ss, s);

		j = fscanf(in, "%f\t%f\t%f\t%s\t%s", &lon, &lat, &alt, name, net);
	}

	fclose(in);
	return ss;
}
示例#2
0
RadioView::RadioView(QWidget *parent) : MPDSongView(parent) {
	Q_ASSERT(m_menu);
	setObjectName("radioview");
	setHeaderView(new RadiolistHeader(this));

	m_menu->addSeparator();
	m_addAction = addMenuAction("newStationAction", this, SLOT(newStation()), false);
	m_deleteAction = addMenuAction("deleteAction", this, SLOT(deleteStation()));
	m_deleteAction->setShortcut(Qt::Key_Delete);
	m_deleteAction->setShortcutContext(Qt::WidgetShortcut);
	addAction(m_deleteAction); // Needed for shortcut key to work

	connect(MPDConnection::instance(), SIGNAL(connected(const ServerInfo &)), this, SLOT(connected()));
	connect(MPDConnection::instance(), SIGNAL(disconnected(const QString &)), this, SLOT(disconnected()));
}
示例#3
0
void ProbeStore::probeRequest(ProbeRequestP_t pr)
{
    assert(pr);

    if (! m_keepBroadcast && pr->SSID == "Broadcast")
        return;

    StationMap_t::iterator it = m_store.find(pr->mac);
    StationPtr_t sta;

    if (it != m_store.end())
    {
        sta = it.value();
    }
    else
    {
        sta = StationPtr_t(new Station(pr->mac));
        m_store.insert(pr->mac, sta);
        emit newStation();
    }

    sta->addSSID(pr->SSID);
    emit newSSID(sta->getMac());
}
示例#4
0
void MumbleClient::processUserState(quint8 *message, quint64 size)
{

    MumbleProto::UserState us;
    us.ParseFromArray(message,size);
    if((_session_id==-1) && (us.has_channel_id()))
    {
        _channel_id = us.channel_id();
        qDebug() << " Joined channel: " << _channel_id;

    }
    if(us.session() == _session_id)
    {
        if(us.has_channel_id())
        {
            _channel_id = us.channel_id();
            qDebug() << " Joined channel: " << _channel_id;
            if(_channel_id > 1)
            {
                emit channelReady(_channel_id);
            }
        }
        for(int i=0; i < _stations.size(); i++)
        {
            Station *s = _stations.at(i);
            if(s->_id == _session_id)
            {

                delete s;
                s = NULL;
                _stations.remove(i);
            }
        }
    }
    else
    {
        bool set_station = false;
        for(int i=0; i < _stations.size(); i++)
        {
            Station *s = _stations.at(i);
            if(s->_id == us.session())
            {
                s->_conference_id = us.channel_id();

                if(us.has_self_mute())
                    s->_mute = us.self_mute();
                if(us.has_deaf())
                    s->_deaf = us.self_deaf();
                if(us.has_comment())
                    s->_callsign = QString::fromStdString(us.comment());
                set_station = true;
            }
        }
        if(!set_station)
        {
            Station *s = new Station;
            s->_id = us.session();
            s->_radio_id = QString::fromStdString(us.name());
            s->_conference_id = us.channel_id();

            if(us.has_self_mute())
                s->_mute = us.self_mute();
            if(us.has_deaf())
                s->_deaf = us.self_deaf();
            if(us.has_comment())
                s->_callsign = QString::fromStdString(us.comment());
            _stations.push_back(s);
            emit newStation(s);
        }
    }
    /* Just debug code
    for(int i = 0;i < _stations.size();i++)
    {
        Station *s = _stations.at(i);
        qDebug() << "Session: " << QString::number(s->_id)
                 << " radio_id: " << s->_radio_id << " channel: "
                 << QString::number(s->_conference_id) << s->_callsign;
    }
    */

    StationList sl;
    for(int i =0; i<_stations.size(); ++i)
    {
        sl.append(*(_stations.at(i)));
    }
    emit onlineStations(sl);

}