コード例 #1
0
ファイル: mms_server.c プロジェクト: andy-w/libiec61850
MmsValueIndication
MmsServer_setValue(MmsServer self, MmsDomain* domain, char* itemId, MmsValue* value)
{
	MmsValueIndication indication;

	if (self->writeHandler != NULL) {
		indication =  self->writeHandler(self->writeHandlerParameter, domain, itemId, value);
	}
	else {
		//TODO if value in cache write to cache
		//else access denied
		MmsValue* cachedValue;

		cachedValue = MmsServer_getValueFromCache(self, domain, itemId);

		if (cachedValue != NULL) {
			MmsValue_update(cachedValue, value);
			indication = MMS_VALUE_OK;
		}
		else
			indication = MMS_VALUE_ACCESS_DENIED;
	}

	return indication;
}
コード例 #2
0
ファイル: mms_server.c プロジェクト: nono19710321/libiec61850
MmsDataAccessError
mmsServer_setValue(MmsServer self, MmsDomain* domain, char* itemId, MmsValue* value,
        MmsServerConnection* connection)
{
    MmsDataAccessError indication;

    if (self->writeHandler != NULL) {
        indication = self->writeHandler(self->writeHandlerParameter, domain,
                itemId, value, connection);
    } else {
        MmsValue* cachedValue;

        if (domain == NULL)
            domain = (MmsDomain*) self->device;

        cachedValue = MmsServer_getValueFromCache(self, domain, itemId);

        if (cachedValue != NULL) {
            MmsValue_update(cachedValue, value);
            indication = DATA_ACCESS_ERROR_SUCCESS;
        } else
            indication = DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID;
    }

    return indication;
}