コード例 #1
0
ファイル: device.c プロジェクト: nafets227/vdr-plugin-satip
bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
{
  debug9("%s (%d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, liveViewP, deviceIndexM);
  if (channelP) {
     cDvbTransponderParameters dtp(channelP->Parameters());
     cString params = GetTransponderUrlParameters(channelP);
     if (isempty(params)) {
        error("Unrecognized channel parameters: %s [device %u]", channelP->Parameters(), deviceIndexM);
        return false;
        }
     cString address;
     cSatipServer *server = cSatipDiscover::GetInstance()->AssignServer(deviceIndexM, channelP->Source(), channelP->Transponder(), dtp.System());
     if (!server) {
        debug9("%s No suitable server found [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
        return false;
        }
     if (pTunerM && pTunerM->SetSource(server, channelP->Transponder(), *params, deviceIndexM)) {
        channelM = *channelP;
        deviceNameM = cString::sprintf("%s %d %s", *DeviceType(), deviceIndexM, *cSatipDiscover::GetInstance()->GetServerString(server));
        return true;
        }
     }
  else if (pTunerM) {
     pTunerM->SetSource(NULL, 0, NULL, deviceIndexM);
     return true;
     }
  return false;
}
コード例 #2
0
ファイル: qcldevice.cpp プロジェクト: jcxz/QtOpenCL
/*!
    Returns the type of this device.  It is possible for a device
    to have more than one type.
*/
QCLDevice::DeviceTypes QCLDevice::deviceType() const
{
    cl_device_type type;
    if (!m_id || clGetDeviceInfo(m_id, CL_DEVICE_TYPE, sizeof(type), &type, 0)
            != CL_SUCCESS)
        return QCLDevice::DeviceTypes(0);
    else
        return QCLDevice::DeviceTypes(DeviceType(type));
}
コード例 #3
0
// -----------------------------------------------------------------------------
// CUpnpDeviceImplementation::AddLocalDeviceL
// -----------------------------------------------------------------------------
//
void CUpnpDeviceImplementation::AddLocalDeviceL()
    {
    GenerateUdnsL(this);
    SaveDescriptionStoreL();
    
    const TPtrC8 uuid = Uuid();
    const TPtrC8 device = DeviceType();
    const TDesC8& url = DescriptionUrl();

    iDispatcher->AddLocalDeviceL( uuid, device, url, ServiceTypesL(), iIsRootDevice );

    delete iPath;
    iPath = NULL;
    iPath = DescriptionUrl().AllocL();
    }
コード例 #4
0
ファイル: device.c プロジェクト: suborb/reelvdr
cSatipDevice::cSatipDevice(unsigned int indexP)
: deviceIndexM(indexP),
  isPacketDeliveredM(false),
  isOpenDvrM(false),
  deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)),
  channelM()
{
  unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE;
  bufsize -= (bufsize % TS_SIZE);
  isyslog("creating SAT>IP device %d (CardIndex=%d)", deviceIndexM, CardIndex());
  tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
                                   *cString::sprintf("SAT>IP TS %d", deviceIndexM));
  if (tsBufferM) {
     tsBufferM->SetTimeouts(100, 100);
     //tsBufferM->SetIoThrottle();
     pTunerM = new cSatipTuner(*this, tsBufferM->Free());
     }
  // Start section handler
  pSectionFilterHandlerM = new cSatipSectionFilterHandler(deviceIndexM, bufsize + 1);
  StartSectionHandler();
}
コード例 #5
0
ファイル: device.c プロジェクト: suborb/reelvdr
bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
{
  if (channelP) {
     cDvbTransponderParameters dtp(channelP->Parameters());
     cString params = GetTransponderUrlParameters(channelP);
     if (isempty(params)) {
        error("Unrecognized SAT>IP channel parameters: %s", channelP->Parameters());
        return false;
        }
     cString address;
     cSatipServer *server = cSatipDiscover::GetInstance()->GetServer(channelP->Source(), dtp.System());
     if (!server) {
        debug("cSatipDevice::%s(%u): no suitable server found", __FUNCTION__, deviceIndexM);
        return false;
        }
     if (pTunerM && pTunerM->SetSource(server, *params, deviceIndexM)) {
        deviceNameM = cString::sprintf("%s %d %s", *DeviceType(), deviceIndexM, *cSatipDiscover::GetInstance()->GetServerString(server));
        channelM = *channelP;
        return true;
        }
     }
  return false;
}
コード例 #6
0
ファイル: device.c プロジェクト: nafets227/vdr-plugin-satip
cSatipDevice::cSatipDevice(unsigned int indexP)
: deviceIndexM(indexP),
  isPacketDeliveredM(false),
  isOpenDvrM(false),
  deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)),
  channelM(),
  createdM(0),
  mutexM()
{
  unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE;
  bufsize -= (bufsize % TS_SIZE);
  info("Creating device CardIndex=%d DeviceNumber=%d [device %u]", CardIndex(), DeviceNumber(), deviceIndexM);
  tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
                                   *cString::sprintf("SATIP#%d TS", deviceIndexM));
  if (tsBufferM) {
     tsBufferM->SetTimeouts(10, 10);
     tsBufferM->SetIoThrottle();
     pTunerM = new cSatipTuner(*this, tsBufferM->Free());
     }
  // Start section handler
  pSectionFilterHandlerM = new cSatipSectionFilterHandler(deviceIndexM, bufsize + 1);
  StartSectionHandler();
}
コード例 #7
0
BOOST_AUTO_TEST_CASE_TEMPLATE( adjacent_difference, DeviceType,
                               DTK_SEARCH_DEVICE_TYPES )
{
    Kokkos::View<int[5], DeviceType> v( "v" );
    auto v_host = Kokkos::create_mirror_view( v );
    v_host( 0 ) = 2;
    v_host( 1 ) = 4;
    v_host( 2 ) = 6;
    v_host( 3 ) = 8;
    v_host( 4 ) = 10;
    Kokkos::deep_copy( v, v_host );
    // In-place operation is not allowed
    BOOST_CHECK_THROW( ArborX::adjacentDifference( v, v ),
                       ArborX::SearchException );
    auto w = Kokkos::create_mirror( DeviceType(), v );
    BOOST_CHECK_NO_THROW( ArborX::adjacentDifference( v, w ) );
    auto w_host = Kokkos::create_mirror_view( w );
    Kokkos::deep_copy( w_host, w );
    std::vector<int> w_ref( 5, 2 );
    BOOST_TEST( w_host == w_ref, tt::per_element() );

    Kokkos::View<float *, DeviceType> x( "x", 10 );
    Kokkos::deep_copy( x, 3.14 );
    BOOST_CHECK_THROW( ArborX::adjacentDifference( x, x ),
                       ArborX::SearchException );
    Kokkos::View<float[10], DeviceType> y( "y" );
    BOOST_CHECK_NO_THROW( ArborX::adjacentDifference( x, y ) );
    std::vector<float> y_ref( 10 );
    y_ref[0] = 3.14;
    auto y_host = Kokkos::create_mirror_view( y );
    Kokkos::deep_copy( y_host, y );
    BOOST_TEST( y_host == y_ref, tt::per_element() );

    Kokkos::resize( x, 5 );
    BOOST_CHECK_THROW( ArborX::adjacentDifference( y, x ),
                       ArborX::SearchException );
}