~ubuntu-branches/ubuntu/trusty/libindi/trusty

« back to all changes in this revision

Viewing changes to drivers/focuser/tcfs.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-06-19 10:03:46 UTC
  • mfrom: (1.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20120619100346-ujktpfpl7ic94xjt
Tags: 0.9.1-2ubuntu1
* Resynchronize with Debian. Remaining change:
* Build-depend on libfli-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
{
82
82
        if(dev && strcmp (mydev, dev)) return;
83
83
        ISInit();
84
 
        tcfs->ISNewSwitch(name, states, names, num);
 
84
        tcfs->ISNewSwitch(dev, name, states, names, num);
85
85
}
86
86
 
87
87
void ISNewText( const char *dev, const char *name, char *texts[], char *names[], int num)
88
88
{
89
89
        if(dev && strcmp (mydev, dev)) return;
90
90
        ISInit();
91
 
        tcfs->ISNewText(name, texts, names, num);
 
91
        tcfs->ISNewText(dev, name, texts, names, num);
92
92
}
93
93
 
94
94
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num)
95
95
{
96
96
        if(dev && strcmp (mydev, dev)) return;
97
97
        ISInit();
98
 
        tcfs->ISNewNumber(name, values, names, num);
 
98
        tcfs->ISNewNumber(dev, name, values, names, num);
99
99
}
100
100
 
101
101
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) 
238
238
 
239
239
    if (tty_connect(tProp->tp[0].text, 19200, 8, 0, 1, &fd) != TTY_OK)
240
240
    {
241
 
        ConnectSP->s = IPS_ALERT;
242
 
        IDSetSwitch (ConnectSP, "Error connecting to port %s. Make sure you have BOTH read and write permission to the port.", tProp->tp[0].text);
 
241
        IDMessage(deviceName(), "Error connecting to port %s. Make sure you have BOTH read and write permission to the port.", tProp->tp[0].text);
243
242
        return false;
244
243
    }
245
244
 
251
250
        {
252
251
            if (!strcmp(response, "!"))
253
252
            {
254
 
                setConnected(true, IPS_OK, "Successfully connected to TCF-S Focuser in Manual Mode.");
 
253
                IDMessage(deviceName(), "Successfully connected to TCF-S Focuser in Manual Mode.");
255
254
 
256
255
                IUResetSwitch(FocusModeSP);
257
256
                FocusModeSP->sp[0].s = ISS_ON;
274
273
        usleep(500000);
275
274
    }
276
275
 
277
 
    setConnected(false, IPS_ALERT, "Error connecting to TCF-S focuser...");
 
276
    IDMessage(deviceName(), "Error connecting to TCF-S focuser...");
278
277
    return false;
279
278
 
280
279
}
305
304
**
306
305
**
307
306
*****************************************************************/
308
 
bool TCFS::ISNewNumber (const char *name, double values[], char *names[], int n)
 
307
bool TCFS::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
309
308
{
310
309
 
311
310
  INumberVectorProperty *nProp = getNumber(name);
316
315
  if (isConnected() == false)
317
316
  {
318
317
      resetProperties();
319
 
      IDMessage(deviceID, "TCF-S is offline. Connect before issiung any commands.");
 
318
      IDMessage(deviceName(), "TCF-S is offline. Connect before issiung any commands.");
320
319
      return false;
321
320
  }
322
321
 
354
353
      IDSetNumber(nProp, "Moving focuser to new position %g...", nFocusTargetPosition);
355
354
      return true;
356
355
  }
 
356
 
 
357
  return DefaultDriver::ISNewNumber (dev, name, values, names, n);
357
358
    
358
359
}
359
360
 
361
362
**
362
363
**
363
364
*****************************************************************/
364
 
bool TCFS::ISNewText (const char *name, char *texts[], char *names[], int n)
 
365
bool TCFS::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
365
366
{
366
367
    ITextVectorProperty * tProp = getText(name);
367
368
 
381
382
    }
382
383
 
383
384
 
384
 
    return false;
 
385
    return DefaultDriver::ISNewText(dev, name, texts, names, n);
385
386
        
386
387
}
387
388
 
389
390
**
390
391
**
391
392
*****************************************************************/
392
 
bool TCFS::ISNewSwitch (const char *name, ISState *states, char *names[], int n)
 
393
bool TCFS::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
393
394
{
394
395
 
395
396
    ISwitch *current_active_switch = NULL, *target_active_switch = NULL;
396
397
    // First process parent!
397
 
    if (INDI::DefaultDriver::ISNewSwitch(deviceID, name, states, names, n) == true)
 
398
    if (INDI::DefaultDriver::ISNewSwitch(deviceName(), name, states, names, n) == true)
398
399
        return true;
399
400
 
400
401
    ISwitchVectorProperty *sProp = getSwitch(name);
415
416
    if (isConnected() == false)
416
417
    {
417
418
      resetProperties();
418
 
      IDMessage(deviceID, "TCF-S is offline. Connect before issiung any commands.");
 
419
      IDMessage(deviceName(), "TCF-S is offline. Connect before issiung any commands.");
419
420
      return false;
420
421
    }
421
422
 
662
663
 
663
664
 
664
665
 
665
 
    return false;
 
666
    return DefaultDriver::ISNewSwitch(dev, name, states, names, n);
666
667
}
667
668
 
668
669
bool TCFS::move_focuser(TCFSMotion dir)
929
930
 
930
931
const char * TCFS::getDefaultName()
931
932
{
932
 
    return "TCFS";
 
933
    return mydev;
933
934
}