Skip to content

I am not sure how to call setHidMidConfig function on Flic2Button. #3

@tozzen0121

Description

@tozzen0121
/**
 * Sets a new hid midi config.
 *
 * <p>The button must have firmware version at least version 9, and the button must be connected and ready.</p>
 *
 * @param config   The config blob
 * @param callback Will be called when the operation completes (no callback if button disconnects before completion)
 */
public void setHidMidiConfig(final byte[] config, final SetHidMidiConfigCallback callback) {
    if (callback == null) {
        throw new IllegalArgumentException("callback is null");
    }
    manager.handler.post(new Runnable() {
        @Override
        public void run() {
            if (Flic2Button.this.isConnected) {
                Session s = Flic2Button.this.currentGattCb.getSession();
                if (s != null && s.isEstablished()) {
                    if (Flic2Button.this.firmwareVersion >= 9) {
                        s.setHidMidiConfig(config, callback);
                    } else {
                        callback.onResult(SetHidMidiConfigCallback.INCOMPATIBLE_FIRMWARE_VERSION);
                    }
                    return;
                }
            }
            callback.onResult(SetHidMidiConfigCallback.NOT_READY);
        }
    });
}

@Emill
Please guide which type byte-config need to be sended to button? thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions