Exemple #1
0
bool
DeviceConfig::IsAvailable() const
{
    switch (port_type) {
    case PortType::DISABLED:
        return false;

    case PortType::SERIAL:
        return true;

    case PortType::RFCOMM:
        return IsAndroid();

    case PortType::IOIOUART:
        return IsAndroid() && HasIOIOLib();

    case PortType::AUTO:
        return IsWindowsCE();

    case PortType::INTERNAL:
        return IsAndroid();

    case PortType::TCP_LISTENER:
        return true;
    }

    /* unreachable */
    return false;
}
Exemple #2
0
bool
TTYPort::Open(const TCHAR *path, unsigned _baud_rate)
{
  if (IsAndroid()) {
    /* attempt to give the XCSoar process permissions to access the
       USB serial adapter; this is mostly relevant to the Nook */
    TCHAR command[MAX_PATH];
    StringFormat(command, MAX_PATH, "su -c 'chmod 666 %s'", path);
    system(command);
  }

  if (!tty.OpenNonBlocking(path)) {
    LogErrno(_T("Failed to open port '%s'"), path);
    return false;
  }

  baud_rate = _baud_rate;
  if (!SetBaudrate(baud_rate))
    return false;

  valid.store(true, std::memory_order_relaxed);
  io_thread->LockAdd(tty.ToFileDescriptor(), Poll::READ, *this);
  StateChanged();
  return true;
}
Exemple #3
0
static DeviceConfig::PortType
StringToPortType(const TCHAR *value)
{
    if (_tcscmp(value, _T("disabled")) == 0)
        return DeviceConfig::PortType::DISABLED;

    if (_tcscmp(value, _T("serial")) == 0)
        return DeviceConfig::PortType::SERIAL;

    if (_tcscmp(value, _T("rfcomm")) == 0)
        return DeviceConfig::PortType::RFCOMM;

    if (_tcscmp(value, _T("ioio_uart")) == 0)
        return DeviceConfig::PortType::IOIOUART;

    if (_tcscmp(value, _T("auto")) == 0)
        return DeviceConfig::PortType::AUTO;

    if (_tcscmp(value, _T("internal")) == 0)
        return DeviceConfig::PortType::INTERNAL;

    if (_tcscmp(value, _T("tcp_listener")) == 0)
        return DeviceConfig::PortType::TCP_LISTENER;

    if (IsAndroid())
        return DeviceConfig::PortType::INTERNAL;

    return DeviceConfig::PortType::SERIAL;
}
Exemple #4
0
gcc_const
static inline const TCHAR *
GetStandardMonospaceFontFace()
{
  if (IsAndroid())
    return _T("Droid Sans Mono");

  return _T("Courier");
}
Exemple #5
0
static void
InitialiseLogFonts()
{
  if (IsAltair()) {
    LoadAltairLogFonts();
    return;
  }

#ifndef USE_GDI
  UPixelScalar font_height = Layout::SmallScale(IsAndroid() ? 30 : 24);
#else
  UPixelScalar font_height = Layout::SmallScale(35);
#endif

  // oversize first so can then scale down
  InitialiseLogfont(&log_infobox, GetStandardFontFace(),
                    (int)(font_height * 1.4), true, false, true);

#ifdef WIN32
  log_infobox.lfCharSet = ANSI_CHARSET;
#endif

  InitialiseLogfont(&log_title, GetStandardFontFace(), font_height / 3);

  // new font for CDI Scale
  InitialiseLogfont(&log_cdi, GetStandardFontFace(),
                    UPixelScalar(font_height * 0.6), false, false, false);

  // new font for map labels
  InitialiseLogfont(&log_map_label, GetStandardFontFace(),
                    UPixelScalar(font_height * 0.39), false, true);

  // new font for map labels big/medium cities
  InitialiseLogfont(&log_map_label_important, GetStandardFontFace(),
                    UPixelScalar(font_height * 0.39), false, true);

  // new font for map labels
  InitialiseLogfont(&log_map, GetStandardFontFace(),
                    UPixelScalar(font_height * 0.507));

  // Font for map bold text
  InitialiseLogfont(&log_map_bold, GetStandardFontFace(),
                    UPixelScalar(font_height * 0.507), true);

  InitialiseLogfont(&log_infobox_small, GetStandardFontFace(),
                    Layout::Scale(20));

#ifndef GNAV
  InitialiseLogfont(&log_infobox_units, GetStandardFontFace(),
                    (int)(font_height * 0.56));
#endif

  InitialiseLogfont(&log_monospace, GetStandardMonospaceFontFace(),
                    UPixelScalar(font_height * 0.39), false, false, false);
}
Exemple #6
0
/**
 * Does this device have a cursor keys?  These may be used to navigate
 * in modal dialogs.  Without cursor keys, focused controls do not
 * need to be highlighted.
 */
