Example #1
0
BOOL DevLXV7::LXV7DirectLink(PDeviceDescriptor_t d, BOOL bLinkEnable)
{
TCHAR  szTmp[254];
#define CHANGE_DELAY 10

if(LXV7_iGPSBaudrate ==0)
{
  _stprintf(szTmp, TEXT("$PLXV0,BRGPS,R"));
  LXV7NMEAddCheckSumStrg(szTmp);
  d->Com->WriteString(szTmp);
  Sleep(CHANGE_DELAY);
  d->Com->WriteString(szTmp);
  Sleep(CHANGE_DELAY);
}


  if(bLinkEnable)
  {
	LockComm();
	StartupStore(TEXT("enable LX V7 direct Link %s"), NEWLINE);
	LXV7_iPDABaudrate = d->Com->GetBaudrate();

	_stprintf(szTmp, TEXT("$PLXV0,CONNECTION,W,DIRECT"));
	LXV7NMEAddCheckSumStrg(szTmp);
	d->Com->WriteString(szTmp);
	Sleep(CHANGE_DELAY);
    if(LXV7_iPDABaudrate != LXV7_iGPSBaudrate)
    {
	  d->Com->SetBaudrate(LXV7_iGPSBaudrate);
	  StartupStore(TEXT("Set Baudrate %i %s"),LXV7_iGPSBaudrate, NEWLINE);
	  Sleep(CHANGE_DELAY);
    }
	Sleep(CHANGE_DELAY);
  }
  else
  {
	Sleep(CHANGE_DELAY);

    if(LXV7_iPDABaudrate != LXV7_iGPSBaudrate)
    {
	  StartupStore(TEXT("Set Baudrate %i %s"),LXV7_iPDABaudrate, NEWLINE);
	  d->Com->SetBaudrate(LXV7_iPDABaudrate);
	  Sleep(CHANGE_DELAY);
    }

	StartupStore(TEXT("Return from V7 link %s"), NEWLINE);
	_stprintf(szTmp, TEXT("$PLXV0,CONNECTION,W,VSEVEN"));
	LXV7NMEAddCheckSumStrg(szTmp);
	d->Com->WriteString(szTmp);
	Sleep(CHANGE_DELAY);
	UnlockComm();
	Sleep(CHANGE_DELAY);

  }

  return true;
}
Example #2
0
BOOL devIsCondor(PDeviceDescriptor_t d)
{
  BOOL result = FALSE;

  LockComm();
  if ((d != NULL) && (d->IsCondor != NULL))
    result = d->IsCondor(d);
  UnlockComm();

  return result;
}
Example #3
0
BOOL devIsBaroSource(PDeviceDescriptor_t d)
{
  BOOL result = FALSE;

  LockComm();
  if ((d != NULL) && (d->IsBaroSource != NULL))
    result = d->IsBaroSource(d);
  UnlockComm();

  return result;
}
Example #4
0
BOOL PVCOMRequestAllData(PDeviceDescriptor_t d) {
  TCHAR  szTmp[255];
  _stprintf(szTmp, TEXT("$PVCOM,R,ALL"));
  PVCOMNMEAddCheckSumStrg(szTmp);
  LockComm();
  if(d != NULL)
    if(!d->Disabled)
      if (d->Com)
        d->Com->WriteString(szTmp);
  UnlockComm();
  return(TRUE);
}
Example #5
0
BOOL devPutBallast(PDeviceDescriptor_t d, double Ballast)
{
  BOOL result = TRUE;

  if (SIMMODE)
    return TRUE;
  LockComm();
  if (d != NULL && d->PutBallast != NULL)
    result = d->PutBallast(d, Ballast);
  UnlockComm();

  return result;
}
Example #6
0
BOOL devPutMacCready(PDeviceDescriptor_t d, double MacCready)
{
  BOOL result = TRUE;

  if (SIMMODE)
    return TRUE;
  LockComm();
  if (d != NULL && d->PutMacCready != NULL)
    result = d->PutMacCready(d, MacCready);
  UnlockComm();

  return result;
}
Example #7
0
BOOL devPutVolume(PDeviceDescriptor_t d, int Volume)
{
  BOOL result = TRUE;

  if (SIMMODE)
    return TRUE;
  LockComm();
  if (d != NULL && d->PutVolume != NULL)
    result = d->PutVolume(d, Volume);
  UnlockComm();

  return result;
}
Example #8
0
BOOL devPutFreqStandby(PDeviceDescriptor_t d, double Freq)
{
  BOOL result = TRUE;

  if (SIMMODE)
    return TRUE;
  LockComm();
  if (d != NULL && d->PutFreqStandby != NULL)
    result = d->PutFreqStandby(d, Freq);
  UnlockComm();

  return result;
}
Example #9
0
void devWriteNMEAString(PDeviceDescriptor_t d, const TCHAR *text)
{
  TCHAR tmp[512];

  devFormatNMEAString(tmp, 512, text);

  devDirectLink(d,true);
  LockComm();
  if (d->Com)
    d->Com->WriteString(tmp);
  UnlockComm();
  devDirectLink(d,false);
}
Example #10
0
BOOL devPutBugs(PDeviceDescriptor_t d, double Bugs)
{
  BOOL result = TRUE;

  if (SIMMODE)
    return TRUE;
  LockComm();
  if (d != NULL && d->PutBugs != NULL)
    result = d->PutBugs(d, Bugs);
  UnlockComm();

  return result;
}
Example #11
0
BOOL devIsLogger(PDeviceDescriptor_t d)
{
  bool result = false;

  LockComm();
  if ((d != NULL) && (d->IsLogger != NULL)) {
    if (d->IsLogger(d)) {
      result = true;
    }
  }
  if ((d != NULL) && !result) {
    result |= NMEAParser::PortIsFlarm(d->Port);
  }
  UnlockComm();

  return result;
}
Example #12
0
BOOL devPutQNH(DeviceDescriptor_t *d, double NewQNH)
{
  BOOL result = FALSE;

  LockComm();
  if (d == NULL){
    for (int i=0; i<NUMDEV; i++){
      d = &DeviceList[i];
      if (d->PutQNH != NULL)
        d->PutQNH(d, NewQNH);
    }
    result = TRUE;
  } else {
    if (d->PutQNH != NULL)
      result = d->PutQNH(d, NewQNH);
  }
  UnlockComm();

  return result;
}
Example #13
0
BOOL devOnSysTicker(DeviceDescriptor_t *d)
{
  BOOL result = FALSE;

  LockComm();
  if (d == NULL){
    for (int i=0; i<NUMDEV; i++){
      d = &DeviceList[i];
      if (d->OnSysTicker != NULL)
        d->OnSysTicker(d);
    }
    result = TRUE;
  } else {
    if (d->OnSysTicker != NULL)
      result = d->OnSysTicker(d);
  }
  UnlockComm();

  return result;
}
Example #14
0
BOOL DevLX16xx::LX16xxDirectLink(PDeviceDescriptor_t d, BOOL bLinkEnable)
{
TCHAR  szTmp[254];
  if(bLinkEnable)
  {
	LockComm();
	StartupStore(TEXT("enable LX 16xx direct Link %s"), NEWLINE);
	_stprintf(szTmp, TEXT("$PFLX0,COLIBRI"));
	LX16xxNMEAddCheckSumStrg(szTmp);
	d->Com->WriteString(szTmp);
	Sleep(100);
  }
  else
  {
	// exit transfer mode
	// and return to normal LX16xx  communication
	StartupStore(TEXT("return from LX 16xx link %s"), NEWLINE);
	_stprintf(szTmp, TEXT("$PFLX0,LX1600"));
	LX16xxNMEAddCheckSumStrg(szTmp);
	d->Com->WriteString(szTmp);
	unsigned long lOldBR =   d->Com->GetBaudrate();

	/* switch to 4k8 for new Firmware versions of LX1600 */
	d->Com->SetBaudrate(4800);
	Sleep(100);
	d->Com->WriteString(szTmp);
	Sleep(100);
	d->Com->WriteString(szTmp);
	Sleep(100);

	/* return to previous original */
	d->Com->SetBaudrate(lOldBR);
	Sleep(100);
	d->Com->WriteString(szTmp);
	Sleep(100);
	d->Com->WriteString(szTmp);
	Sleep(100);
	UnlockComm();
  }
  return true;
}
Example #15
0
BOOL devDeclare(PDeviceDescriptor_t d, Declaration_t *decl, unsigned errBufferLen, TCHAR errBuffer[])
{
  BOOL result = FALSE;

  if (SIMMODE)
    return TRUE;
  
  const unsigned BUFF_LEN = 128;
  TCHAR buffer[BUFF_LEN];

  // We must be sure we are not going to attempt task declaration
  // while a port reset is already in progress. If this happens, a Flarm device will not be Flarm anymore
  // until a Flarm nmea sentence is parsed again once. 
  
  // LKTOKEN  _@M1400_ = "Task declaration"
  // LKTOKEN  _@M571_ = "START"
  _sntprintf(buffer, BUFF_LEN, _T("%s: %s..."), gettext(_T("_@M1400_")), gettext(_T("_@M571_")));
  CreateProgressDialog(buffer);

  /***********************************************************/
  devDirectLink(d,true);
  /***********************************************************/
  LockComm();

  if ((d != NULL) && (d->Declare != NULL))
	result = d->Declare(d, decl, errBufferLen, errBuffer);
  else {
	if ((d != NULL) && NMEAParser::PortIsFlarm(d->Port)) {
		result |= FlarmDeclare(d, decl, errBufferLen, errBuffer);
	}
  }


  UnlockComm();
  /***********************************************************/
  devDirectLink(d,false);
  /***********************************************************/
  CloseProgressDialog();
  
  return result;
}
Example #16
0
BOOL devLinkTimeout(PDeviceDescriptor_t d)
{
  BOOL result = FALSE;

  if (SIMMODE)
    return TRUE;
  LockComm();
  if (d == NULL){
    for (int i=0; i<NUMDEV; i++){
      d = &DeviceList[i];
      if (d->LinkTimeout != NULL)
        (d->LinkTimeout)(d);
    }
    result = TRUE;
  } else {
    if (d->LinkTimeout != NULL)
      result = d->LinkTimeout(d);
  }
  UnlockComm();

  return result;
}
Example #17
0
BOOL DevLXV7_EXP::LXV7_EXP_DirectLink(PDeviceDescriptor_t d, BOOL bLinkEnable)
{
TCHAR  szTmp[254];
#define CHANGE_DELAY 10

if(LXV7_EXP_iGPSBaudrate ==0)
{
  _stprintf(szTmp, TEXT("$PLXV0,BRGPS,R"));
  LXV7_EXPNMEAddCheckSumStrg(szTmp);
  d->Com->WriteString(szTmp);
  Poco::Thread::sleep(CHANGE_DELAY);
  d->Com->WriteString(szTmp);
  Poco::Thread::sleep(CHANGE_DELAY);
}


  if(bLinkEnable)
  {
	LockComm();
	#if TESTBENCH
	StartupStore(TEXT("V7: enable LX V7 direct Link %s"), NEWLINE);
	#endif
	LXV7_EXP_iPDABaudrate = d->Com->GetBaudrate();

	_stprintf(szTmp, TEXT("$PLXV0,CONNECTION,W,DIRECT"));
	LXV7_EXPNMEAddCheckSumStrg(szTmp);
	d->Com->WriteString(szTmp);
	Poco::Thread::sleep(CHANGE_DELAY);
    if(LXV7_EXP_iPDABaudrate != LXV7_EXP_iGPSBaudrate)
    {
	  d->Com->SetBaudrate(LXV7_EXP_iGPSBaudrate);
	#if TESTBENCH
	  StartupStore(TEXT("V7: Set Baudrate %i %s"),LXV7_EXP_iGPSBaudrate, NEWLINE);
	#endif
	  Poco::Thread::sleep(CHANGE_DELAY);
    }
	Poco::Thread::sleep(CHANGE_DELAY);
  }
  else
  {
	Poco::Thread::sleep(CHANGE_DELAY);

    if(LXV7_EXP_iPDABaudrate != LXV7_EXP_iGPSBaudrate)
    {
	#if TESTBENCH
	  StartupStore(TEXT("V7: Set Baudrate %i %s"),LXV7_EXP_iPDABaudrate, NEWLINE);
	#endif
	  d->Com->SetBaudrate(LXV7_EXP_iPDABaudrate);
	  Poco::Thread::sleep(CHANGE_DELAY);
    }

	#if TESTBENCH
	StartupStore(TEXT("v7: Return from V7 link %s"), NEWLINE);
	#endif
	_stprintf(szTmp, TEXT("$PLXV0,CONNECTION,W,VSEVEN"));
	LXV7_EXPNMEAddCheckSumStrg(szTmp);
	d->Com->WriteString(szTmp);
	Poco::Thread::sleep(CHANGE_DELAY);
	UnlockComm();
	Poco::Thread::sleep(CHANGE_DELAY);

  }

  return true;
}