Example #1
0
static void /* will be called by ISO server stack */
isoConnectionIndicationHandler(IsoConnectionIndication indication,
		void* parameter, IsoConnection connection)
{
	MmsServer mmsServer = (MmsServer) parameter;

	if (indication == ISO_CONNECTION_OPENED) {
		MmsServerConnection* mmsCon = MmsServerConnection_init(0, mmsServer, connection);
		Map_addEntry(mmsServer->openConnections, connection, mmsCon);

		if (mmsServer->connectionHandler != NULL)
			mmsServer->connectionHandler(mmsServer->connectionHandlerParameter,
					mmsCon, MMS_SERVER_NEW_CONNECTION);
	}
	else if (indication == ISO_CONNECTION_CLOSED) {
		MmsServerConnection* mmsCon = (MmsServerConnection*)
				Map_removeEntry(mmsServer->openConnections, connection, false);

		if (mmsServer->connectionHandler != NULL)
				mmsServer->connectionHandler(mmsServer->connectionHandlerParameter,
					mmsCon, MMS_SERVER_CONNECTION_CLOSED);

		if (mmsCon != NULL)
			MmsServerConnection_destroy(mmsCon);
	}
}
Example #2
0
static Map
createValueCaches(MmsDevice* device)
{
    Map valueCaches = Map_create();

    int i;
    for (i = 0; i < device->domainCount; i++) {
        MmsValueCache valueCache = MmsValueCache_create(device->domains[i]);
        Map_addEntry(valueCaches, device->domains[i], valueCache);
    }

#if (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1)
    MmsValueCache valueCache = MmsValueCache_create((MmsDomain*) device);
    Map_addEntry(valueCaches, (MmsDomain*) device, valueCache);
#endif

    return valueCaches;
}
Example #3
0
static Map
createValueCachesForDomains(MmsDevice* device)
{
	Map valueCaches =  Map_create();

	int i;
	for (i = 0; i < device->domainCount; i++) {
		MmsValueCache valueCache = MmsValueCache_create(device->domains[i]);
		Map_addEntry(valueCaches, device->domains[i], valueCache);
	}

	return valueCaches;
}
Example #4
0
void
MmsValueCache_insertValue(MmsValueCache self, char* itemId, MmsValue* value)
{
	MmsVariableSpecification* typeSpec = MmsDomain_getNamedVariable(self->domain, itemId);

	if (typeSpec != NULL) {
		MmsValueCacheEntry* cacheEntry = (MmsValueCacheEntry*) GLOBAL_MALLOC(sizeof(MmsValueCacheEntry));

		cacheEntry->value = value;
		cacheEntry->typeSpec = typeSpec;

		Map_addEntry(self->map, copyString(itemId), cacheEntry);
	}
	else
		if (DEBUG) printf("Cannot insert value into cache %s : no typeSpec found!\n", itemId);
}