constexpr
static inline bool
HasCursorKeys()
{
  /* we assume that all Windows (CE) devices have cursor keys; some do
     not, but that's hard to detect */

  /* TODO: check Configuration.keyboard on Android */

  return !IsKobo() && !IsAndroid();
}
Exemple #7
0
gcc_const
static inline const TCHAR *
GetStandardFontFace()
{
  if (IsAltair())
    return _T("RasterGothicFourteenCond");

  if (IsAndroid())
    return _T("Droid Sans");

  return _T("Tahoma");
}
 // todo(jonahr): Eventually could add support for all conditions/operating
 // systems, but these are the ones in use for now
 void validateConfigBase(const GPUTestConfig &config)
 {
     EXPECT_EQ(IsWindows(), config.getConditions()[GPUTestConfig::kConditionWin]);
     EXPECT_EQ(IsOSX(), config.getConditions()[GPUTestConfig::kConditionMac]);
     EXPECT_EQ(IsLinux(), config.getConditions()[GPUTestConfig::kConditionLinux]);
     EXPECT_EQ(IsAndroid(), config.getConditions()[GPUTestConfig::kConditionAndroid]);
     EXPECT_EQ(IsNexus5X(), config.getConditions()[GPUTestConfig::kConditionNexus5X]);
     EXPECT_EQ(IsPixel2(), config.getConditions()[GPUTestConfig::kConditionPixel2]);
     EXPECT_EQ(IsIntel(), config.getConditions()[GPUTestConfig::kConditionIntel]);
     EXPECT_EQ(IsAMD(), config.getConditions()[GPUTestConfig::kConditionAMD]);
     EXPECT_EQ(IsNVIDIA(), config.getConditions()[GPUTestConfig::kConditionNVIDIA]);
     EXPECT_EQ(IsDebug(), config.getConditions()[GPUTestConfig::kConditionDebug]);
     EXPECT_EQ(IsRelease(), config.getConditions()[GPUTestConfig::kConditionRelease]);
 }
Exemple #9
0
static DeviceConfig::PortType
ReadPortType(unsigned n)
{
    TCHAR name[64], value[64];

    MakeDeviceSettingName(name, _T("Port"), n, _T("Type"));
    if (!Profile::Get(name, value, ARRAY_SIZE(value)))
        return n == 0
               ? (IsAndroid()
                  ? DeviceConfig::PortType::INTERNAL
                  : DeviceConfig::PortType::SERIAL)
               : DeviceConfig::PortType::DISABLED;

    return StringToPortType(value);
}
Exemple #10
0
constexpr
static inline bool
HasTouchScreen()
{
  return IsAndroid() || (IsWindowsCE() && !IsAltair()) || IsKobo() || IsIOS();
}
Exemple #11
0
/**
 * Returns whether the application is running on an embedded platform.
 * @return True if host hardware is an embedded platform, False otherwise
 */
constexpr
static inline bool
IsEmbedded()
{
  return IsAndroid() || IsWindowsCE() || IsKobo() || IsIOS();
}
Exemple #12
0
constexpr
static inline bool
HasTouchScreen()
{
  return IsAndroid() || IsKobo() || IsIOS();
}
Exemple #13
0
bool
HasTouchScreen()
{
    return IsAndroid() || IsKobo() || IsIOS();
}
Exemple #14
0
/**
 * Does this device have a touch screen?  This is useful to know for
 * sizing controls, as a touch screen may require bigger areas.
 */
gcc_constexpr_function
static inline bool
HasTouchScreen()
{
  return IsAndroid() || (IsWindowsCE() && !IsAltair());
}