Ejemplo n.º 1
0
void CtrlrMIDILibrary::setCurrentSnapshot(const Uuid &uuid, const MidiProgramChangeControl midiProgramChangeControl)
{
    ValueTree snap = getSnapshots().getChildWithProperty(Ids::uuid, uuid.toString());

    if (isProgram(snap))
		setCurrentSnapshot (snap,midiProgramChangeControl);
	else
		_WRN("CtrlrMIDILibrary::setCurrentSnapshot no snapshot with UUID="+uuid.toString());
}
Ejemplo n.º 2
0
void CtrlrMIDILibrary::setCurrentProgram(const Uuid &uuid, const MidiProgramChangeControl midiProgramChangeControl, const bool changePanelState, const bool setAsCurrentProgram)
{
	ValueTree program = getCurrentBank().getChildWithProperty(Ids::uuid, uuid.toString());

    if (isProgram(program))
		setCurrentProgram (program, midiProgramChangeControl, changePanelState, setAsCurrentProgram);
	else
		_WRN("CtrlrMIDILibrary::setCurrentProgram no program with UUID="+uuid.toString());
}
Ejemplo n.º 3
0
void CtrlrMIDILibrary::setCurrentBank(const Uuid &uuid)
{
	_DBG("CtrlrMIDILibrary::setCurrentBank uuid="+uuid.toString());

	if (uuid == getUuid(getRoot()))
	{
		setCurrentBank (getRoot());
		return;
	}

	setCurrentBank (getRoot().getChildWithProperty(Ids::uuid, uuid.toString()));
}
void CDspIOCtClientHandler::handleToDispatcherPackage (
		const IOSender::Handle& h,
		const SmartPtr<IOPackage>& p )
{

	if ( p->header.type == PET_IO_CLI_AUTHENTICATE_EXEC_SESSION ) {
		const PRL_IO_AUTH_EXEC_REQUEST *authRequest =
			reinterpret_cast<const PRL_IO_AUTH_EXEC_REQUEST*>( p->buffers[0].getImpl() );

		if ( p->data[0].bufferSize < sizeof(*authRequest) ) {
			WRITE_TRACE(DBG_FATAL, "Wrong auth session package!");
			CDspService::instance()->getIOServer().disconnectClient( h );
			return;
		}

		Uuid sessionId = Uuid::toUuid( authRequest->sessionUuid );
		if ( sessionId.isNull() ) {
			WRITE_TRACE(DBG_FATAL, "Wrong auth session package!");
			CDspService::instance()->getIOServer().disconnectClient( h );
			return;
		}

		// Try to find client by auth session
		SmartPtr<CDspClient> client = CDspService::instance()->
			getClientManager().getUserSession( sessionId.toString() );

		bool auth = client.isValid();

		PRL_IO_AUTH_RESPONSE authResp = { auth };
		SmartPtr<IOPackage> pkg =
			IOPackage::createInstance( PET_IO_AUTH_RESPONSE,
									   IOPackage::RawEncoding,
									   &authResp, sizeof(authResp) );
		// Save result
		QMutexLocker locker( &m_mutex );

		ClientInfo cliInfo;
		m_ioClients[h] = cliInfo;

		locker.unlock();

		// Send package
		IOSendJob::Handle job =
			CDspService::instance()->getIOServer().sendPackage( h, pkg );
		IOSendJob::Result res =
			CDspService::instance()->getIOServer().waitForSend( job );

		// Close connection if fail
		if ( ! auth || res != IOSendJob::Success ) {
			WRITE_TRACE(DBG_FATAL, "Error: %s", (! auth ? "authentication failed!" :
						"send of authentication pkg failed!"));
			CDspService::instance()->getIOServer().disconnectClient( h );
		}

		return;
	} else if (p->header.type == PET_IO_STDIN_PORTION ||
			p->header.type == PET_IO_STDIN_WAS_CLOSED ||
			p->header.type == PET_IO_CLIENT_PROCESSED_ALL_DESCS_DATA)
	{
		if (!getIOUserSession(h)) {
			WRITE_TRACE(DBG_FATAL, "Client '%s' is not authed! Close connection!",
					QSTR2UTF8(h));
			CDspService::instance()->getIOServer().disconnectClient( h );
			return;
		}

		SmartPtr<CDspCtResponseHandler> hResponse = getResponseHandler(h,
				Uuid::toString(p->header.parentUuid));
		if (!hResponse) {
			WRITE_TRACE(DBG_FATAL, "Client %s guest session %s is not created pkt.type=%d",
					QSTR2UTF8(h),
					QSTR2UTF8((Uuid::toString(p->header.parentUuid))),
					p->header.type);
			CDspService::instance()->getIOServer().disconnectClient( h );
			return;
		}
		hResponse->process(p);
	}
}
Ejemplo n.º 5
0
ValueTree CtrlrMIDILibrary::getSnapshot(const Uuid &snapshotUuid)
{
    return (getSnapshots().getChildWithProperty(Ids::uuid, snapshotUuid.toString()));
}
Ejemplo n.º 6
0
ValueTree CtrlrMIDILibrary::getProgram(const Uuid &bankUuid, const Uuid &programUuid)
{
	return (getBank(bankUuid).getChildWithProperty(Ids::uuid, programUuid.toString()));
}
Ejemplo n.º 7
0
inline void MetadataNodeImpl::setValue(const Uuid& u)
{
    m_type = "uuid";
    m_value = u.toString();
}
Ejemplo n.º 8
0
 // ---------------------------------------------------------------------------------
 void KTasksComboBox::select ( Uuid const& id )
 {
   int index = findData ( QVariant ( id.toString() ) );
   setCurrentIndex ( index );
 }
