Ejemplo n.º 1
0
bool AAGCloudWatcher::Connect() {
  if (cwc == NULL) {
    ITextVectorProperty *tvp = getText("serial");

    if (!tvp) {
      return false;
    }

  //  IDLog("%s\n", tvp->tp[0].text);

    cwc = new CloudWatcherController(tvp->tp[0].text, false);

    int check = cwc->checkCloudWatcher();

    if (check) {
      IDMessage(getDefaultName(), "Connected to AAG Cloud Watcher\n");

      sendConstants();

      IEAddTimer(1., ISPoll, this);  // Create a timer to send parameters
    } else {
      IDMessage(getDefaultName(), "Could not connect to AAG Cloud Watcher. Check port and / or cable.\n");

      delete cwc;

      cwc = NULL;

      return false;
    }
  }

  return true;
}
Ejemplo n.º 2
0
bool WeatherSafetyProxy::initProperties()
{
    INDI::Weather::initProperties();

    IUFillText(&keywordT[0], "WEATHER_CONDITION", "Weather Condition", "condition");
    IUFillTextVector(&keywordTP, keywordT, 1, getDeviceName(), "KEYWORD", "Keywords", OPTIONS_TAB, IP_RW, 60, IPS_IDLE);

    IUFillText(&ScriptsT[WSP_SCRIPT], "WEATHER_SAFETY_SCRIPT", "Weather safety script", "/usr/local/share/indi/scripts/weather_status.py");
    IUFillTextVector(&ScriptsTP, ScriptsT, WSP_SCRIPT_COUNT, getDefaultName(), "WEATHER_SAFETY_SCRIPTS", "Script", OPTIONS_TAB, IP_RW, 100, IPS_IDLE);

    IUFillText(&UrlT[WSP_URL], "WEATHER_SAFETY_URL", "Weather safety URL", "http://0.0.0.0:5000/weather/safety");
    IUFillTextVector(&UrlTP, UrlT, WSP_URL_COUNT, getDefaultName(), "WEATHER_SAFETY_URLS", "Url", OPTIONS_TAB, IP_RW, 100, IPS_IDLE);

    IUFillSwitch(&ScriptOrCurlS[WSP_USE_SCRIPT], "Use script", "", ISS_ON);
    IUFillSwitch(&ScriptOrCurlS[WSP_USE_CURL], "Use url", "", ISS_OFF);
    IUFillSwitchVector(&ScriptOrCurlSP, ScriptOrCurlS, WSP_USE_COUNT, getDeviceName(), "SCRIPT_OR_CURL", "Script or url", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);

    IUFillNumber(&softErrorHysteresisN[WSP_SOFT_ERROR_MAX], "SOFT_ERROR_MAX", "Max soft errors", "%g", 0.0, 1000.0, 1.0, 30.0);
    IUFillNumber(&softErrorHysteresisN[WSP_SOFT_ERROR_RECOVERY], "SOFT_ERROR_RECOVERY", "Minumum soft error for recovery", "%g", 0.0, 1000.0, 1.0, 7.0);
    IUFillNumberVector(&softErrorHysteresisNP, softErrorHysteresisN, 2, getDeviceName(), "SOFT_ERROR_HYSTERESIS", "Soft error hysterese", OPTIONS_TAB, IP_RW, 0, IPS_IDLE);

    addParameter("WEATHER_SAFETY", "Weather Safety", 0.9, 1.1, 0); // 0 is unsafe, 1 is safe
    setCriticalParameter("WEATHER_SAFETY");

    IUFillText(&reasonsT[0], "Reasons", "", nullptr);
    IUFillTextVector(&reasonsTP, reasonsT, 1, getDeviceName(), "WEATHER_SAFETY_REASONS", "Weather Safety Reasons", MAIN_CONTROL_TAB, IP_RO, 120, IPS_IDLE);

    addDebugControl();

    return true;
}
Ejemplo n.º 3
0
bool DomeScript::initProperties()
{
    INDI::Dome::initProperties();
    SetParkDataType(PARK_AZ);
#if defined(__APPLE__)
    IUFillText(&ScriptsT[0], "FOLDER", "Folder", "/usr/local/share/indi/scripts");
#else
    IUFillText(&ScriptsT[0], "FOLDER", "Folder", "/usr/share/indi/scripts");
#endif
    IUFillText(&ScriptsT[SCRIPT_CONNECT], "SCRIPT_CONNECT", "Connect script", "connect.py");
    IUFillText(&ScriptsT[SCRIPT_DISCONNECT], "SCRIPT_DISCONNECT", "Disconnect script", "disconnect.py");
    IUFillText(&ScriptsT[SCRIPT_STATUS], "SCRIPT_STATUS", "Get status script", "status.py");
    IUFillText(&ScriptsT[SCRIPT_OPEN], "SCRIPT_OPEN", "Open shutter script", "open.py");
    IUFillText(&ScriptsT[SCRIPT_CLOSE], "SCRIPT_CLOSE", "Close shutter script", "close.py");
    IUFillText(&ScriptsT[SCRIPT_PARK], "SCRIPT_PARK", "Park script", "park.py");
    IUFillText(&ScriptsT[SCRIPT_UNPARK], "SCRIPT_UNPARK", "Unpark script", "unpark.py");
    IUFillText(&ScriptsT[SCRIPT_GOTO], "SCRIPT_GOTO", "Goto script", "goto.py");
    IUFillText(&ScriptsT[SCRIPT_MOVE_CW], "SCRIPT_MOVE_CW", "Move clockwise script", "move_cw.py");
    IUFillText(&ScriptsT[SCRIPT_MOVE_CCW], "SCRIPT_MOVE_CCW", "Move counter clockwise script", "move_ccw.py");
    IUFillText(&ScriptsT[SCRIPT_ABORT], "SCRIPT_ABORT", "Abort motion script", "abort.py");
    IUFillTextVector(&ScriptsTP, ScriptsT, SCRIPT_COUNT, getDefaultName(), "SCRIPTS", "Scripts", OPTIONS_TAB, IP_RW, 60,
                     IPS_IDLE);

    setDefaultPollingPeriod(2000);
    return true;
}
std::string NameComponentManager::getName(Entity entity) {
    if(name_component_map.find(entity) != name_component_map.end()) {
        return name_component_map[entity];
    } else {
        return getDefaultName();
    }
}
Ejemplo n.º 5
0
CityServiceFestival::CityServiceFestival( CityPtr city )
: CityService( getDefaultName() ), _d( new Impl )
{
  _d->city = city;
  _d->lastFestivalDate = DateTime( -350, 0, 0 );
  _d->festivalDate = DateTime( -550, 0, 0 );
}
Ejemplo n.º 6
0
    DebugActor::DebugActor(): _frames(0), _startTime(0), _corner(0), _showTexel2PixelErrors(false), _showTouchedActor(false)
    {
        DebugActor::initialize();

        setName(getDefaultName());

        _startTime = getTimeMS();
        setPriority(30000);

        setTouchEnabled(false);

        TextStyle st;
        st.font = NULL;

        if (ResFont* fnt = resSystem->getResFont("system"))
        {
            st.font = fnt->getFont();
        }

        OX_ASSERT(st.font != NULL);

        st.vAlign = TextStyle::VALIGN_TOP;
        //st.color = Color(rand()%255, rand()%255, rand()%255, 255);
        st.color = Color(Color::Black, 255);
        st.multiline = true;
        setWidth(230);
        setHeight(45);

        _bg = new ColorRectSprite;
        _bg->setColor(Color(Color::White, 64));
        _bg->setSize(getSize());
        _bg->setTouchEnabled(false);
        addChild(_bg);


        float x = getWidth();
        addButton(x, "tree", "tree");
        addButton(x, "finger", "finger");
#ifdef OXYGINE_DEBUG_T2P
        addButton(x, "t2p", "t2p");
#endif

#ifdef OXYGINE_DEBUG_TRACE_LEAKS

        addButton(x, "images", "images");
#endif



        _text = new TextField;
        addChild(_text);
        _text->setPosition(2, 5);
        _text->setTouchEnabled(false);
        _text->setStyle(st);
        _text->setWidth(getWidth());
        _text->setText("debug text");


        instance = this;
    }
Ejemplo n.º 7
0
bool ScopeScript::initProperties()
{
    INDI::Telescope::initProperties();

#if defined(__APPLE__)
    IUFillText(&ScriptsT[0], "FOLDER", "Folder", "/usr/local/share/indi/scripts");
#else
    IUFillText(&ScriptsT[0], "FOLDER", "Folder", "/usr/share/indi/scripts");
#endif
    IUFillText(&ScriptsT[SCRIPT_CONNECT], "SCRIPT_CONNECT", "Connect script", "connect.py");
    IUFillText(&ScriptsT[SCRIPT_DISCONNECT], "SCRIPT_DISCONNECT", "Disconnect script", "disconnect.py");
    IUFillText(&ScriptsT[SCRIPT_STATUS], "SCRIPT_STATUS", "Get status script", "status.py");
    IUFillText(&ScriptsT[SCRIPT_GOTO], "SCRIPT_GOTO", "Goto script", "goto.py");
    IUFillText(&ScriptsT[SCRIPT_SYNC], "SCRIPT_SYNC", "Sync script", "sync.py");
    IUFillText(&ScriptsT[SCRIPT_PARK], "SCRIPT_PARK", "Park script", "park.py");
    IUFillText(&ScriptsT[SCRIPT_UNPARK], "SCRIPT_UNPARK", "Unpark script", "unpark.py");
    IUFillText(&ScriptsT[SCRIPT_MOVE_NORTH], "SCRIPT_MOVE_NORTH", "Move north script", "move_north.py");
    IUFillText(&ScriptsT[SCRIPT_MOVE_EAST], "SCRIPT_MOVE_EAST", "Move east script", "move_east.py");
    IUFillText(&ScriptsT[SCRIPT_MOVE_SOUTH], "SCRIPT_MOVE_SOUTH", "Move south script", "move_south.py");
    IUFillText(&ScriptsT[SCRIPT_MOVE_WEST], "SCRIPT_MOVE_WEST", "Move west script", "move_west.py");
    IUFillText(&ScriptsT[SCRIPT_ABORT], "SCRIPT_ABORT", "Abort motion script", "abort.py");
    IUFillTextVector(&ScriptsTP, ScriptsT, SCRIPT_COUNT, getDefaultName(), "SCRIPTS", "Scripts", OPTIONS_TAB, IP_RW, 60,
                     IPS_IDLE);

    addDebugControl();
    setDriverInterface(getDriverInterface());
    return true;
}
Ejemplo n.º 8
0
	DebugActor::DebugActor():_frames(0), _startTime(0), _corner(0), _showTexel2PixelErrors(false), _showTouchedActor(false)
	{
		DebugActor::initialize();

		setName(getDefaultName());

		_startTime = getTimeMS();
		setPriority(1000);

		float scale = 1.0f;
		if (getRoot())
			scale = 1.0f/getRoot()->getScaleX();

		setScale(scale);

		setInputEnabled(false);
		

		TextStyle st;
		st.font = resSystem->getResFont("system")->getFont();
		st.vAlign = TextStyle::VALIGN_TOP;
		//st.color = Color(rand()%255, rand()%255, rand()%255, 255);
		st.color = Color(Color::Black, 255);
		st.multiline = true;
		setWidth(230);
		setHeight(45);

		_bg = new ColorRectSprite;
		_bg->setColor(Color(Color::White, 64));
		_bg->setSize(getSize());
		_bg->setInputEnabled(false);
		addChild(_bg);


		float x = getWidth();
		addButton(x, "tree", "tree");
		addButton(x, "finger", "finger");		
#ifdef OXYGINE_DEBUG_T2P
		addButton(x, "t2p", "t2p");
#endif

#ifdef OXYGINE_DEBUG_TRACE_LEAKS
		
		addButton(x, "images", "images");		
#endif
		
		

		_text = new TextActor;
		addChild(_text);
		_text->setInputEnabled(false);
		_text->setStyle(st);
		_text->setWidth(getWidth());
		_text->setText("debug text");

		getRoot()->addEventListener(TouchEvent::MOVE, CLOSURE(this, &DebugActor::onDAEvent));

		instance = this;
	}
Ejemplo n.º 9
0
RadioSim::RadioSim()
{
	InCapture = false;
DishSize = 5;
Ra = 0;
Dec = FOV_DEG / 2;
    setDeviceName(getDefaultName());
	continuum = (uint8_t*)malloc(sizeof(uint8_t));
}
Ejemplo n.º 10
0
	DeveloperMenu::DeveloperMenu():_resSystem(0)
	{
		setName(getDefaultName());

		setColor(windowColor);

		DebugActor::initialize();
		_resSystem = DebugActor::resSystem;

		setPriority(999);
	}
Ejemplo n.º 11
0
	TreeInspector::TreeInspector():_preview(0), _resSystem(0)
	{	
		setName(getDefaultName());
		
		DebugActor::initialize();
		_resSystem = DebugActor::resSystem;

		setPriority(999);
		//setTouchEnabled(false);
		//setTouchChildrenEnabled(false);
	}
Ejemplo n.º 12
0
//==========================================================================
GPhotoCCD::GPhotoCCD()
{
    // For now let's set name to default name. In the future, we need to to support multiple devices per one driver
    if (*getDeviceName() == '\0')
        strncpy(name, getDefaultName(), MAXINDINAME);
    else
        strncpy(name, getDeviceName(), MAXINDINAME);

    gphotodrv = NULL;
    frameInitialized=false;
    on_off[0] = strdup("On");
    on_off[1] = strdup("Off");

    setVersion(INDI_GPHOTO_VERSION_MAJOR, INDI_GPHOTO_VERSION_MINOR);
}
Ejemplo n.º 13
0
bool AAGCloudWatcher::Disconnect() {
  if (cwc != NULL) {
    resetData();
    resetConstants();

    cwc->setPWMDutyCycle(1);

    delete cwc;

    cwc = NULL;

    IDMessage(getDefaultName(), "Disconnected from AAG Cloud Watcher\n");
  }
  return true;
}
Ejemplo n.º 14
0
/*****************************************************************************
** Process Text properties
*****************************************************************************/
bool AAGCloudWatcher::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) {
	// Ignore if not ours
  if (strcmp (dev, getDefaultName())) {
    return false;
  }

  ITextVectorProperty *tvp = getText(name);

  if (!tvp) {
    return false;
  }

        // Are we updating the serial port
  if (!strcmp(tvp->name, "serial")) {
    IUUpdateText(tvp, texts, names, n);
    tvp->s = IPS_OK;
    IDSetText(tvp, NULL);

    return true;
  }

  return false;
}
Ejemplo n.º 15
0
RadioSim::RadioSim()
{
    InCapture = false;
    DishSize = 5;
    setDeviceName(getDefaultName());
}
Ejemplo n.º 16
0
    DebugActor::DebugActor(): _frames(0), _startTime(0), _showTexel2PixelErrors(false), _showTouchedActor(false), _dragging(false)
    {
        DebugActor::initialize();

        setName(getDefaultName());

        _startTime = getTimeMS();
        setPriority(30000);

        setTouchEnabled(false);

        TextStyle st;
        st.font = NULL;

        if (ResFont* fnt = resSystem->getResFont("mono"))
        {
            st.font = fnt;
        }

        OX_ASSERT(st.font != NULL);

        st.vAlign = TextStyle::VALIGN_TOP;
        st.hAlign = TextStyle::HALIGN_LEFT;
        //st.color = Color(rand()%255, rand()%255, rand()%255, 255);
        st.color = Color(Color::Black, 255);
        st.multiline = true;
        setWidth(230);
        setHeight(45);

        _bg = new ColorRectSprite;
        _bg->setColor(Color(Color::White, 180));
        _bg->setSize(getSize());
        _bg->setTouchEnabled(false);
        addChild(_bg);


        float x = getWidth();
        addButton(x, "tree", "tree");
        addButton(x, "finger", "finger");
#ifdef OXYGINE_DEBUG_T2P
        addButton(x, "t2p", "t2p");
#endif

#ifdef OXYGINE_DEBUG_TRACE_LEAKS

        addButton(x, "images", "images");
#endif



        _text = new TextField;
        addChild(_text);
        _text->setPosition(2, 7);
        _text->setTouchEnabled(false);
        _text->setStyle(st);
        _text->setWidth(getWidth());
        _text->setText("debug text");


        instance = this;
        /*

        float dpi = 0;
        float dpi1 = 0;
        float dpi2 = 0;
        int ret = SDL_GetDisplayDPI(0, &dpi, &dpi1, &dpi2);
        {
            log::messageln("dpi>>>>> %d %f %f %f", ret, dpi, dpi1, dpi2);
        }
        */
    }
Ejemplo n.º 17
0
ScheduleTypeLimits ScheduleTypeRegistrySingleton::getOrCreateScheduleTypeLimits(const ScheduleType& scheduleType,
                                                                                Model& model) const
{
  // if fully specified, try to retrieve
  if (scheduleType.lowerLimitValue && scheduleType.upperLimitValue) {
    ScheduleTypeLimitsVector candidates = model.getConcreteModelObjectsByName<ScheduleTypeLimits>(getDefaultName(scheduleType));
    BOOST_FOREACH(const ScheduleTypeLimits& candidate, candidates) {
      if (isCompatible(scheduleType,candidate)) {
        return candidate;
      }
    }
  }
Ejemplo n.º 18
0
bool AAGCloudWatcher::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) {
	// ignore if not ours //

  if (strcmp (dev, getDefaultName())) {
    return false;
  }

  if (INDI::DefaultDevice::ISNewSwitch(dev, name, states, names, n) == true) {
    return true;
  }

  ISwitchVectorProperty *svp = getSwitch(name);

  if (!svp) {
    return false;
  }

  int error = 0;
  if (!strcmp(svp->name, "deviceSwitch")) {
    char * namesSw[2];
    ISState statesSw[2];
    statesSw[0] = ISS_ON;
    statesSw[1] = ISS_OFF;
    namesSw[0] = const_cast<char *>("open");
    namesSw[1] = const_cast<char *>("close");

    ISState openState;

    if (strcmp(names[0], "open") == 0) {
      openState = states[0];
    } else {
      openState = states[1];
    }

    if (openState == ISS_ON) {
      if (isConnected()) {
        bool r = cwc->openSwitch();

        if (!r) {
          statesSw[0] = ISS_OFF;
          statesSw[1] = ISS_ON;
        }
      } else {
        statesSw[0] = ISS_ON;
        statesSw[1] = ISS_OFF;
        error = 1;
      }
    } else {
      if (isConnected()) {
        bool r = cwc->closeSwitch();

        if (r) {
          statesSw[0] = ISS_OFF;
          statesSw[1] = ISS_ON;
        }
      } else {
        statesSw[0] = ISS_ON;
        statesSw[1] = ISS_OFF;
        error = 1;
      }
    }

    IUUpdateSwitch(svp, statesSw, namesSw, 2);
    if (error) {
      svp->s = IPS_IDLE;
    } else {
      svp->s = IPS_OK;
    }
    IDSetSwitch(svp, NULL);

    return true;
  }

  return DefaultDevice::ISNewSwitch(dev, name, states, names, n);
}
Ejemplo n.º 19
0
const char * INovaCCD::getDeviceName()
{
    return getDefaultName();
}
Ejemplo n.º 20
0
bool AAGCloudWatcher::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) {

  // Ignore if not ours
  if (strcmp (dev, getDefaultName())) {
    return false;
  }

  INumberVectorProperty *nvp = getNumber(name);

  if (!nvp) {
    return false;
  }


  if (!strcmp(nvp->name, "heaterParameters")) {
    for (int i = 0 ; i < 8 ; i++) {
      if ( (strcmp(names[i], "tempLow") == 0) || (strcmp(names[i], "tempHigh") == 0) ) {
        if (values[i] < -50) {
          values[i] = -50;
        } else if (values[i] > 100) {
          values[i] = 100;
        }
      }

      if ( (strcmp(names[i], "deltaHigh") == 0) || (strcmp(names[i], "deltaLow") == 0) ) {
        if (values[i] < 0) {
          values[i] = 0;
        } else if (values[i] > 50) {
          values[i] = 50;
        }
      }

      if ( (strcmp(names[i], "min") == 0) ) {
        if (values[i] < 10) {
          values[i] = 10;
        } else if (values[i] > 20) {
          values[i] = 20;
        }
      }

      if ( (strcmp(names[i], "heatImpulseTemp") == 0) ) {
        if (values[i] < 1) {
          values[i] = 1;
        } else if (values[i] > 30) {
          values[i] = 30;
        }
      }

      if ( (strcmp(names[i], "heatImpulseDuration") == 0) ) {
        if (values[i] < 0) {
          values[i] = 0;
        } else if (values[i] > 600) {
          values[i] = 600;
        }
      }

      if ( (strcmp(names[i], "heatImpulseCycle") == 0) ) {
        if (values[i] < 60) {
          values[i] = 60;
        } else if (values[i] > 1000) {
          values[i] = 1000;
        }
      }
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }


  if (!strcmp(nvp->name, "refresh")) {
    if (values[0] < 10) {
      values[0] = 10;
    }
    if (values[0] > 60) {
      values[0] = 60;
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }

  if (!strcmp(nvp->name, "skyCorrection")) {
    for (int i = 0 ; i < 5 ; i++) {
      if (values[i] < -999) {
        values[i] = -999;
      }
      if (values[i] > 999) {
        values[i] = 999;
      }
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }

  if (!strcmp(nvp->name, "limitsCloud")) {
    for (int i = 0 ; i < n ; i++) {
      if (values[i] < -50) {
        values[i] = -50;
      }
      if (values[i] > 100) {
        values[i] = 100;
      }
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }

  if (!strcmp(nvp->name, "limitsRain")) {
    for (int i = 0 ; i < n ; i++) {
      if (values[i] < 0) {
        values[i] = 0;
      }
      if (values[i] > 100000) {
        values[i] = 100000;
      }
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }

  if (!strcmp(nvp->name, "limitsBrightness")) {
    for (int i = 0 ; i < n ; i++) {
      if (values[i] < 0) {
        values[i] = 0;
      }
      if (values[i] > 1000000) {
        values[i] = 1000000;
      }
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }
  
  if (!strcmp(nvp->name, "limitsWind")) {
    for (int i = 0 ; i < n ; i++) {
      if (values[i] < 0) {
        values[i] = 0;
      }
      if (values[i] > 100) {
        values[i] = 100;
      }
    }

    IUUpdateNumber(nvp, values, names, n);
    nvp->s = IPS_OK;
    IDSetNumber(nvp, NULL);

    return true;
  }

  return false;
}