Esempio n. 1
0
//---------------------------------------------------------------------
const String& RenderSystem::_getDefaultViewportMaterialScheme( void ) const
{
#ifdef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
    if ( !(getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION)) )
    {
        // I am returning the exact value for now - I don't want to add dependency for the RTSS just for one string
        static const String ShaderGeneratorDefaultScheme = "ShaderGeneratorDefaultScheme";
        return ShaderGeneratorDefaultScheme;
    }
    else
#endif
    {
        return MaterialManager::DEFAULT_SCHEME_NAME;
    }
}
std::vector<AVPixelFormat> VideoCaptureBase::getSupportedPixelFormats(int device, int width, int height) {
  std::vector<enum AVPixelFormat> result;
  std::vector<AVCapability> caps = getCapabilities(device);
 
  for(std::vector<AVCapability>::iterator it = caps.begin(); it != caps.end(); ++it) {
    AVCapability& cap = *it;
    if(cap.size.width == width && cap.size.height == height) {
      std::vector<AVPixelFormat>::iterator it_found = std::find(result.begin(), result.end(), cap.pixel_format);
      if(it_found == result.end()) {
        result.push_back(cap.pixel_format);
      }
    }
  }
 
  return result;
}
Esempio n. 3
0
void writeGetCapabilities( QgsServerInterface* serverIface, const QString& version,
                           const QgsServerRequest& request, QgsServerResponse& response,
                           bool projectSettings )
{
    QString configFilePath = serverIface->configFilePath();
    QgsCapabilitiesCache* capabilitiesCache = serverIface->capabilitiesCache();

    QStringList cacheKeyList;
    cacheKeyList << ( projectSettings ? QStringLiteral( "projectSettings" ) : version );
    cacheKeyList << request.url().host();
    bool cache = true;

#ifdef HAVE_SERVER_PYTHON_PLUGINS
    QgsAccessControl* accessControl = serverIface->accessControls();
    if ( accessControl )
        cache = accessControl->fillCacheKey( cacheKeyList );
#endif

    QString cacheKey = cacheKeyList.join( QStringLiteral( "-" ) );
    const QDomDocument* capabilitiesDocument = capabilitiesCache->searchCapabilitiesDocument( configFilePath, cacheKey );
    if ( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one
    {
        QgsMessageLog::logMessage( QStringLiteral( "Capabilities document not found in cache" ) );
        QDomDocument doc;

        doc = getCapabilities( serverIface, version, request, projectSettings );

        if ( cache )
        {
            capabilitiesCache->insertCapabilitiesDocument( configFilePath, cacheKey, &doc );
            capabilitiesDocument = capabilitiesCache->searchCapabilitiesDocument( configFilePath, cacheKey );
        }
        else
        {
            doc = doc.cloneNode().toDocument();
            capabilitiesDocument = &doc;
        }
    }
    else
    {
        QgsMessageLog::logMessage( QStringLiteral( "Found capabilities document in cache" ) );
    }

    response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/xml; charset=utf-8" ) );
    response.write( capabilitiesDocument->toByteArray() );
}
Esempio n. 4
0
RumbleEffectPtr SdlJoystick::createEffectImp(RumbleEffect::RumbleType type)
{
   boost::ignore_unused_variable_warning(type);
   RumbleEffectPtr ret;
#if SDL_VERSION_ATLEAST(1,3,0)
   bool available = (getCapabilities() & type);
   switch (type)
   {
   case RumbleEffect::CONSTANT:
      if (available)
         ret.reset(new SdlRumbleEffectConstant(mHaptic));
      break;
   case RumbleEffect::SINE:
      if (available)
         ret.reset(new SdlRumbleEffectPeriodic(mHaptic, type));
      break;
   case RumbleEffect::SQUARE:
   case RumbleEffect::TRIANGLE:
   case RumbleEffect::SAWTOOTHUP:
   case RumbleEffect::SAWTOOTHDOWN:
      if (available)
         ret.reset(new SdlRumbleEffectPeriodic(mHaptic, type));
      else // See if we can get a SINE Effect.
         //ret = createEffect(RumbleEffect::SINE);
      break;
   case RumbleEffect::RAMP:
      if (available)
         ret.reset(new SdlRumbleEffectConstant(mHaptic));
      break;
   case RumbleEffect::SPRING:
      break;
   case RumbleEffect::DAMPER:
      break;
   case RumbleEffect::INERTIA:
      break;
   case RumbleEffect::FRICTION:
      break;
   case RumbleEffect::CUSTOM:
      break;
   default:
      break;
   }
#endif
   return ret;
}
Esempio n. 5
0
/////////////////////////////////////// PUBLIC FUNCTIONS ////////////////////////////////
//
// Function to connect to a notification server.
void NotifyClient::connectToServer()
{
	// return now if we already have a valid connection
  if (b_validconnection) return;

  notifyclient = new QDBusInterface(DBUS_NOTIFY_SERVICE, DBUS_NOTIFY_PATH, DBUS_NOTIFY_INTERFACE, QDBusConnection::sessionBus(), this); 
  if (notifyclient->isValid() ) {
    b_validconnection = true;
    getServerInformation();
    getCapabilities();  
    QDBusConnection::sessionBus().connect(DBUS_NOTIFY_SERVICE, DBUS_NOTIFY_PATH, DBUS_NOTIFY_INTERFACE, "NotificationClosed", this, SLOT(notificationClosed(quint32, quint32)));
    QDBusConnection::sessionBus().connect(DBUS_NOTIFY_SERVICE, DBUS_NOTIFY_PATH, DBUS_NOTIFY_INTERFACE, "ActionInvoked", this, SLOT(actionInvoked(quint32, QString)));
    } // if connection is valid 
  else {
    notifyclient->deleteLater();
    b_validconnection = false;
  }	// else connection not valid
}
bool VideoCaptureBase::getBestMatchingCapability(int device, 
                                                 VideoCaptureSettings cfg, 
                                                 AVCapability& result) 
{
  std::vector<AVCapability> caps = getCapabilities(device);
  for(std::vector<AVCapability>::iterator it = caps.begin(); it != caps.end(); ++it) {
    AVCapability& cap = *it;
    if(cfg.width == cap.size.width 
       && cfg.height == cap.size.height
       && cfg.in_pixel_format == cap.pixel_format) 
      {
        float cap_fps = rx_libav_rational_to_fps(cap.framerate);
        if(cap_fps == cfg.fps) {
          result = cap;
          return true;
        }
      }
  }
  return false;
}
Esempio n. 7
0
int main(int argc, char *argv[]) {
	int 		*fd = (int*)malloc(sizeof(int)), qual = 0, fps = 0, bufSize = 0;
	char 		*camera;
	if(argc != 5) 						// Check correct number of args
	{
		char errorMsg[256];
		sprintf(errorMsg, "usage: %s cameraDevice JpegQuality fps bufferSize",
				argv[0]);
		exitWithError(errorMsg);
	}
	else
	{
		camera = argv[1];	// camera location
		// Image quality
		if(atoi(argv[2]) > 0 && atoi(argv[2]) <= 100) qual = atoi(argv[2]);
		else exitWithError("Set JpegQuality between 1 and 100 inclusive.");
		// frame delay
		if(atoi(argv[3]) > 0) fps = atoi(argv[3]);
		// list size
		if(atoi(argv[4]) > 0) bufSize = atoi(argv[4]);
	}
	printf("Camera Interface  Copyright (C) 2012  Jacob Appleton\n\n");
	printf("This program comes with ABSOLUTELY NO WARRANTY;\n");
    printf("This is free software, and you are welcome to redistribute it \n");
    printf("under certain conditions.\n");
    printf("Visit http://www.gnu.org/licenses/gpl.html for more details.\n\n");
	*fd = -1;
	openDevice(camera, fd);
	getCapabilities(fd);
	int* imageCaptureType = (int*)malloc(sizeof(int));
	*imageCaptureType = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	getFrames(1, 1, fd, imageCaptureType, qual, fps, bufSize);
    // Turn the stream off - this will turn off the camera's LED light
    ioctl(*fd, VIDIOC_STREAMOFF, imageCaptureType);
	closeDevice(fd);
	free(fd);
	free(imageCaptureType);
	pthread_exit(NULL);
	return 0;
}
Esempio n. 8
0
void dbus_poll(int timeout)
{
        DBusMessage *dbus_msg;

        dbus_connection_read_write(dbus_conn, timeout);

        dbus_msg = dbus_connection_pop_message(dbus_conn);

        while (dbus_msg) {
                if (dbus_message_is_method_call
                    (dbus_msg, "org.freedesktop.DBus.Introspectable", "Introspect")) {
                        dbus_introspect(dbus_msg);
                }

                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "Notify")) {
                        notify(dbus_msg);
                }
                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "GetCapabilities")) {
                        getCapabilities(dbus_msg);
                }
                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "GetServerInformation")) {
                        getServerInformation(dbus_msg);
                }
                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "CloseNotification")) {
                        closeNotification(dbus_msg);
                }
                dbus_message_unref(dbus_msg);
                dbus_msg = dbus_connection_pop_message(dbus_conn);
        }
}
// QC:?
unsigned int VorbisPCMSource::load(char* &outputBuffer, size_t &outputBufferLen, size_t maxOutputBufferLen) {
	ogg_int64_t samples = ov_pcm_total(&of, -1);

	if(getCapabilities() & PCM_SOURCE_CAN_SEEK)
		seek(0, SEEK_SET);

	outputBufferLen = samples * getChannels() * 2;
	if(maxOutputBufferLen && outputBufferLen > maxOutputBufferLen) {
		outputBufferLen = maxOutputBufferLen;
	}
	outputBuffer = (char*) AOEMALLOC(outputBufferLen);
	outputBufferLen = read(outputBuffer, outputBufferLen);

	if(eof()) {
		return 0;
	} else {
		if(outputBufferLen == 0) {
			return 2;
		} else {
			return 1;
		}
	}
}
Esempio n. 10
0
void
dbus_poll(void) {
    DBusMessage *dbus_msg;

    /* make timeout smaller if we are displaying a message
     * to improve responsivness for mouse clicks
     */
    if(msgqueue == NULL) {
        dbus_connection_read_write(dbus_conn, DBUS_POLL_TIMEOUT);
    } else {
        dbus_connection_read_write(dbus_conn, 100);
    }

    dbus_msg = dbus_connection_pop_message(dbus_conn);
    /* we don't have a new message */
    if(dbus_msg == NULL) {
        return;
    }

    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications","Notify")) {
        notify(dbus_msg);
    }
    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications", "GetCapabilities")) {
        getCapabilities(dbus_msg);
    }
    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications", "GetServerInformation")) {
        getServerInformation(dbus_msg);
    }
    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications", "CloseNotification")) {
        closeNotification(dbus_msg);
    }
    dbus_message_unref(dbus_msg);
}
void VideoCaptureBase::printCapabilities(int device) {

  std::vector<AVCapability> caps = getCapabilities(device);
  if(!caps.size()) {
    RX_VERBOSE("No capabilities found for device: %d", device);
    return;
  }

  int last_width = 0;
  int last_height = 0;
  enum AVPixelFormat last_pix_fmt = AV_PIX_FMT_NONE;
  
  for(std::vector<AVCapability>::iterator it = caps.begin();
      it != caps.end();
      ++it)
    {
      AVCapability cap = *it;
      if(cap.size.width != last_width 
         || cap.size.height != last_height 
         || cap.pixel_format != last_pix_fmt) 
        {
          RX_VERBOSE("");
          RX_VERBOSE("%s, %dx%d", 
                     rx_libav_pixel_format_to_string(cap.pixel_format).c_str(),
                     cap.size.width,
                     cap.size.height);
          RX_VERBOSE("--------------------------------------------------------------------");
          last_width = cap.size.width;
          last_height = cap.size.height;
          last_pix_fmt = cap.pixel_format;
      }
      
      AVRational r = cap.framerate;
      double fps = 1.0 / (double(r.num) / double(r.den));
      RX_VERBOSE("\tFPS %2.02f ", fps);
    }
}
Esempio n. 12
0
void QgsWCSServer::executeRequest()
{
  //request type
  QString request = mParameters.value( "REQUEST" );
  if ( request.isEmpty() )
  {
    //do some error handling
    QgsDebugMsg( "unable to find 'REQUEST' parameter, exiting..." );
    mRequestHandler->setServiceException( QgsMapServiceException( "OperationNotSupported", "Please check the value of the REQUEST parameter" ) );
    return;
  }

  if ( request.compare( "GetCapabilities", Qt::CaseInsensitive ) == 0 )
  {
    QDomDocument capabilitiesDocument;
    try
    {
      capabilitiesDocument = getCapabilities();
    }
    catch ( QgsMapServiceException& ex )
    {
      mRequestHandler->setServiceException( ex );
      return;
    }
    QgsDebugMsg( "seting GetCapabilities response" );
    mRequestHandler->setGetCapabilitiesResponse( capabilitiesDocument );
    return;
  }
  else if ( request.compare( "DescribeCoverage", Qt::CaseInsensitive ) == 0 )
  {
    QDomDocument describeDocument;
    try
    {
      describeDocument = describeCoverage();
    }
    catch ( QgsMapServiceException& ex )
    {
      mRequestHandler->setServiceException( ex );
      return;
    }
    QgsDebugMsg( "seting GetCapabilities response" );
    mRequestHandler->setGetCapabilitiesResponse( describeDocument );
    return;
  }
  else if ( request.compare( "GetCoverage", Qt::CaseInsensitive ) == 0 )
  {
    QByteArray* coverageOutput;
    try
    {
      coverageOutput = getCoverage();
    }
    catch ( QgsMapServiceException& ex )
    {
      mRequestHandler->setServiceException( ex );
      return;
    }
    if ( coverageOutput )
    {
      mRequestHandler->setGetCoverageResponse( coverageOutput );
    }
    return;
  }
}
Esempio n. 13
0
static int initFunction( DEVICE_INFO *deviceInfo, const char *name,
						 const int nameLength )
	{
	CK_SESSION_HANDLE hSession;
	CK_SLOT_ID slotList[ MAX_PKCS11_SLOTS + 8 ];
	CK_ULONG slotCount = MAX_PKCS11_SLOTS;
	CK_SLOT_INFO slotInfo;
	CK_TOKEN_INFO tokenInfo;
	CK_RV status;
	PKCS11_INFO *pkcs11Info = deviceInfo->devicePKCS11;
	const PKCS11_MECHANISM_INFO *mechanismInfoPtr;
	char *labelPtr;
	int tokenSlot = DEFAULT_SLOT, i, labelLength, mechanismInfoSize;
	int cryptStatus, cryptStatus2;

	assert( isWritePtr( deviceInfo, sizeof( DEVICE_INFO ) ) );
	assert( isReadPtr( name, nameLength ) );

	/* Get information on all available slots */
	memset( slotList, 0, sizeof( slotList ) );
	status = C_GetSlotList( TRUE, slotList, &slotCount );
	if( status != CKR_OK )
		return( pkcs11MapError( status, CRYPT_ERROR_OPEN ) );
	if( slotCount <= 0 )
		{
		/* There are token slots present but no tokens in the slots */
		return( CRYPT_ERROR_OPEN );
		}

	/* Check whether a token name (used to select the slot) has been 
	   specified */
	for( i = 1; i < nameLength - 1; i++ )
		{
		if( name[ i ] == ':' && name[ i + 1 ] == ':' )
			break;
		}
	if( i < nameLength - 1 )
		{
		const char *tokenName = name + i + 2;	/* Skip '::' */
		const int tokenNameLength = nameLength - ( i + 2 );

		if( tokenNameLength <= 0 )
			return( CRYPT_ARGERROR_STR1 );

		/* Some tokens don't implement named slots, so we also allow them to 
		   be specified using slot counts */
		if( tokenNameLength == 1 && isDigit( *tokenName ) )
			{
			tokenSlot = *tokenName - '0';
			if( tokenSlot < 0 || tokenSlot > 9 )
				return( CRYPT_ARGERROR_STR1 );
			if( tokenSlot > slotCount - 1 )	/* Slots numbered from zero */
				return( CRYPT_ERROR_NOTFOUND );
			status = C_GetTokenInfo( slotList[ tokenSlot ], &tokenInfo );
			if( status != CKR_OK )
				return( CRYPT_ERROR_NOTFOUND );
			}
		else
			{
			/* Check each (named) slot for a token matching the given name */
			for( tokenSlot = 0; tokenSlot < slotCount && \
								tokenSlot < FAILSAFE_ITERATIONS_MED; 
				 tokenSlot++ )
				{
				status = C_GetTokenInfo( slotList[ tokenSlot ], &tokenInfo );
				if( status == CKR_OK && \
					!strCompare( tokenName, tokenInfo.label, tokenNameLength ) )
					break;
				}
			ENSURES( tokenSlot < FAILSAFE_ITERATIONS_MED );
			if( tokenSlot >= slotCount )
				return( CRYPT_ERROR_NOTFOUND );
			}
		}
	pkcs11Info->slotID = slotList[ tokenSlot ];

	/* Get information on device-specific capabilities */
	status = C_GetSlotInfo( pkcs11Info->slotID, &slotInfo );
	if( status != CKR_OK )
		{
		shutdownFunction( deviceInfo );
		return( pkcs11MapError( status, CRYPT_ERROR_OPEN ) );
		}
	if( slotInfo.flags & CKF_REMOVABLE_DEVICE )
		{
		/* The device is removable */
		deviceInfo->flags |= DEVICE_REMOVABLE;
		}
	status = C_GetTokenInfo( pkcs11Info->slotID, &tokenInfo );
	if( status != CKR_OK )
		{
		shutdownFunction( deviceInfo );
		return( pkcs11MapError( status, CRYPT_ERROR_OPEN ) );
		}
	if( tokenInfo.flags & CKF_RNG )
		{
		/* The device has an onboard RNG that we can use */
		deviceInfo->getRandomFunction = getRandomFunction;
		}
#if 0	/* The Spyrus driver for pre-Lynks-II cards returns the local system 
		   time (with a GMT/localtime offset), ignoring the fact that the 
		   token has an onboard clock, so having the CKF_CLOCK_ON_TOKEN not 
		   set is accurate, although having it ignore the presence of the 
		   clock isn't very valid */
	if( !( tokenInfo.flags & CKF_CLOCK_ON_TOKEN ) && \
		( !strCompare( tokenInfo.label, "Lynks Token", 11 ) || \
		  !strCompare( tokenInfo.model, "Rosetta", 7 ) ) )
		{
		/* Fix buggy Spyrus PKCS #11 drivers which claim that the token
		   doesn't have a RTC even though it does (the Rosetta (smart card) 
		   form of the token is even worse, it returns garbage in the label 
		   and manufacturer fields, but the model field is OK).  There is a 
		   chance that there's a genuine problem with the clock (there are 
		   batches of tokens with bad clocks) but the time check that  
		   follows below will catch those */
		tokenInfo.flags |= CKF_CLOCK_ON_TOKEN;
		}
#endif /* 0 */
	if( tokenInfo.flags & CKF_CLOCK_ON_TOKEN )
		{
		const time_t theTime = getTokenTime( &tokenInfo );
		const time_t currentTime = getTime();

		/* The token claims to have an onboard clock that we can use.  Since
		   this could be arbitrarily inaccurate we compare it with the 
		   system time and only rely on it if it's within +/- 1 day of the
		   system time.
		   
		   There is a second check that we should make to catch drivers that
		   claim to read the time from the token but actually use the local
		   computer's time, but this isn't easy to do.  The most obvious way
		   is to set the system time to a bogus value and check whether this
		   matches the returned time, but this is somewhat drastic and 
		   requires superuser privs on most systems.  An alternative is to 
		   check whether the claimed token time exactly matches the system 
		   time, but this will produce false positives if (for example) the
		   token has been recently synchronised to the system time.  For now
		   all we can do is throw an exception if it appears that the token
		   time is faked */
		if( theTime > MIN_TIME_VALUE && \
			theTime >= currentTime - 86400 && \
			theTime <= currentTime + 86400 )
			deviceInfo->flags |= DEVICE_TIME;

		/* If this check is triggered then the token time may be faked since 
		   it's identical to the host system time, see the comment above for 
		   details.  We make an exception for soft-tokens (if we can detect 
		   them), which will (by definition) have the same time as the 
		   system time */
		if( !( pkcs11InfoTbl[ pkcs11Info->deviceNo ].name[ 0 ] && \
			   !strCompare( pkcs11InfoTbl[ pkcs11Info->deviceNo ].name, 
							"Software", 8 ) ) && \
			theTime == currentTime )
			{
			DEBUG_DIAG(( "PKCS #11 token time is the same as the host "
						 "system time, token time may be faked by the "
						 "driver." ));
			assert( DEBUG_WARN );
			}
		}
	if( tokenInfo.flags & CKF_WRITE_PROTECTED )
		{
		/* The device can't have data on it changed */
		deviceInfo->flags |= DEVICE_READONLY;
		}
	if( ( tokenInfo.flags & CKF_LOGIN_REQUIRED ) || \
		!( tokenInfo.flags & CKF_USER_PIN_INITIALIZED ) )
		{
		/* The user needs to log in before using various device functions.
		   We check for the absence of CKF_USER_PIN_INITIALIZED as well as 
		   the more obvious CKF_LOGIN_REQUIRED because if we've got an 
		   uninitialised device there's no PIN set so some devices will 
		   report that there's no login required (or at least none is 
		   possible).  We need to introduce some sort of pipeline stall if 
		   this is the case because otherwise the user could successfully 
		   perform some functions that don't require a login (where the 
		   exact details of what's allowed without a login are device-
		   specific) before running into mysterious failures when they get 
		   to functions that do require a login.  To avoid this, we make an 
		   uninitialised device look like a login-required device, so the 
		   user gets an invalid-PIN error if they try and proceed */
		deviceInfo->flags |= DEVICE_NEEDSLOGIN;
		}
	if( ( pkcs11Info->minPinSize = ( int ) tokenInfo.ulMinPinLen ) < 4 )
		{
		/* Some devices report silly PIN sizes */
		DEBUG_DIAG(( "Driver reports suspicious minimum PIN size %lu, "
					 "using 4", tokenInfo.ulMinPinLen ));
		pkcs11Info->minPinSize = 4;
		}
	if( ( pkcs11Info->maxPinSize = ( int ) tokenInfo.ulMaxPinLen ) < 4 )
		{
		/* Some devices report silly PIN sizes (setting this to ULONG_MAX or
		   4GB, which becomes -1 as an int, counts as silly).  Since we can't
		   differentiate between 0xFFFFFFFF = bogus value and 0xFFFFFFFF = 
		   ULONG_MAX we play it safe and set the limit to 8 bytes, which most
		   devices should be able to handle */
		DEBUG_DIAG(( "Driver reports suspicious maximum PIN size %lu, "
					 "using 8", tokenInfo.ulMinPinLen ));
		pkcs11Info->maxPinSize = 8;
		}
	labelPtr = ( char * ) tokenInfo.label;
	for( labelLength = 32;
		 labelLength > 0 && \
		 ( labelPtr[ labelLength - 1 ] == ' ' || \
		   !labelPtr[ labelLength - 1 ] ); 
		  labelLength-- );	/* Strip trailing blanks/nulls */
	while( labelLength > 0 && *labelPtr == ' ' )
		{
		/* Strip leading blanks */
		labelPtr++;
		labelLength--;
		}
	if( labelLength > 0 )
		{
		memcpy( pkcs11Info->label, labelPtr, labelLength );
		pkcs11Info->labelLen = labelLength;
		sanitiseString( pkcs11Info->label, CRYPT_MAX_TEXTSIZE, 
						labelLength );
		}
	else
		{
		/* There's no label for the token, use the device label instead */
		if( pkcs11InfoTbl[ pkcs11Info->deviceNo ].name[ 0 ] )
			{
			labelLength = \
				min( strlen( pkcs11InfoTbl[ pkcs11Info->deviceNo ].name ),
					 CRYPT_MAX_TEXTSIZE );
			memcpy( pkcs11Info->label, 
					pkcs11InfoTbl[ pkcs11Info->deviceNo ].name, labelLength );
			}
		}
	pkcs11Info->hActiveSignObject = CK_OBJECT_NONE;
	deviceInfo->label = pkcs11Info->label;
	deviceInfo->labelLen = pkcs11Info->labelLen;

	/* Open a session with the device.  This gets a bit awkward because we 
	   can't tell whether a R/W session is OK without opening a session, but 
	   we can't open a session unless we know whether a R/W session is OK, 
	   so we first try for a RW session and if that fails we go for a read-
	   only session */
	status = C_OpenSession( pkcs11Info->slotID, 
							CKF_RW_SESSION | CKF_SERIAL_SESSION, NULL_PTR, 
							NULL_PTR, &hSession );
	if( status == CKR_TOKEN_WRITE_PROTECTED )
		{
		status = C_OpenSession( pkcs11Info->slotID, 
								CKF_SERIAL_SESSION, NULL_PTR, NULL_PTR, 
								&hSession );
		}
	if( status != CKR_OK )
		{
		cryptStatus = pkcs11MapError( status, CRYPT_ERROR_OPEN );
		if( cryptStatus == CRYPT_ERROR_OPEN && \
			!( tokenInfo.flags & CKF_USER_PIN_INITIALIZED ) )
			{
			/* We couldn't do much with the error code, it could be that the
			   token hasn't been initialised yet but unfortunately PKCS #11 
			   doesn't define an error code for this condition.  In addition
			   many tokens will allow a session to be opened and then fail 
			   with a "PIN not set" error at a later point (which allows for
			   more accurate error reporting), however a small number won't
			   allow a session to be opened and return some odd-looking error
			   because there's nothing useful available.  The best way to
			   report this in a meaningful manner to the caller is to check
			   whether the user PIN has been initialised, if it hasn't then 
			   it's likely that the token as a whole hasn't been initialised 
			   so we return a not initialised error */
			cryptStatus = CRYPT_ERROR_NOTINITED;
			}
		return( cryptStatus );
		}
	ENSURES( hSession != CK_OBJECT_NONE );
	pkcs11Info->hSession = hSession;
	deviceInfo->flags |= DEVICE_ACTIVE;

	/* Set up the capability information for this device.  Since there can 
	   be devices that have one set of capabilities but not the other (e.g.
	   a smart card that only performs RSA ops), we allow one of the two
	   sets of mechanism information setups to fail, but not both */
	mechanismInfoPtr = getMechanismInfoPKC( &mechanismInfoSize );
	cryptStatus = getCapabilities( deviceInfo, mechanismInfoPtr, 
								   mechanismInfoSize );
	mechanismInfoPtr = getMechanismInfoConv( &mechanismInfoSize );
	cryptStatus2 = getCapabilities( deviceInfo, mechanismInfoPtr, 
									mechanismInfoSize );
	if( cryptStatusError( cryptStatus ) && cryptStatusError( cryptStatus2 ) )
		{
		shutdownFunction( deviceInfo );
		return( ( cryptStatus == CRYPT_ERROR ) ? \
				CRYPT_ERROR_OPEN : ( int ) cryptStatus );
		}

	return( CRYPT_OK );
	}
