src/core/channels/Channel.c
static McxStatus ChannelLocalSetReference(ChannelLocal * local,
                                          const void * reference,
                                          ChannelType type) {
    Channel * channel = (Channel *) local;
    ChannelInfo * info = NULL;

    info = channel->GetInfo(channel);
    if (!info) {
        mcx_log(LOG_ERROR, "Port: Set local value reference: Port not set up");
        return RETURN_ERROR;
    }
    if (channel->data->internalValue
        && !(info->defaultValue && channel->data->internalValue == ChannelValueReference(info->defaultValue))) {
        mcx_log(LOG_ERROR, "Port %s: Set local value reference: Reference already set", info->GetLogName(info));
        return RETURN_ERROR;
    }
    if (CHANNEL_UNKNOWN != type) {
        if (info->GetType(info) != type) {
            mcx_log(LOG_ERROR, "Port %s: Set local value reference: Mismatching types", info->GetLogName(info));
            return RETURN_ERROR;
        }
    }

    channel->data->internalValue = reference;

    return RETURN_OK;
}
// TODO: Unify with ChannelOutsetReference (similar code)
Unify with ChannelOutsetReference (similar code)
Unify with ChannelOutsetReference ( similar code )
static McxStatus ChannelLocalSetReference(ChannelLocal * local,
                                          const void * reference,
                                          ChannelType type) {
    Channel * channel = (Channel *) local;
    ChannelInfo * info = NULL;
    info = channel->GetInfo(channel);
    if (!info) {
        mcx_log(LOG_ERROR, "Port: Set local value reference: Port not set up");
        return RETURN_ERROR;
    }
    if (channel->data->internalValue
        && !(info->defaultValue && channel->data->internalValue == ChannelValueReference(info->defaultValue))) {
        mcx_log(LOG_ERROR, "Port %s: Set local value reference: Reference already set", info->GetLogName(info));
        return RETURN_ERROR;
    }
    if (CHANNEL_UNKNOWN != type) {
        if (info->GetType(info) != type) {
            mcx_log(LOG_ERROR, "Port %s: Set local value reference: Mismatching types", info->GetLogName(info));
            return RETURN_ERROR;
        }
    }
    channel->data->internalValue = reference;
    return RETURN_OK;
}
static McxStatus ChannelLocalSetReference ( ChannelLocal * local , const void * reference , ChannelType type ) { Channel * channel = ( Channel * ) local ; ChannelInfo * info = NULL ; info = channel -> GetInfo ( channel ) ; if ( ! info ) { mcx_log ( LOG_ERROR , " " ) ; return RETURN_ERROR ; } if ( channel -> data -> internalValue && ! ( info -> defaultValue && channel -> data -> internalValue == ChannelValueReference ( info -> defaultValue ) ) ) { mcx_log ( LOG_ERROR , " " , info -> GetLogName ( info ) ) ; return RETURN_ERROR ; } if ( CHANNEL_UNKNOWN != type ) { if ( info -> GetType ( info ) != type ) { mcx_log ( LOG_ERROR , " " , info -> GetLogName ( info ) ) ; return RETURN_ERROR ; } } channel -> data -> internalValue = reference ; return RETURN_OK ; }
TODO: Unify with ChannelOutsetReference (similar code)
TODO : Unify with ChannelOutsetReference ( similar code )