Beispiel #1
0
/* Read current conditions and fill in info structure */
void
metar_start_open (WeatherInfo *info)
{
    WeatherLocation *loc;
    SoupMessage *msg;

    g_return_if_fail (info != NULL);
    info->valid = info->network_error = FALSE;
    loc = info->location;
    if (loc == NULL) {
	g_warning (_("WeatherInfo missing location"));
	return;
    }

    msg = soup_form_request_new (
	"GET", "https://www.aviationweather.gov/adds/dataserver_current/httpparam",
	"dataSource", "metars",
	"requestType", "retrieve",
	"format", "xml",
	"hoursBeforeNow", "3",
	"mostRecent", "true",
	"fields", "raw_text",
	"stationString", loc->code,
	NULL);
    soup_session_queue_message (info->session, msg, metar_finish, info);

    info->requests_pending++;
}
Beispiel #2
0
void
snra_client_set_language (SnraClient * client, const gchar *language_code)
{
  gchar *uri;
  SoupMessage *soup_msg;
  uri = g_strdup_printf ("http://%s:%u/control/language",
      client->connected_server, client->connected_port);
  soup_msg = soup_form_request_new ("POST", uri, "language", language_code,
      NULL);
  soup_session_queue_message (client->soup, soup_msg, NULL, NULL);
  g_free (uri);
}
Beispiel #3
0
void
aur_client_set_language (AurClient * client, const gchar * language_code)
{
  gchar *uri;
  SoupMessage *soup_msg;
  uri = g_strdup_printf ("http://%s:%u/control/language",
      client->connected_server, client->connected_port);
  soup_msg = soup_form_request_new ("POST", uri, "language", language_code,
      NULL);
  aur_client_submit_msg (client, soup_msg);
  g_free (uri);
}
Beispiel #4
0
static SoupMessage* prepare_message_to_put (OGDProvider *provider, gchar *query, GHashTable *data)
{
    gchar *complete_query;
    SoupMessage *msg;

    complete_query = g_strdup_printf ("%s%s", provider->priv->access_url, query);

    if (data != NULL)
        msg = soup_form_request_new_from_hash ("POST", complete_query, data);
    else
        msg = soup_form_request_new ("POST", complete_query, NULL, NULL);

    g_free (complete_query);
    return msg;
}
Beispiel #5
0
void
snra_client_set_volume (SnraClient * client, gdouble volume)
{
  SoupMessage *soup_msg;
  gchar volume_str[G_ASCII_DTOSTR_BUF_SIZE];
  gchar *uri;

  uri = g_strdup_printf ("http://%s:%u/control/volume",
      client->connected_server, client->connected_port);
  g_ascii_dtostr (volume_str, sizeof (volume_str), volume);
  soup_msg = soup_form_request_new ("POST", uri, "level", volume_str, NULL);
  soup_session_queue_message (client->soup, soup_msg, NULL, NULL);

  g_free (uri);
}
Beispiel #6
0
void
snra_client_set_media (SnraClient * client, const gchar * id)
{
  SoupMessage *soup_msg;
  gchar *uri = g_strdup_printf ("http://%s:%u/control/next",
      client->connected_server, client->connected_port);

  if (id)
    soup_msg = soup_form_request_new ("POST", uri, "id", id, NULL);
  else
    soup_msg = soup_message_new ("GET", uri);

  soup_session_queue_message (client->soup, soup_msg, NULL, NULL);
  g_free (uri);
}
Beispiel #7
0
void
aur_client_set_media (AurClient * client, const gchar * id)
{
  SoupMessage *soup_msg;
  gchar *uri = g_strdup_printf ("http://%s:%u/control/next",
      client->connected_server, client->connected_port);

  if (id)
    soup_msg = soup_form_request_new ("POST", uri, "id", id, NULL);
  else
    soup_msg = soup_message_new ("GET", uri);

  aur_client_submit_msg (client, soup_msg);

  g_free (uri);
}
Beispiel #8
0
void
snra_client_seek (SnraClient * client, GstClockTime position)
{
  SoupMessage *soup_msg;
  gchar *position_str;
  gchar *uri;

  uri = g_strdup_printf ("http://%s:%u/control/seek",
      client->connected_server, client->connected_port);
  position_str = g_strdup_printf ("%" G_GUINT64_FORMAT, position);
  soup_msg = soup_form_request_new ("POST", uri, "position", position_str,
      NULL);
  soup_session_queue_message (client->soup, soup_msg, NULL, NULL);

  g_free (position_str);
  g_free (uri);
}
Beispiel #9
0
void
snra_client_set_player_enabled (SnraClient * client, guint id,
    gboolean enabled)
{
  gchar *uri;
  gchar *id_str;
  SoupMessage *soup_msg;

  uri = g_strdup_printf ("http://%s:%u/control/setclient",
      client->connected_server, client->connected_port);
  id_str = g_strdup_printf ("%u", id);
  soup_msg = soup_form_request_new ("POST", uri, "client_id", id_str, "enable",
      enabled ? "1" : "0", NULL);
  soup_session_queue_message (client->soup, soup_msg, NULL, NULL);

  g_free (id_str);
  g_free (uri);
}
Beispiel #10
0
void
aur_client_set_player_volume (AurClient * client, guint id, gdouble volume)
{
  gchar *uri;
  gchar volume_str[G_ASCII_DTOSTR_BUF_SIZE];
  gchar *id_str;
  SoupMessage *soup_msg;

  uri = g_strdup_printf ("http://%s:%u/control/volume",
      client->connected_server, client->connected_port);
  id_str = g_strdup_printf ("%u", id);
  g_ascii_dtostr (volume_str, sizeof (volume_str), volume);
  soup_msg = soup_form_request_new ("POST", uri, "client_id", id_str, "level",
      volume_str, NULL);
  aur_client_submit_msg (client, soup_msg);

  g_free (id_str);
  g_free (uri);
}
/* Read current conditions and fill in info structure */
void
metar_start_open (WeatherInfo *info)
{
    WeatherLocation *loc;
    SoupMessage *msg;

    g_return_if_fail (info != NULL);
    info->valid = info->network_error = FALSE;
    loc = info->location;
    if (loc == NULL) {
	g_warning (_("WeatherInfo missing location"));
	return;
    }

    msg = soup_form_request_new (
	"GET", "http://weather.noaa.gov/cgi-bin/mgetmetar.pl",
	"cccc", loc->code,
	NULL);
    soup_session_queue_message (info->session, msg, metar_finish, info);

    info->requests_pending++;
}
Beispiel #12
0
/* Read current conditions and fill in info structure */
void
metar_start_open (GWeatherInfo *info)
{
    GWeatherInfoPrivate *priv;
    WeatherLocation *loc;
    SoupMessage *msg;

    g_return_if_fail (info != NULL);

    priv = info->priv;

    priv->valid = priv->network_error = FALSE;
    loc = &priv->location;

    msg = soup_form_request_new (
	"GET", "http://weather.noaa.gov/cgi-bin/mgetmetar.pl",
	"cccc", loc->code,
	NULL);
    soup_session_queue_message (priv->session, msg, metar_finish, info);

    priv->requests_pending++;
}