void receiveTranslatedWriteRequest(cJSON* nameObject, cJSON* root) {
    char* name = nameObject->valuestring;
    cJSON* value = cJSON_GetObjectItem(root, "value");

    // Optional, may be NULL
    cJSON* event = cJSON_GetObjectItem(root, "event");

    CanSignal* signal = lookupSignal(name, getSignals(), getSignalCount(),
            true);
    if(signal != NULL) {
        if(value == NULL) {
            debug("Write request for %s missing value", name);
            return;
        }
        sendCanSignal(signal, value, getSignals(), getSignalCount());
    } else {
        CanCommand* command = lookupCommand(name, getCommands(),
                getCommandCount());
        if(command != NULL) {
            command->handler(name, value, event, getSignals(),
                    getSignalCount());
        } else {
            debug("Writing not allowed for signal with name %s", name);
        }
    }
}
bool openxc::commands::handleSimple(openxc_VehicleMessage* message) {
    bool status = true;
    if(message->has_simple_message) {
        openxc_SimpleMessage* simpleMessage =
                &message->simple_message;
        if(simpleMessage->has_name) {
            CanSignal* signal = lookupSignal(simpleMessage->name,
                    getSignals(), getSignalCount(), true);
            if(signal != NULL) {
                if(!simpleMessage->has_value) {
                    debug("Write request for %s missing value", simpleMessage->name);
                    status = false;
                }

                can::write::encodeAndSendSignal(signal, &simpleMessage->value, false);
                // TODO support writing evented signals
            } else {
                CanCommand* command = lookupCommand(simpleMessage->name,
                        getCommands(), getCommandCount());
                if(command != NULL) {
                    // TODO this still isn't that flexible, can't accept
                    // arbitrary parameters in your command - still stuck with
                    // this 'value' and 'event' business, where the eventeds all
                    // have string values
                    // TODO could simplify it by passing the entire
                    // SimpleMessage to the handler
                    command->handler(simpleMessage->name,
                            &simpleMessage->value,
                            simpleMessage->has_event ? &simpleMessage->event : NULL,
                            getSignals(), getSignalCount());
                } else {
                    debug("Writing not allowed for signal \"%s\"",
                            simpleMessage->name);
                    status = false;
                }
            }
        }
    }
    return status;
}