Exemplo n.º 1
0
static int           _setAISLab (unsigned int mmsi, const char *name)
// update AIS label
{
    // debug
    //if (316006302 == mmsi)
    //    g_print("s52ais:_setAISLab(): mmsi:%i name:[%s]\n", mmsi, name);

    _ais_t *ais = _getAIS(mmsi);
    if (NULL == ais)
        return FALSE;

    if (NULL != name) {
        g_snprintf(ais->name, AIS_SHIPNAME_MAXLEN+1, "%s", name);

#ifdef S52_USE_SOCK
        _encodeNsend("S52_setVESSELlabel", "%lu,\"%s\"", ais->vesselH, name);
#else
        S52_setVESSELlabel(ais->vesselH, name);
#endif

#ifdef S52_USE_DBUS
        _signal_setVESSELlabel(_dbus, ais->vesselH, ais->name);
#endif
    }

    g_get_current_time(&ais->lastUpdate);

    return TRUE;
}
Exemplo n.º 2
0
static int           _setAISPos (unsigned int mmsi, double lat, double lon, double heading)
{
    _ais_t *ais = _getAIS(mmsi);
    if (NULL == ais)
        return FALSE;

#ifdef S52_USE_SOCK
    _encodeNsend("S52_pushPosition", "%lu,%lf,%lf,%lf", (long unsigned int *)ais->vesselH, lat, lon, heading);
#else
    S52_pushPosition(ais->vesselH, lat, lon, heading);
#endif

#ifdef S52_USE_AFGLOW
#ifdef S52_USE_SOCK
    _encodeNsend("S52_pushPosition", "%lu,%lf,%lf,%lf", (long unsigned int *)ais->afglowH, lat, lon, heading);
#else
    S52_pushPosition(ais->afglowH, lat, lon, 0.0);
#endif
#endif

#ifdef S52_USE_DBUS
    _signal_setPosition   (_dbus, ais->vesselH, lat, lon, heading);
    _signal_setVESSELlabel(_dbus, ais->vesselH, ais->name);
#endif

    g_get_current_time(&ais->lastUpdate);

    return TRUE;
}
Exemplo n.º 3
0
static int           _setAISLab (unsigned int mmsi, const char *name)
// update AIS label
{
    _ais_t *ais = _getAIS(mmsi);
    if (NULL == ais)
        return FALSE;

    if (NULL != name) {
        g_snprintf(ais->name, AIS_SHIPNAME_MAXLEN, "%s", name);

#ifdef S52_USE_DBUS
        _signal_setVESSELlabel(_dbus, ais->vesselH, ais->name);
#endif
    }

    g_get_current_time(&ais->lastUpdate);

    return TRUE;
}