Esempio n. 14
0
void Wms::respond(FastCgiQt::Request* request) {

  m_request = request;

  // try to reload the page if it failed previously
  if (!renderer.hasLoaded()) {
    renderer.refresh();
  }

  QString p_service;
  QString p_request;
  QString p_version;
  QString p_format;
  QString p_layers;
  QString p_srs;
  BoundingBox p_bbox;
  int p_width = 0;
  int p_height = 0;

  // get all variables from the query string
  QHash<QByteArray, QByteArray> p_getVars = request->rawValues(FastCgiQt::GetData);
  for ( QHash<QByteArray, QByteArray>::ConstIterator it = p_getVars.constBegin();
    it != p_getVars.constEnd();
    ++it) {

    QString key = QString(it.key().toUpper());
      
    if (key == "SERVICE") {
      p_service = it.value().toUpper();
    }
    else if (key == "REQUEST") {
      p_request = it.value().toUpper();
    }
    else if (key == "VERSION") {
      p_version = it.value();
    }
    else if (key == "FORMAT") {
      p_format = it.value().toLower();
    }
    else if (key == "LAYERS") {
      p_layers = it.value();
    }
    else if (key == "WIDTH") {
      bool conv_result;
      p_width = it.value().toInt(&conv_result);
      if (!conv_result) {
        serviceException(
         "paramError",
         "Illegal value for WIDTH"
         );  
        return; 
      }
    }
    else if (key == "HEIGHT") {
      bool conv_result;
      p_height = it.value().toInt(&conv_result);
      if (!conv_result) {
        serviceException(
         "paramError",
         "Illegal value for HEIGHT"
         );  
        return; 
      }
    }
    else if (key == "BBOX") {
      p_bbox.fromString(it.value());
    }
  }

  if (p_service != "WMS") {

    serviceException(
      "unknownService",
      "This is a WMS (more or less). try SERVICE=WMS"
      );  
    return;
  }

  // dispatch requests
  if (p_request == "GETMAP") {
    QSize image_size(p_width, p_height); 
    getMap(p_format, p_layers, image_size, p_bbox);
  }

  else if (p_request == "GETCAPABILITIES") {
    getCapabilities();
  }

  else {
    serviceException(
      "unknownRequest", 
      "Unknown/missing REQUEST parameter"
      );  
    return;
  }
}
// TESTING FOR SUPPORTED CAPABILITES
// --------------------------------------------------------------------------------------
bool VideoCaptureBase::isPixelFormatSupported(int device, enum AVPixelFormat fmt) {
  std::vector<AVCapability> caps = getCapabilities(device);
  return std::find_if(caps.begin(), caps.end(), AVCapabilityFindPixelFormat(fmt)) != caps.end();
}
  void 
  DeviceBTTV::init(Miro::Server& _server, FilterParameters const * _params)
  {
    int	err = 0;

    MIRO_DBG(VIDEO, LL_DEBUG, "Video::DeviceBTTV: Connecting DeviceBTTV.");

    params_ = dynamic_cast<DeviceBTTVParameters const *>(_params);
    assert(params_ != NULL);

    devName_.set(params_->device.c_str());
    if (connector_.connect(ioBuffer_, 
			  devName_, 
			  0, ACE_Addr::sap_any, 0, O_RDWR) == -1) {
      MIRO_LOG_OSTR(LL_ERROR,
		    "Failed to open device: " << params_->device <<
		    "\nPropably running on the wrong machine?");
      throw Miro::CException(errno, std::strerror(errno));
    }

    fcntl(ioBuffer_.get_handle(), F_SETFD, FD_CLOEXEC);

    /* video capabilities */
    getCapabilities();

    /* video channels aka inputs */
    getChannels();

    if (capability.type & VID_TYPE_CAPTURE) {
      err = ioctl(ioBuffer_.get_handle(), VIDIOCGMBUF, &gb_buffers);
      if (err == -1)
	throw Miro::CException(errno, "DeviceBTTV::handleConnect() - VIDIOCGMBUF");
      map_ = (unsigned char*)mmap(0, gb_buffers.size, PROT_READ, MAP_SHARED, ioBuffer_.get_handle(), 0);
      if ((int)map_ == -1)
	throw Miro::CException(errno, "DeviceBTTV::handleConnect() - mmap()");
    }

    iNBuffers = gb_buffers.frames;

    MIRO_DBG_OSTR(VIDEO, LL_DEBUG, "Video::DeviceBTTV: buffersize: " << gb_buffers.size <<
		  "\nbuffersize/frame: " << gb_buffers.size/gb_buffers.frames <<
		  "\nframes: " << gb_buffers.frames);

    if (gb_buffers.frames < (int)params_->buffers) {
      throw Miro::Exception("Number of requested buffers in the configuration\n" \
			    "exceeds the number of frames available by the device.");
    }

    if (gb_buffers.frames < 2) {
      throw Miro::Exception("Only one frame available by the video device.\n" \
			    "At least two are needed.");
    }

    if (params_->buffers < 2) {
      throw Miro::Exception("Only one buffer available by the configuration.\n" \
			    "At least two are needed.");
    }

    probeAllFormats();

    setFormat();
    setSource();
    setPalette();
    setSize();

    //	preparing buffers

    VideoSubfield subfield = getSubfield(params_->subfield);

    if (subfield != SUBFIELD_ALL) {
      if (capability.type & VID_TYPE_SUBCAPTURE) {

	struct video_capture vc;

	vc.x = 0;
	vc.y = 0;
	vc.width = outputFormat_.width;
	vc.height = outputFormat_.height;
	vc.decimation = 1;
	vc.flags = (subfield == SUBFIELD_ODD)? VIDEO_CAPTURE_ODD : VIDEO_CAPTURE_EVEN;

	err = ioctl(ioBuffer_.get_handle(), VIDIOCSCAPTURE, &vc);
	if (err == -1)
	  throw Miro::CException(errno, "DeviceBTTV::handleConnect() - VIDIOCGMBUF");
      }
      else {
	throw Miro::Exception("Hardware doesn't support subfields.");
      }
    }

    Super::init(_server, _params);
  }
Esempio n. 17
0
QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWFSCapabilities::Capabilities &caps )
    : QgsVectorDataProvider( uri )
    , mShared( new QgsWFSSharedData( uri ) )
    , mWKBType( QGis::WKBUnknown )
    , mValid( true )
    , mCapabilities( 0 )
{
  mShared->mCaps = caps;
  connect( mShared.data(), SIGNAL( raiseError( const QString& ) ), this, SLOT( pushErrorSlot( const QString& ) ) );

  if ( uri.isEmpty() )
  {
    mValid = false;
    return;
  }

  //create mSourceCRS from url if possible [WBC 111221] refactored from GetFeatureGET()
  QString srsname = mShared->mURI.SRSName();
  if ( !srsname.isEmpty() )
  {
    if ( srsname == "EPSG:900913" )
      mShared->mSourceCRS.createFromOgcWmsCrs( "EPSG:3857" );
    else
      mShared->mSourceCRS.createFromOgcWmsCrs( srsname );
  }

  // Must be called first to establish the version, in case we are in auto-detection
  if ( !getCapabilities() )
  {
    mValid = false;
    return;
  }

  if ( !mShared->mURI.sql().isEmpty() )
  {
    if ( !processSQL( mShared->mURI.sql(), mProcessSQLErrorMsg ) )
    {
      QgsMessageLog::logMessage( mProcessSQLErrorMsg, tr( "WFS" ) );
      mValid = false;
      return;
    }
    mSubsetString = mShared->mURI.sql();
  }
  else
  {
    mSubsetString = mShared->mURI.filter();

    //fetch attributes of layer and type of its geometry attribute
    //WBC 111221: extracting geometry type here instead of getFeature allows successful
    //layer creation even when no features are retrieved (due to, e.g., BBOX or FILTER)
    if ( !describeFeatureType( mShared->mGeometryAttribute, mShared->mFields, mWKBType ) )
    {
      mValid = false;
      return;
    }
    mThisTypenameFields = mShared->mFields;
  }

  if ( !mShared->computeFilter( mProcessSQLErrorMsg ) )
  {
    QgsMessageLog::logMessage( mProcessSQLErrorMsg, tr( "WFS" ) );
    mValid = false;
    return;
  }

  //Failed to detect feature type from describeFeatureType -> get first feature from layer to detect type
  if ( mWKBType == QGis::WKBUnknown )
  {
    QgsWFSFeatureDownloader downloader( mShared.data() );
    connect( &downloader, SIGNAL( featureReceived( QVector<QgsWFSFeatureGmlIdPair> ) ),
             this, SLOT( featureReceivedAnalyzeOneFeature( QVector<QgsWFSFeatureGmlIdPair> ) ) );
    downloader.run( false, /* serialize features */
                    1 /* maxfeatures */ );
  }

  qRegisterMetaType<QgsRectangle>( "QgsRectangle" );
}
bool VideoCaptureBase::isFrameRateSupported(int device, double fps) {
  std::vector<AVCapability> caps = getCapabilities(device);
  return std::find_if(caps.begin(), caps.end(), AVCapabilityFindFrameRate(fps)) != caps.end();
}
bool VideoCaptureBase::isSizeSupported(int device, int width, int height) {
  std::vector<AVCapability> caps = getCapabilities(device);
  return std::find_if(caps.begin(), caps.end(), AVCapabilityFindSize(width, height)) != caps.end();
}
Esempio n. 20
0
std::map<std::string, std::string> ossimUtilityFactory::getCapabilities() const
{
   std::map<std::string, std::string> result;
   getCapabilities(result);
   return result;
}
Esempio n. 21
0
void IMAPConnection::authenticateSASL()
{
	if (!dynamicCast <security::sasl::SASLAuthenticator>(getAuthenticator()))
		throw exceptions::authentication_error("No SASL authenticator available.");

	const std::vector <string> capa = getCapabilities();
	std::vector <string> saslMechs;

	for (unsigned int i = 0 ; i < capa.size() ; ++i)
	{
		const string& x = capa[i];

		if (x.length() > 5 &&
		    (x[0] == 'A' || x[0] == 'a') &&
		    (x[1] == 'U' || x[1] == 'u') &&
		    (x[2] == 'T' || x[2] == 't') &&
		    (x[3] == 'H' || x[3] == 'h') &&
		    x[4] == '=')
		{
			saslMechs.push_back(string(x.begin() + 5, x.end()));
		}
	}

	if (saslMechs.empty())
		throw exceptions::authentication_error("No SASL mechanism available.");

	std::vector <shared_ptr <security::sasl::SASLMechanism> > mechList;

	shared_ptr <security::sasl::SASLContext> saslContext =
		make_shared <security::sasl::SASLContext>();

	for (unsigned int i = 0 ; i < saslMechs.size() ; ++i)
	{
		try
		{
			mechList.push_back
				(saslContext->createMechanism(saslMechs[i]));
		}
		catch (exceptions::no_such_mechanism&)
		{
			// Ignore mechanism
		}
	}

	if (mechList.empty())
		throw exceptions::authentication_error("No SASL mechanism available.");

	// Try to suggest a mechanism among all those supported
	shared_ptr <security::sasl::SASLMechanism> suggestedMech =
		saslContext->suggestMechanism(mechList);

	if (!suggestedMech)
		throw exceptions::authentication_error("Unable to suggest SASL mechanism.");

	// Allow application to choose which mechanisms to use
	mechList = dynamicCast <security::sasl::SASLAuthenticator>(getAuthenticator())->
		getAcceptableMechanisms(mechList, suggestedMech);

	if (mechList.empty())
		throw exceptions::authentication_error("No SASL mechanism available.");

	// Try each mechanism in the list in turn
	for (unsigned int i = 0 ; i < mechList.size() ; ++i)
	{
		shared_ptr <security::sasl::SASLMechanism> mech = mechList[i];

		shared_ptr <security::sasl::SASLSession> saslSession =
			saslContext->createSession("imap", getAuthenticator(), mech);

		saslSession->init();

		shared_ptr <IMAPCommand> authCmd;

		if (saslSession->getMechanism()->hasInitialResponse())
		{
			byte_t* initialResp = 0;
			size_t initialRespLen = 0;

			saslSession->evaluateChallenge(NULL, 0, &initialResp, &initialRespLen);

			string encodedInitialResp(saslContext->encodeB64(initialResp, initialRespLen));
			delete [] initialResp;

			if (encodedInitialResp.empty())
				authCmd = IMAPCommand::AUTHENTICATE(mech->getName(), "=");
			else
				authCmd = IMAPCommand::AUTHENTICATE(mech->getName(), encodedInitialResp);
		}
		else
		{
			authCmd = IMAPCommand::AUTHENTICATE(mech->getName());
		}

		authCmd->send(dynamicCast <IMAPConnection>(shared_from_this()));

		for (bool cont = true ; cont ; )
		{
			std::auto_ptr <IMAPParser::response> resp(m_parser->readResponse());

			if (resp->response_done() &&
			    resp->response_done()->response_tagged() &&
			    resp->response_done()->response_tagged()->resp_cond_state()->
			    	status() == IMAPParser::resp_cond_state::OK)
			{
				m_socket = saslSession->getSecuredSocket(m_socket);
				return;
			}
			else
			{
				std::vector <IMAPParser::continue_req_or_response_data*>
					respDataList = resp->continue_req_or_response_data();

				string response;
				bool hasResponse = false;

				for (unsigned int i = 0 ; i < respDataList.size() ; ++i)
				{
					if (respDataList[i]->continue_req())
					{
						response = respDataList[i]->continue_req()->resp_text()->text();
						hasResponse = true;
						break;
					}
				}

				if (!hasResponse)
				{
					cont = false;
					continue;
				}

				byte_t* challenge = 0;
				size_t challengeLen = 0;

				byte_t* resp = 0;
				size_t respLen = 0;

				try
				{
					// Extract challenge
					saslContext->decodeB64(response, &challenge, &challengeLen);

					// Prepare response
					saslSession->evaluateChallenge
						(challenge, challengeLen, &resp, &respLen);

					// Send response
					const string respB64 = saslContext->encodeB64(resp, respLen) + "\r\n";
					sendRaw(utility::stringUtils::bytesFromString(respB64), respB64.length());

					if (m_tracer)
						m_tracer->traceSendBytes(respB64.length() - 2, "SASL exchange");

					// Server capabilities may change when logged in
					invalidateCapabilities();
				}
				catch (exceptions::sasl_exception& e)
				{
					if (challenge)
					{
						delete [] challenge;
						challenge = NULL;
					}

					if (resp)
					{
						delete [] resp;
						resp = NULL;
					}

					// Cancel SASL exchange
					sendRaw(utility::stringUtils::bytesFromString("*\r\n"), 3);

					if (m_tracer)
						m_tracer->traceSend("*");
				}
				catch (...)
				{
					if (challenge)
						delete [] challenge;

					if (resp)
						delete [] resp;

					throw;
				}

				if (challenge)
					delete [] challenge;

				if (resp)
					delete [] resp;
			}
		}
	}

	throw exceptions::authentication_error
		("Could not authenticate using SASL: all mechanisms failed.");
}
Esempio n. 22
0
bool SdlJoystick::init()
{
#if SDL_VERSION_ATLEAST(1,3,0)
   SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC);
#else
   SDL_Init(SDL_INIT_JOYSTICK);
#endif

   if (mDeviceNumber >= SDL_NumJoysticks())
   {
      vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL)
         << clrOutBOLD(clrRED, "ERROR")
         << ": Added for joystick number " << mDeviceNumber
         << " but there are only " << SDL_NumJoysticks() << " joysticks.\n"
         << vprDEBUG_FLUSH;
      return false;
   }
   mJoystick = SDL_JoystickOpen(mDeviceNumber);
   if (!mJoystick)
   {
      vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL)
         << "ERROR: Failed to open joystick " << mDeviceNumber << ": "
         << SDL_GetError();
      return false;
   }

   mButtons.resize(SDL_JoystickNumButtons(mJoystick), gadget::DigitalState::OFF);
   mAxes.resize(SDL_JoystickNumAxes(mJoystick), 0.0f);

   gadget::Digital::addDigitalSample(mButtons);
   gadget::Analog::addAnalogSample(mAxes);

   cout << "Found Joystick " << mDeviceNumber << ": " << SDL_JoystickName(mDeviceNumber) << endl
        << "              Axis: " << mAxes.size() << endl
        << "           Buttons: " << mButtons.size() << endl
        << "              Hats: " << SDL_JoystickNumHats(mJoystick) << " (Unused)" << endl
        << "             Balls: " << SDL_JoystickNumBalls(mJoystick) << " (Unused)" << endl
#if SDL_VERSION_ATLEAST(1,3,0)
        << "           Haptics: " << (SDL_JoystickIsHaptic(mJoystick) ? "YES" : "NO")
#else
        << "           Haptics: Not supported by SDL 1.2"
#endif
        << endl;

#if SDL_VERSION_ATLEAST(1,3,0)
   if (SDL_JoystickIsHaptic(mJoystick))
   {
      mHaptic = SDL_HapticOpenFromJoystick(mJoystick);
      if (!mHaptic)
      {
         vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL)
            << "ERROR: Failed to initialize haptics on " << mDeviceNumber << ": " << SDL_GetError();
         return true;
      }
   unsigned int cap = getCapabilities();
   cout << "    Loaded Effects: " << getMaxStoredEffects() << endl
        << "    Played Effects: " << getMaxPlayingEffects() << endl
        << "        Axes Count: " << getNumAxes() << endl
        << "       Support for:";
   if (cap & RumbleEffect::CONSTANT)     cout << " constant";
   if (cap & RumbleEffect::SINE)         cout << " sine";
   if (cap & RumbleEffect::SQUARE)       cout << " square";
   if (cap & RumbleEffect::TRIANGLE)     cout << " triangle";
   if (cap & RumbleEffect::SAWTOOTHUP)   cout << " saw-tooth-up";
   if (cap & RumbleEffect::SAWTOOTHDOWN) cout << " saw-tooth-down";
   if (cap & RumbleEffect::RAMP)         cout << " ramp";
   if (cap & RumbleEffect::SPRING)       cout << " spring";
   if (cap & RumbleEffect::DAMPER)       cout << " damper";
   if (cap & RumbleEffect::INERTIA)      cout << " inertia";
   if (cap & RumbleEffect::FRICTION)     cout << " friction";
   if (cap & RumbleEffect::CUSTOM)       cout << " custom";
   if (cap & RumbleEffect::GAIN)         cout << " gain";
   if (cap & RumbleEffect::AUTOCENTER)   cout << " auto-center";
   if (cap & RumbleEffect::STATUS)       cout << " status";
   if (cap & RumbleEffect::PAUSE)        cout << " pause";
   cout << endl;
   }
#endif
   mInitialized = true;
   return true;
}
Esempio n. 23
0
bool QgsWFSProvider::getCapabilities()
{
  mCapabilities = 0;

  QgsWFSCapabilities getCapabilities( mShared->mURI.uri() );
  if ( !getCapabilities.requestCapabilities( true ) )
  {
    QgsMessageLog::logMessage( tr( "GetCapabilities failed for url %1: %2" ).
                               arg( dataSourceUri() ).arg( getCapabilities.errorMessage() ), tr( "WFS" ) );
    return false;
  }

  const QgsWFSCapabilities::Capabilities caps = getCapabilities.capabilities();

  mShared->mWFSVersion = caps.version;
  if ( mShared->mURI.maxNumFeatures() > 0 )
    mShared->mMaxFeatures = mShared->mURI.maxNumFeatures();
  else
    mShared->mMaxFeatures = caps.maxFeatures;
  mShared->mMaxFeaturesServer = caps.maxFeatures;
  mShared->mSupportsHits = caps.supportsHits;
  mShared->mSupportsPaging = caps.supportsPaging;

  //find the <FeatureType> for this layer
  QString thisLayerName = mShared->mURI.typeName();
  for ( int i = 0; i < caps.featureTypes.size(); i++ )
  {
    if ( thisLayerName == caps.featureTypes[i].name )
    {
      const QgsRectangle& r = caps.featureTypes[i].bboxLongLat;
      if ( mShared->mSourceCRS.authid().isEmpty() && caps.featureTypes[i].crslist.size() != 0 )
      {
        mShared->mSourceCRS.createFromOgcWmsCrs( caps.featureTypes[i].crslist[0] );
      }
      if ( !r.isNull() )
      {
        QgsCoordinateReferenceSystem src;
        src.createFromOgcWmsCrs( "CRS:84" );
        QgsCoordinateTransform ct( src, mShared->mSourceCRS );

        QgsDebugMsg( "latlon ext:" + r.toString() );
        QgsDebugMsg( "src:" + src.authid() );
        QgsDebugMsg( "dst:" + mShared->mSourceCRS.authid() );

        mExtent = ct.transformBoundingBox( r, QgsCoordinateTransform::ForwardTransform );

        QgsDebugMsg( "layer ext:" + mExtent.toString() );
      }
      if ( caps.featureTypes[i].insertCap )
      {
        mCapabilities |= QgsVectorDataProvider::AddFeatures;
      }
      if ( caps.featureTypes[i].updateCap )
      {
        mCapabilities |= QgsVectorDataProvider::ChangeAttributeValues;
        mCapabilities |= QgsVectorDataProvider::ChangeGeometries;
      }
      if ( caps.featureTypes[i].deleteCap )
      {
        mCapabilities |= QgsVectorDataProvider::DeleteFeatures;
      }

      return true;
    }
  }
  QgsMessageLog::logMessage( tr( "Could not find typename %1 in capabilites for url %2" ).
                             arg( thisLayerName ).arg( dataSourceUri() ), tr( "WFS" ) );
  return false;
}
Esempio n. 24
0
void learner::testCapabilities(InstanceStream &is){
  capabilities c;
  getCapabilities(c);
  c.testCapabilities(is,name_);
}