uint8_t BLECharacteristicImp::discoverResponseProc(bt_conn_t *conn,
                                                   const bt_gatt_attr_t *attr,
                                                   bt_gatt_discover_params_t *params)
{
    const bt_addr_le_t* dst_addr = bt_conn_get_dst(conn);
    BLEDevice device(dst_addr);
    uint8_t retVal = BT_GATT_ITER_STOP;
    
    pr_debug(LOG_MODULE_BLE, "%s-%d: type-%d", __FUNCTION__, __LINE__, params->type);

    // Process the service
    switch (params->type)
    {
        case BT_GATT_DISCOVER_DESCRIPTOR:
        {
            if (NULL != attr)
            {
                retVal = BT_GATT_ITER_CONTINUE;
                const bt_uuid_t* desc_uuid = attr->uuid;
                uint16_t desc_handle = attr->handle;
    pr_debug(LOG_MODULE_BLE, "%s-%d:handle-%d:%d", __FUNCTION__, __LINE__,attr->handle, desc_handle);
                if (isClientCharacteristicConfigurationDescriptor(desc_uuid))
                {
                    setCCCDHandle(desc_handle);
                }
                else if (bt_uuid_cmp(BLEServiceImp::getPrimayUuid(), desc_uuid) == 0 ||
                         bt_uuid_cmp(getCharacteristicAttributeUuid(), desc_uuid) == 0 )
                {
                    retVal = BT_GATT_ITER_STOP;
                }
                else
                {
                    int retval = (int)addDescriptor(desc_uuid,
                                                    attr->perm,
                                                    desc_handle);
                    
                    if (BLE_STATUS_SUCCESS != retval)
                    {
                        pr_error(LOG_MODULE_BLE, "%s-%d: Error-%d", 
                                 __FUNCTION__, __LINE__, retval);
                        errno = ENOMEM;
                        retVal = BT_GATT_ITER_STOP;
                    }
                    
                }
            }
            break;
        }
        default:
        {
            break;
        }
    }
    return retVal;
}
Esempio n. 2
0
void CompactIndex::flushWriteCache() {
	if (readOnly)
		return;
	LocalLock lock();
	copySegmentsToWriteCache();
	lseek(fileHandle, (off_t)bytesWrittenToFile, SEEK_SET);
	forced_write(fileHandle, writeCache, cacheBytesUsed);
	bytesWrittenToFile += cacheBytesUsed;
	cacheBytesUsed = 0;
	addDescriptor((char*)CI_GUARDIAN);
} // end of flushWriteCache()
Esempio n. 3
0
// Bind to a socket. for future, maybe specify force ipv4/ipv6 or preference.
int Incoming::bindForListen(){
    if(bound) return -1;

    int err;

    struct addrinfo hints, *ai, *p;
    // get us a socket and bind it
    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_UNSPEC; // AF_INET AF_INET6
    hints.ai_socktype = SOCK_STREAM; // SOCK_DGRAM or 0
    hints.ai_flags = AI_PASSIVE;

    if ((err = getaddrinfo(NULL, PORT, &hints, &ai)) != 0) {
        fprintf(stderr, "selectserver: %s\n", gai_strerror(err));
        return -1;
    }

    // Bind to the first one we can
    for(p = ai; p != NULL; p = p->ai_next) {
        listener = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
        if (listener < 0) {
            continue;
        }
        int yes = 0;
        // lose the pesky "address already in use" error message
        setsockopt(listener, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
        if (bind(listener, p->ai_addr, p->ai_addrlen) < 0) {
            close(listener);
            continue;
        }
        break;
    }
    // if we got here, it means we didn't get bound
    if (p == NULL) {
        fprintf(stderr, "Incoming::bindForListen: failed to bind\n");
        return -2;
    }

    freeaddrinfo(ai); // all done with this

    // listen, allowing up to 10 pending connection attempts
    if (listen(listener, 10) == -1) {
        perror("listen");
        return -3;
    }

    bound = true;

    addDescriptor(listener, POLLIN);

    return 0;
}
//===================================================================================================
void writeList(DescriptorBase * p, fileType t){
    switch(t){
        case TEXT: ptr_p = TextDescriptor e;
        break;
        case PICTURE: ptr_p = PictureDescriptor e;
        break;
        case SOUND: ptr_p = SoundDescriptor e;
        break;
    }
    char choice = 0;
    do{
        addDescriptor(p, writeElement(&e), t)
        printf("Do you want to add another descriptor (Y,N)?\n");
        scanf("%s", &choice);
    }while(choice != "n" && choice != "N");
}
int sys_open(const char* filename, int flags, unsigned int mode){
    (void) mode;
    struct vnode *vNode;
    struct filedescriptor *f_desc;
    int returnval = vfs_open((void*)filename, flags, 0, &vNode);
    if(returnval){
        return (returnval)*(-1);
    }else{
        char nameOfLock[128];
        strcpy(nameOfLock, "lock_");
        strcat(nameOfLock, filename);
        
        f_desc = fdcreate(0,flags , nameOfLock, vNode);
        
        int a;
        a = addDescriptor((curthread->t_fdManager), f_desc);
        return a;
        
        
    }
}
struct fdManager * clone(struct fdManager *manager) {
	
	struct fdManager *clone;
	clone = make_fdManager();

	if(clone == NULL) {
	  kprintf("clone failed\n");
		return NULL;
	}
	
	int size;
	size = getSize(manager);
	
	clone->fdm_initialized = 1;
	int i = 0;
	while(i<size){
		clone->fdm_next = i;
		addDescriptor(clone, getFileDescriptor(i, manager));
		i++;
	}
	clone->fdm_next = manager->fdm_next;

	return clone;
}
Esempio n. 7
0
int Incoming::poll(){
    // fds array
    // length of array
    // timespec *time
    // sigset_t *sigmask

    if(fdcount == 0) return 0;

    int timeout = 100;

    int val = ::poll(fdz, fdcount, timeout);
    if(!val);
    for(int i = 0; val > 0 && i < fdcount ; ++i){
        // POLLIN POLLOUT POLLERR POLLHUP
        if(fdz[i].revents & POLLHUP){
            int v = 0;
            v = cbs->preClose(fdz[i].fd);
            if(v < 0){
                printf("IGNORING SOCKET POLLHUP\n");
            } else {
                close(fdz[i].fd);
                removeDescriptor(fdz[i].fd);
                cbs->postClose(fdz[i].fd);
            }
        } else {
            if(fdz[i].revents & POLLIN){
                // either read if its a accepted socket, or accept if its the listening socket.
                if(fdz[i].fd == listener){
                    // Accept the socket
                    int v = 0;
                    v = cbs->preAccept(fdz[i].fd);
                    if(v < 0){ // dont accept
                        printf("IGNORING SOCKET ACCEPT REQUEST!\n");
                    } else {
                        struct sockaddr *s = (struct sockaddr *)malloc(sizeof(struct sockaddr));
                        socklen_t len = 0;
                        int fd = accept(fdz[0].fd, s, &len);
                        //debug(8, "NEW SOCKET ACCEPTED: fd is %d\n", fd);
                        addDescriptor(fd);
                        free(s);
                        cbs->postAccept(fd);
                    }
                } else {
                    int nread = 0;
                    nread = cbs->read(fdz[i].fd);
                    if(nread == 0){
                        int v = 0;
                        v = cbs->preClose(fdz[i].fd);
                        if(v < 0){
                            printf("IGNORING SOCKET EOS\n");
                        } else {
                            close(fdz[i].fd);
                            removeDescriptor(fdz[i].fd);
                            cbs->postClose(fdz[i].fd);
                        }
                    }
                }
            }
        }
    }
    return 0;
}
int initialize_fdManager(struct fdManager *manager) {
	
	if(manager->fdm_initialized == 1) {
	  kprintf("initialization failed\n");
		return -1;
	}

	struct vnode *node;
	int error;
	char *console_name;
	console_name = kstrdup("con:");
	
	struct filedescriptor *stdin = kmalloc(sizeof(struct filedescriptor));
	struct filedescriptor *stdout = kmalloc(sizeof(struct filedescriptor));
	struct filedescriptor *stderr = kmalloc(sizeof(struct filedescriptor));

	//stdin
	error = vfs_open(console_name, O_RDONLY, 0, &node);
	if (error) {
		kprintf("STDIN open failed: %s\n", strerror(error));
		vfs_close(node);
		destroy(manager);
		int a;
		a = -1;
		return a;
	}
	stdin = fdcreate(0, O_RDONLY, (char *)("jmok_lok_stdin"), node);
	
	//stdout
	console_name = kstrdup("con:");
	error = vfs_open(console_name, O_WRONLY, 0, &node);
	if (error) {
	        kprintf("STDOUT open failed: %s\n", strerror(error));
		vfs_close(node);
		destroy(manager);
		int b;
		b = -1;
		return b;
	}
	stdout = fdcreate(0, O_RDONLY, (char *)("jmok_lok_stdout"), node);
	
	//stderr
	console_name = kstrdup("con:");
	error = vfs_open(console_name, O_WRONLY, 0, &node);
	if (error) {
      	        kprintf("STDERR open failed: %s\n", strerror(error));
		vfs_close(node);
		destroy(manager);
		int c;
		c = -1;
		return c;
	}
	stderr = fdcreate(0, O_WRONLY, (char *)("jmok_lok_stderr"), node);

	if (!manager->fdm_initialized) {
		manager->fdm_initialized = 1;
	}

	addDescriptor(manager, stdin);
	addDescriptor(manager, stdout);
	addDescriptor(manager, stderr);
	//kprintf("fdManager initialization succeeded\n");
	return 0;
}
Esempio n. 9
0
int USB::addDescriptor(void *descriptor)
{
	return addDescriptor((usbdesc_base *) descriptor);
}
Esempio n. 10
0
CompactIndex::CompactIndex(Index *owner, const char *fileName, bool create, bool use_O_DIRECT) {
	this->owner = owner;
	this->fileName = duplicateString(fileName);
	this->compressor = compressorForID[indexCompressionMode];
	this->use_O_DIRECT = use_O_DIRECT;
	baseFile = NULL;
	inMemoryIndex = NULL;
	totalSize = 0;

	if (!create)
		initializeForQuerying();
	else {
		int flags = O_CREAT | O_TRUNC | O_RDWR | O_LARGEFILE;
		if (use_O_DIRECT)
			flags |= (O_DIRECT | O_SYNC);
		fileHandle = open(fileName, flags, DEFAULT_FILE_PERMISSIONS);

		if (fileHandle < 0) {
			snprintf(errorMessage, sizeof(errorMessage),
					"Unable to create on-disk index: %s", fileName);
			log(LOG_ERROR, LOG_ID, errorMessage);
			perror(NULL);
			exit(1);
		}
		else {
			// create File object to be used by all posting lists; initial usage count: 1
			// setting the usage count to 1 makes sure the object is not destroyed by
			// its children (see FileFile for details)
			baseFile = new FileFile(fileName, (off_t)0, 1);
		}

		cacheBytesUsed = 0;
		bytesWrittenToFile = 0;
		tempSegmentCount = 0;
		totalSizeOfTempSegments = 0;
		lastTermAdded[0] = 0;
		readOnly = false;

		header.termCount = 0;
		header.listCount = 0;
		header.descriptorCount = 0;
		header.postingCount = 0;
		descriptorSlotCount = 256;
		descriptors = typed_malloc(CompactIndex_BlockDescriptor, descriptorSlotCount);
		addDescriptor("");

		// allocate space for write buffer; must be properly mem-aligned because we
		// want to be able to access the output file with O_DIRECT
		int status = posix_memalign((void**)&writeCache, 4096, WRITE_CACHE_SIZE);
		if (status != 0) {
			log(LOG_ERROR, LOG_ID, "Unable to allocate aligned memory for write buffer");
			perror("posix_memalign");
			exit(1);
		}

		sprintf(errorMessage, "Creating new on-disk index: %s", fileName);
		log(LOG_DEBUG, LOG_ID, errorMessage);
		if (!use_O_DIRECT)
			forced_write(fileHandle, &header, sizeof(header));
		lseek(fileHandle, 0, SEEK_SET);
	}
} // end of CompactIndex(Index*, char*, bool, bool)
Esempio n. 11
0
void CompactIndex::addPostings(const char *term, byte *postings, int byteLength,
		int count, offset first, offset last) {
	assert(!readOnly);
	assert((count > 0) && (last >= first) && (term[0] != 0));

	// sorry; we do not allow any term that is right of the guardian term
	if (strcmp(term, (char*)CI_GUARDIAN) >= 0)
		return;

	// if we receive more postings than we can put into a list segment without
	// violating the MIN_SEGMENT_SIZE/MAX_SEGMENT_SIZE constraint, we need to
	// split the list into sub-lists of manageable size: decompress and pass
	// to the method that deals with uncompressed lists
	if ((count > MAX_SEGMENT_SIZE) ||
	    (extractCompressionModeFromList(postings) != indexCompressionMode)) {		
		int listLengthFromCompressor;
		offset *uncompressed =
			decompressList(postings, byteLength, &listLengthFromCompressor, NULL);
		assert(listLengthFromCompressor == count);
		addPostings(term, uncompressed, count);
		free(uncompressed);
		return;
	}

	bool mustReleaseLock = getLock();

	// check if the terms come in pre-sorted
	int comparison = strcmp(term, lastTermAdded);
	assert(comparison >= 0);
	if ((comparison != 0) || (tempSegmentCount == MAX_SEGMENTS_IN_MEMORY))
		copySegmentsToWriteCache();
	strcpy(lastTermAdded, term);
#if INDEX_MUST_BE_WORD_ALIGNED
	// pad the compressed postings in order to make everything word-aligned
	if (byteLength & 7)
		byteLength += 8 - (byteLength & 7);
#endif

	tempSegmentHeaders[tempSegmentCount].postingCount = count;
	tempSegmentHeaders[tempSegmentCount].byteLength = byteLength;
	tempSegmentHeaders[tempSegmentCount].firstElement = first;
	tempSegmentHeaders[tempSegmentCount].lastElement = last;
	tempSegmentData[tempSegmentCount++] =
		(byte*)memcpy((byte*)malloc(byteLength), postings, byteLength);
	totalSizeOfTempSegments += byteLength + sizeof(PostingListSegmentHeader);

	// make sure the current index block does not get too large; if it does,
	// insert new descriptor (in-memory dictionary entry)
	long long anticipatedFilePos =
		bytesWrittenToFile + cacheBytesUsed + tempSegmentCount * sizeof(PostingListSegmentHeader) + 64;
	if (anticipatedFilePos > startPosOfLastBlock + BYTES_PER_INDEX_BLOCK)
		if (comparison != 0)
			addDescriptor(term);

	// update member variables
	header.listCount++;
	if (comparison != 0)
		header.termCount++;
	header.postingCount += count;

	if (mustReleaseLock)
		releaseLock();
} // end of addPostings(char*, byte*, int, int, offset, offset)
Esempio n. 12
0
CompactIndex2::CompactIndex2(Index *owner, const char *fileName, bool create, bool use_O_DIRECT) {
	this->owner = owner;
	this->fileName = duplicateString(fileName);
	this->compressor = compressorForID[indexCompressionMode];
	this->use_O_DIRECT = use_O_DIRECT;
	baseFile = NULL;
	inMemoryIndex = NULL;

	if (!create)
		initializeForQuerying();
	else {
		header.termCount = 0;
		header.listCount = 0;
		header.postingCount = 0;
		header.descriptorCount = 0;

		int flags = O_CREAT | O_TRUNC | O_RDWR | O_LARGEFILE;
		if (use_O_DIRECT)
			flags |= (O_DIRECT | O_SYNC);
		fileHandle = open(fileName, flags, DEFAULT_FILE_PERMISSIONS);

		if (fileHandle < 0) {
			snprintf(errorMessage, sizeof(errorMessage),
					"Unable to create on-disk index: %s", fileName);
			log(LOG_ERROR, LOG_ID, errorMessage);
			perror(NULL);
			exit(1);
		}
		else {
			// create File object to be used by all posting lists; initial usage count: 1
			// setting the usage count to 1 makes sure the object is not destroyed by
			// its children (see FileFile for details)
			baseFile = new FileFile(fileName, (off_t)0, 1);
		}

		// allocate space for write buffer; must be properly mem-aligned because we
		// want to be able to access the output file with O_DIRECT
		int status = posix_memalign((void**)&writeCache, 4096, WRITE_CACHE_SIZE);
		if (status != 0) {
			log(LOG_ERROR, LOG_ID, "Unable to allocate aligned memory for write buffer");
			perror("posix_memalign");
			exit(1);
		}

		// write file signature into write cache
		memcpy(writeCache, CI2_SIGNATURE, CI2_SIGNATURE_LENGTH);
		cacheBytesUsed = CI2_SIGNATURE_LENGTH;

		// initialize cache status variables
		bytesWrittenToFile = 0;
		tempSegmentCount = 0;
		totalSizeOfTempSegments = 0;
		lastTermAdded[0] = 0;
		readOnly = false;

		// initialize descriptor table
		allocatedForDescriptors = 4096;
		usedByDescriptors = 0;
		compressedDescriptors = (byte*)malloc(allocatedForDescriptors);
		groupDescriptors = NULL;
		firstTermInLastBlock[0] = 0;
		startPosOfLastBlock = 0;
		addDescriptor("");

		usedByPLSH = 0;
		allocatedForPLSH = 256;
		temporaryPLSH = (byte*)malloc(allocatedForPLSH);

		currentTermLastPosting = 0;
		currentTermSegmentCount = 0;
		currentTermMarker = -1;

		// print useful debug message and seek to start of file
		sprintf(errorMessage, "Creating new on-disk index: %s", fileName);
		log(LOG_DEBUG, LOG_ID, errorMessage);
		if (!use_O_DIRECT)
			forced_write(fileHandle, &header, sizeof(header));
		lseek(fileHandle, 0, SEEK_SET);
	}
} // end of CompactIndex2(Index*, char*, bool, bool)
Esempio n. 13
0
void CompactIndex2::addPostings(const char *term, byte *postings,
		int byteLength, int count, offset first, offset last) {
	assert(!readOnly);
	assert((count > 0) && (last >= first) && (term[0] != 0));

	// if we receive more postings than we can put into a list segment without
	// violating the MIN_SEGMENT_SIZE/MAX_SEGMENT_SIZE constraint, we need to
	// split the list into sub-lists of manageable size: decompress and pass
	// to the method that deals with uncompressed lists
	if ((count > MAX_SEGMENT_SIZE) ||
	    (extractCompressionModeFromList(postings) != indexCompressionMode)) {
		int listLengthFromCompressor;
		offset *uncompressed =
			decompressList(postings, byteLength, &listLengthFromCompressor, NULL);
		assert(listLengthFromCompressor == count);
		CompactIndex::addPostings(term, uncompressed, count);
		free(uncompressed);
		return;
	}

	// check if the terms come in pre-sorted
	int comparison = strcmp(term, lastTermAdded);
	assert(comparison >= 0);
	if (comparison != 0) {
		// new term: need to copy segments descriptors for old one to write cache
		copySegmentsToWriteCache();
		if (cacheBytesUsed + 256 > WRITE_CACHE_SIZE)
			flushPartialWriteCache();
		usedByPLSH = 0;
		currentTermLastPosting = 0;
		currentTermSegmentCount = 0;

		// sorry; we do not allow any term that is right of the guardian term
		if (strcmp(term, (char*)CI2_GUARDIAN) >= 0)
			return;

		if (bytesWrittenToFile + cacheBytesUsed >= startPosOfLastBlock + BYTES_PER_INDEX_BLOCK)
			addDescriptor(term);

		cacheBytesUsed +=
			encodeFrontCoding(term, lastTermAdded, &writeCache[cacheBytesUsed]);
		strcpy(lastTermAdded, term);

		header.termCount++;
	}

	// add current list segment to segments accumulated for current term
	if (usedByPLSH + 256 > allocatedForPLSH) {
		allocatedForPLSH = (int)(allocatedForPLSH * 1.21 + 4096);
		temporaryPLSH = (byte*)realloc(temporaryPLSH, allocatedForPLSH);
	}
	PostingListSegmentHeader plsh;
	plsh.postingCount = count;
	plsh.byteLength = byteLength;
	plsh.firstElement = first;
	plsh.lastElement = last;
	usedByPLSH += compressPLSH(&plsh, currentTermLastPosting, &temporaryPLSH[usedByPLSH]);

	if (cacheBytesUsed + byteLength + 256 > WRITE_CACHE_SIZE)
		flushPartialWriteCache();

	if (currentTermSegmentCount > 0) {
		// send continuation flag for current list
		writeCache[cacheBytesUsed++] = 255;

		if (currentTermSegmentCount == 1) {
			// if we are at the second segment for the current term, then reserve space
			// for a 64-bit marker; the marker's value will be set later on and can be
			// used by the query processor to seek directly to the term's list of sync
			// points, skipping over the postings data when initializing the list object
			currentTermMarker = bytesWrittenToFile + cacheBytesUsed;
			int64_t dummyMarker;
			cacheBytesUsed += sizeof(dummyMarker);
		}
	} // end if (currentTermSegmentCount > 0)

	cacheBytesUsed += compressPLSH(&plsh, currentTermLastPosting, &writeCache[cacheBytesUsed]);
	memcpy(&writeCache[cacheBytesUsed], postings, byteLength);
	cacheBytesUsed += byteLength;
	
	currentTermLastPosting = last;
	currentTermSegmentCount++;

	header.postingCount += count;
	header.listCount++;
} // end of addPostings(char*, byte*, int, int, offset, offset)
Esempio n. 14
0
QT_BEGIN_NAMESPACE

QBB10BrightStyle::QBB10BrightStyle() :
    QPixmapStyle()
{
    addDescriptor(PB_Enabled,
                  QLatin1String("://bright/button/core_button_inactive.png"),
                  QMargins(13, 13, 13, 13),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_Checked,
                  QLatin1String("://bright/button/core_button_enabled_selected.png"),
                  QMargins(13, 13, 13, 13),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_Pressed,
                  QLatin1String("://bright/button/core_button_pressed.png"),
                  QMargins(13, 13, 13, 13),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_Disabled,
                  QLatin1String("://bright/button/core_button_disabled.png"),
                  QMargins(13, 13, 13, 13),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_PressedDisabled,
                  QLatin1String("://bright/button/core_button_disabled_selected.png"),
                  QMargins(13, 13, 13, 13),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));

    addDescriptor(LE_Enabled,
                  QLatin1String("://bright/lineedit/core_textinput_bg.png"),
                  QMargins(8, 8, 8, 8));
    addDescriptor(LE_Disabled,
                  QLatin1String("://bright/lineedit/core_textinput_bg_disabled.png"),
                  QMargins(8, 8, 8, 8));
    addDescriptor(LE_Focused,
                  QLatin1String("://bright/lineedit/core_textinput_bg_highlight.png"),
                  QMargins(8, 8, 8, 8));

    copyDescriptor(LE_Enabled, TE_Enabled);
    copyDescriptor(LE_Disabled, TE_Disabled);
    copyDescriptor(LE_Focused, TE_Focused);

    addPixmap(CB_Enabled,
              QLatin1String("://bright/checkbox/core_checkbox_enabled.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(CB_Checked,
              QLatin1String("://bright/checkbox/core_checkbox_checked.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(CB_Pressed,
              QLatin1String("://bright/checkbox/core_checkbox_pressed.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(CB_PressedChecked,
              QLatin1String("://bright/checkbox/core_checkbox_pressed_checked.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(CB_Disabled,
              QLatin1String("://bright/checkbox/core_checkbox_disabled.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(CB_DisabledChecked,
              QLatin1String("://bright/checkbox/core_checkbox_disabled_checked.png"),
              QMargins(16, 16, 16, 16));

    addPixmap(RB_Enabled,
              QLatin1String("://bright/radiobutton/core_radiobutton_inactive.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(RB_Checked,
              QLatin1String("://bright/radiobutton/core_radiobutton_checked.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(RB_Pressed,
              QLatin1String("://bright/radiobutton/core_radiobutton_pressed.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(RB_Disabled,
              QLatin1String("://bright/radiobutton/core_radiobutton_disabled.png"),
              QMargins(16, 16, 16, 16));
    addPixmap(RB_DisabledChecked,
              QLatin1String("://bright/radiobutton/core_radiobutton_disabled_checked.png"),
              QMargins(16, 16, 16, 16));

    addDescriptor(PB_HBackground,
                  QLatin1String("://bright/progressbar/core_progressindicator_bg.png"),
                  QMargins(10, 10, 10, 10),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_HContent,
                  QLatin1String("://bright/progressbar/core_progressindicator_fill.png"),
                  QMargins(10, 10, 10, 10),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_HComplete,
                  QLatin1String("://bright/progressbar/core_progressindicator_complete.png"),
                  QMargins(10, 10, 10, 10),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(PB_VBackground,
                  QLatin1String("://bright/progressbar/core_progressindicator_vbg.png"),
                  QMargins(10, 10, 10, 10),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
    addDescriptor(PB_VContent,
                  QLatin1String("://bright/progressbar/core_progressindicator_vfill.png"),
                  QMargins(10, 10, 10, 10),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
    addDescriptor(PB_VComplete,
                  QLatin1String("://bright/progressbar/core_progressindicator_vcomplete.png"),
                  QMargins(10, 10, 10, 10),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));

    addDescriptor(SG_HEnabled,
                  QLatin1String("://bright/slider/core_slider_enabled.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(SG_HDisabled,
                  QLatin1String("://bright/slider/core_slider_disabled.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(SG_HActiveEnabled,
                  QLatin1String("://bright/slider/core_slider_inactive.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(SG_HActivePressed,
                  QLatin1String("://bright/slider/core_slider_active.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(SG_HActiveDisabled,
                  QLatin1String("://bright/slider/core_slider_cache.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(SG_VEnabled,
                  QLatin1String("://bright/slider/core_slider_venabled.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
    addDescriptor(SG_VDisabled,
                  QLatin1String("://bright/slider/core_slider_vdisabled.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
    addDescriptor(SG_VActiveEnabled,
                  QLatin1String("://bright/slider/core_slider_vinactive.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
    addDescriptor(SG_VActivePressed,
                  QLatin1String("://bright/slider/core_slider_vactive.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
    addDescriptor(SG_VActiveDisabled,
                  QLatin1String("://bright/slider/core_slider_vcache.png"),
                  QMargins(50, 50, 50, 50),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));

    addPixmap(SH_HEnabled,
                  QLatin1String("://bright/slider/core_slider_handle.png"));
    addPixmap(SH_HDisabled,
                  QLatin1String("://bright/slider/core_slider_handle_disabled.png"));
    addPixmap(SH_HPressed,
                  QLatin1String("://bright/slider/core_slider_handle_pressed.png"));
    addPixmap(SH_VEnabled,
                  QLatin1String("://bright/slider/core_slider_handle.png"));
    addPixmap(SH_VDisabled,
                  QLatin1String("://bright/slider/core_slider_handle_disabled.png"));
    addPixmap(SH_VPressed,
                  QLatin1String("://bright/slider/core_slider_handle_pressed.png"));

    addDescriptor(DD_ButtonEnabled,
                  QLatin1String("://bright/combobox/core_dropdown_button.png"),
                  QMargins(14, 14, 14, 14),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(DD_ButtonDisabled,
                  QLatin1String("://bright/combobox/core_dropdown_button_disabled.png"),
                  QMargins(14, 14, 14, 14),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(DD_ButtonPressed,
                  QLatin1String("://bright/combobox/core_dropdown_button_pressed.png"),
                  QMargins(14, 14, 14, 14),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(DD_ItemSelected,
                  QLatin1String("://bright/combobox/core_listitem_active.png"));

    addPixmap(DD_ArrowEnabled,
                  QLatin1String("://bright/combobox/core_dropdown_button_arrowdown.png"),
                  QMargins(35, 39, 35, 39));
    copyPixmap(DD_ArrowEnabled, DD_ArrowDisabled);
    addPixmap(DD_ArrowPressed,
                  QLatin1String("://bright/combobox/core_dropdown_button_arrowdown_pressed.png"),
                  QMargins(35, 39, 35, 39));
    addPixmap(DD_ArrowOpen,
                  QLatin1String("://bright/combobox/core_dropdown_button_arrowup.png"),
                  QMargins(35, 39, 35, 39));
    addDescriptor(DD_PopupDown,
                  QLatin1String("://bright/combobox/core_dropdown_menu.png"),
                  QMargins(12, 12, 12, 12),
                  QTileRules(Qt::StretchTile, Qt::StretchTile));
    addDescriptor(DD_PopupUp,
                  QLatin1String("://bright/combobox/core_dropdown_menuup.png"),
                  QMargins(12, 12, 12, 12),
                  QTileRules(Qt::StretchTile, Qt::StretchTile));
    addPixmap(DD_ItemSeparator,
                  QLatin1String("://bright/combobox/core_dropdown_divider.png"),
                  QMargins(5, 0, 5, 0));

    addDescriptor(ID_Selected,
                  QLatin1String("://bright/listitem/core_listitem_active.png"));
    addPixmap(ID_Separator,
                  QLatin1String("://bright/listitem/core_listitem_divider.png"));

    addDescriptor(SB_Horizontal,
                  QLatin1String("://bright/scrollbar/core_scrollbar.png"),
                  QMargins(7, 8, 7, 8),
                  QTileRules(Qt::RepeatTile, Qt::StretchTile));
    addDescriptor(SB_Vertical,
                  QLatin1String("://bright/scrollbar/core_scrollbar_v.png"),
                  QMargins(8, 7, 8, 7),
                  QTileRules(Qt::StretchTile, Qt::RepeatTile));
}