Skip to content

Commit 42a5cf8

Browse files
authored
Replace enum_as_bitmask with container_pointer_no_template (#1402)
1 parent 3585ffe commit 42a5cf8

File tree

4 files changed

+328
-327
lines changed

4 files changed

+328
-327
lines changed

aioesphomeapi/api.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ message ListEntitiesLightResponse {
506506
string name = 3;
507507
reserved 4; // Deprecated: was string unique_id
508508

509-
repeated ColorMode supported_color_modes = 12 [(enum_as_bitmask) = true];
509+
repeated ColorMode supported_color_modes = 12 [(container_pointer_no_template) = "light::ColorModeMask"];
510510
// next four supports_* are for legacy clients, newer clients should use color modes
511511
// Deprecated in API version 1.6
512512
bool legacy_supports_brightness = 5 [deprecated=true];

aioesphomeapi/api_options.proto

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ extend google.protobuf.FieldOptions {
7171
// and is ideal when the exact size is known before populating the array.
7272
optional bool fixed_vector = 50013 [default=false];
7373

74-
// enum_as_bitmask: Encode repeated enum fields as a uint32_t bitmask
75-
// When set on a repeated enum field, the field will be stored as a single uint32_t
76-
// where each bit represents whether that enum value is present. This is ideal for
77-
// enums with ≤32 values and eliminates all vector template instantiation overhead.
78-
// The enum values should be sequential starting from 0.
79-
// Encoding: bit N set means enum value N is present in the set.
80-
// Example: {ColorMode::RGB, ColorMode::WHITE} → bitmask with bits 5 and 6 set
81-
optional bool enum_as_bitmask = 50014 [default=false];
74+
// container_pointer_no_template: Use a non-template container type for repeated fields
75+
// Similar to container_pointer, but for containers that don't take template parameters.
76+
// The container type is used as-is without appending element type.
77+
// The container must have:
78+
// - begin() and end() methods returning iterators
79+
// - empty() method
80+
// Example: [(container_pointer_no_template) = "light::ColorModeMask"]
81+
// generates: const light::ColorModeMask *supported_color_modes{};
82+
optional string container_pointer_no_template = 50014;
8283
}

aioesphomeapi/api_options_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aioesphomeapi/api_pb2.py

Lines changed: 317 additions & 317 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)