Skip to content

Missing handler for brightness message type #26

@davemac

Description

@davemac

Summary

The brightness,<level> TCP command is parsed by MyMessageService.java but never handled by MainActivity.java, making brightness-only control impossible.

Details

Parsing works correctly

app/src/main/java/com/dan/eo1/MyMessageService.java lines 86-89:

if (message.startsWith("brightness")) {
    intent.putExtra("type", "brightness");
    intent.putExtra("level", Float.parseFloat(message.replace("brightness,","")));
}

But no handler exists

MainActivity.java has handlers for these message types:

  • options
  • image / photo / video
  • resume
  • tag
  • url

Missing: type.equals("brightness") - the broadcast is received but silently ignored.

Impact

Users cannot change brightness without using the options command, which bundles brightness with interval and quiet hours. Any change to those values triggers loadImagesFromFlickr(), causing an unwanted image reload with spinner.

Suggested Fix

Add handler in MainActivity.java around line 830:

if (type.equals("brightness")) {
    float level = intent.getFloatExtra("level", -1f);
    WindowManager.LayoutParams params = getWindow().getAttributes();
    if (level == -1.0f) {
        autobrightness = true;
        adjustScreenBrightness(lastLightLevel);
    } else {
        autobrightness = false;
        brightnesslevel = level;
        params.screenBrightness = level;
        getWindow().setAttributes(params);
    }
    SharedPreferences settings = getSharedPreferences("prefs", MODE_PRIVATE);
    SharedPreferences.Editor editor = settings.edit();
    editor.putBoolean("autobrightness", autobrightness);
    editor.putFloat("brightnesslevel", brightnesslevel);
    editor.apply();
}

Environment

  • EO1 app version: 0.0.9
  • Discovered while building a web-based partner app replacement

Thanks for keeping EO1 devices alive! 🎨

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions