void ScopeINDI::serverConnected() { // After connection to the server // set option to receive only the messages, no blob setBLOBMode(B_NEVER, INDIMountName.mb_str(wxConvUTF8), NULL); modal = true; // wait for the device port property wxLongLong msec; msec = wxGetUTCTimeMillis(); while ((!scope_port) && wxGetUTCTimeMillis() - msec < 2 * 1000) { ::wxSafeYield(); } // Set the port, this must be done before to try to connect the device if (scope_port && INDIMountPort.Length()) { // the mount port is not mandatory char* porttext = (const_cast<char*>((const char*)INDIMountPort.mb_str())); scope_port->tp->text = porttext; sendNewText(scope_port); } // Connect the mount device connectDevice(INDIMountName.mb_str(wxConvUTF8)); msec = wxGetUTCTimeMillis(); while (modal && wxGetUTCTimeMillis() - msec < 5 * 1000) { ::wxSafeYield(); } modal = false; // In case we not get all the required properties or connection to the device failed if( ready) { Scope::Connect(); } else { Disconnect(); } }
void INDI::BaseClientQt::sendNewText (const char * deviceName, const char * propertyName, const char * elementName, const char * text) { INDI::BaseDevice * drv = getDevice(deviceName); if (drv == NULL) return; ITextVectorProperty * tvp = drv->getText(propertyName); if (tvp == NULL) return; IText * tp = IUFindText(tvp, elementName); if (tp == NULL) return; IUSaveText(tp, text); sendNewText(tvp); }
void Camera_INDIClass::serverConnected() { // After connection to the server // set option to receive blob and messages for the selected CCD setBLOBMode(B_ALSO, INDICameraName.mb_str(wxConvUTF8), INDICameraBlobName.mb_str(wxConvUTF8)); modal = true; // wait for the device port property wxLongLong msec; msec = wxGetUTCTimeMillis(); while ((!camera_port) && wxGetUTCTimeMillis() - msec < 1 * 1000) { ::wxSafeYield(); } // Set the port, this must be done before to try to connect the device if (camera_port && INDICameraPort.Length()) { // the camera port is not mandatory char* porttext = (const_cast<char*>((const char*)INDICameraPort.mb_str())); camera_port->tp->text = porttext; sendNewText(camera_port); } // Connect the camera device connectDevice(INDICameraName.mb_str(wxConvUTF8)); msec = wxGetUTCTimeMillis(); while (modal && wxGetUTCTimeMillis() - msec < 5 * 1000) { ::wxSafeYield(); } modal = false; // In case we not get all the required properties or connection to the device failed if(ready) { Connected = true; m_hasGuideOutput = (pulseGuideNS_prop && pulseGuideEW_prop); } else { pFrame->Alert(_("Cannot connect to camera ")+INDICameraName); Connected = false; Disconnect(); } }
void IndiGui::SetButtonEvent(wxCommandEvent & event) { wxTextCtrl *entry; int i; wxButton *button = (wxButton *)event.GetEventObject(); if (! button) return; IndiProp *indiProp = (IndiProp *) button->GetClientData(); if (! indiProp) return; switch (indiProp->property->getType()) { case INDI_TEXT:{ ITextVectorProperty *tvp = indiProp->property->getText(); for (i = 0; i < tvp->ntp; i++) { if (tvp->p != IP_RO) { entry = (wxTextCtrl *)(indiProp->entry[wxString::FromAscii(tvp->tp[i].name)]); sprintf(tvp->tp[i].text, "%s", entry->GetLineText(0).mb_str().data()); } } sendNewText(tvp); break; } case INDI_NUMBER:{ INumberVectorProperty *nvp = indiProp->property->getNumber(); for (i = 0; i < nvp->nnp; i++) { if (nvp->p != IP_RO) { entry = (wxTextCtrl *)(indiProp->entry[wxString::FromAscii(nvp->np[i].name)]); entry->GetLineText(0).ToDouble(&nvp->np[i].value); } } sendNewNumber(nvp); break; } default:{ } } }