static int _s52_updTimeTag (s52engine *engine) { (void)engine; // fake one AIS if (NULL != _vessel_ais) { gchar str[80]; GTimeVal now; static double hdg = 0.0; hdg = (hdg >= 359.0) ? 0.0 : hdg+1; // fake rotating hdg g_get_current_time(&now); g_sprintf(str, "%s %lis", VESSELLABEL, now.tv_sec); S52_setVESSELlabel(_vessel_ais, str); S52_pushPosition(_vessel_ais, engine->state.cLat - 0.01, engine->state.cLon + 0.01, hdg); S52_setVector(_vessel_ais, 1, hdg, 16.0); // ground #ifdef S52_USE_AFGLOW // stay at the same place but fill internal S52 buffer - in the search for possible leak S52_pushPosition(_vessel_ais_afglow, engine->state.cLat, engine->state.cLon, 0.0); #endif } return TRUE; }
static int _setAISVec (unsigned int mmsi, double course, double speed) { _ais_t *ais = _getAIS(mmsi); if (NULL == ais) return FALSE; int vecstb = 1; // overground // ground vector (since AIS transmit the GPS) ais->course = course; ais->speed = speed; #ifdef S52_USE_SOCK _encodeNsend("S52_setVector", "%lu,%i,%lf,%lf", ais->vesselH, vecstb, course, speed); #else // FIXME: test ship's head up setView() S52_setVector(ais->vesselH, vecstb, course, speed); #endif #ifdef S52_USE_DBUS _signal_setVector(_dbus, ais->vesselH, 1, course, speed); #endif g_get_current_time(&ais->lastUpdate); return TRUE; }
static int _s52_setupOWNSHP(s52droid_state_t *state) { _ownshp = S52_newOWNSHP(OWNSHPLABEL); //_ownshp = S52_setDimension(_ownshp, 150.0, 50.0, 0.0, 30.0); //_ownshp = S52_setDimension(_ownshp, 150.0, 50.0, 15.0, 15.0); //_ownshp = S52_setDimension(_ownshp, 100.0, 100.0, 0.0, 15.0); //_ownshp = S52_setDimension(_ownshp, 100.0, 0.0, 15.0, 0.0); _ownshp = S52_setDimension(_ownshp, 0.0, 100.0, 15.0, 0.0); //_ownshp = S52_setDimension(_ownshp, 1000.0, 50.0, 15.0, 15.0); S52_pushPosition(_ownshp, state->cLat - 0.02, state->cLon - 0.01, 180.0 + 045.0); S52_setVector(_ownshp, 0, 220.0, 6.0); // ownship use S52_MAR_VECSTB return TRUE; }
static int _s52_setupVESSEL(s52droid_state_t *state) { // ARPA //_vessel_arpa = S52_newVESSEL(1, dummy, "ARPA label"); //_vessel_arpa = S52_newVESSEL(1, "ARPA label"); //S52_pushPosition(_vessel_arpa, _engine.state.cLat + 0.01, _engine.state.cLon - 0.02, 045.0); //S52_setVector(_vessel_arpa, 2, 060.0, 3.0); // water // AIS active _vessel_ais = S52_newVESSEL(2, NULL); S52_setDimension(_vessel_ais, 100.0, 100.0, 15.0, 15.0); //S52_pushPosition(_vessel_ais, _engine.state.cLat - 0.02, _engine.state.cLon + 0.02, 045.0); //S52_pushPosition(_vessel_ais, state->cLat - 0.04, state->cLon + 0.04, 045.0); S52_pushPosition(_vessel_ais, state->cLat - 0.01, state->cLon + 0.01, 045.0); S52_setVector(_vessel_ais, 1, 060.0, 16.0); // ground // (re) set label S52_setVESSELlabel(_vessel_ais, VESSELLABEL); int vesselSelect = 0; // OFF int vestat = 1; int vesselTurn = VESSELTURN_UNDEFINED; S52_setVESSELstate(_vessel_ais, vesselSelect, vestat, vesselTurn); // AIS sleeping //_vessel_ais = S52_newVESSEL(2, 2, "MV Non Such - sleeping");); //S52_pushPosition(_vessel_ais, _engine.state.cLat - 0.02, _engine.state.cLon + 0.02, 045.0); // VTS (this will not draw anything!) //_vessel_vts = S52_newVESSEL(3, dummy); #ifdef S52_USE_AFGLOW // afterglow _vessel_ais_afglow = S52_newMarObj("afgves", S52_LINES, MAX_AFGLOW_PT, NULL, NULL); #endif return TRUE; }