Ejemplo n.º 9
0
void IdTest::testUuids() {
	Uuid rootId;
	Uuid node1Id;
	Uuid node2Id;
	Uuid node2IdCopy;

	rootId = 0;
	node1Id = 1;
	node2Id = 2;
	node2IdCopy = node2Id;

	/* test (in-) equality relations */
	CPPUNIT_ASSERT(rootId != node1Id);
	CPPUNIT_ASSERT(node1Id != node2Id);
	CPPUNIT_ASSERT(node2Id == node2IdCopy);

	CPPUNIT_ASSERT(node1Id < node2Id);
	CPPUNIT_ASSERT(node1Id <= node2Id);
	CPPUNIT_ASSERT(node2Id > node1Id);
	CPPUNIT_ASSERT(node2Id >= node1Id);


	/* Test in a map */
	std::map<Uuid, std::string> someMapWithIds;
	someMapWithIds.clear();

	CPPUNIT_ASSERT_EQUAL(0u , static_cast<unsigned int>(someMapWithIds.size()));

	Uuid someId; // = 0
	someId = 0;
	someMapWithIds.insert(std::make_pair(someId, "hello"));
	CPPUNIT_ASSERT_EQUAL(1u , static_cast<unsigned int>(someMapWithIds.size()));

	/* Test UUID specifics */
	Uuid anotherId;
	CPPUNIT_ASSERT(anotherId.isNil());
	anotherId = 1;
	CPPUNIT_ASSERT(!anotherId.isNil());
	Uuid nullId = 0;
	CPPUNIT_ASSERT(nullId.isNil());

	Uuid anotherIdCopy (anotherId);
	CPPUNIT_ASSERT(anotherIdCopy == anotherIdCopy);

	/* Test constness */
	const Uuid node3Id;
	CPPUNIT_ASSERT(node3Id.isNil());
	CPPUNIT_ASSERT(node1Id != node3Id);
	CPPUNIT_ASSERT(node3Id != node1Id);
	CPPUNIT_ASSERT(!(node1Id == node3Id));
	CPPUNIT_ASSERT(!(node3Id == node1Id));

	CPPUNIT_ASSERT(!(node1Id < node3Id));
	CPPUNIT_ASSERT(!(node1Id <= node3Id));
	CPPUNIT_ASSERT(node2Id > node3Id);
	CPPUNIT_ASSERT(node2Id >= node3Id);

	/* test swapping */
	Uuid node4Id = 4;
	Uuid node5Id = 5;
//	node4Id = 4;
//	node5Id = 5;
	Uuid node4IdCopy(node4Id);
	Uuid node5IdCopy(node5Id);

	CPPUNIT_ASSERT(node4IdCopy == node4Id);
	CPPUNIT_ASSERT(node5IdCopy == node5Id);
	CPPUNIT_ASSERT(node4IdCopy < node5IdCopy);
	node4IdCopy.swap(node5IdCopy);
	CPPUNIT_ASSERT(node4IdCopy == node5Id);
	CPPUNIT_ASSERT(node5IdCopy == node4Id);
	CPPUNIT_ASSERT(node4IdCopy > node5IdCopy);

	LOG(DEBUG) << "rootId as UUID = " << rootId.toString();
	LOG(DEBUG) << "node1Id as UUID = " << node1Id.toString();
	LOG(DEBUG) << "node2Id as UUID = " << node2Id.toString();
	LOG(DEBUG) << "node2IdCopy as UUID = " << node2IdCopy.toString();
	LOG(DEBUG) << "node3Id as UUID = " << node3Id.toString();
	LOG(DEBUG) << "node4Id as UUID = " << node4Id;
	LOG(DEBUG) << "node5Id as UUID = " << node5Id;

	Uuid node6Id;
	unsigned int idValue = 513;
	node6Id = idValue;
	LOG(DEBUG) << "node6Id as UUID = " << node6Id;
	unsigned int node6IdAsInt = uuidToUnsignedInt(node6Id);
	CPPUNIT_ASSERT_EQUAL(idValue, node6IdAsInt);
}