Skip to content

Commit

Permalink
[WIP] Overlay CCT Control
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphiiko committed Aug 21, 2024
1 parent 642122d commit 93c8b22
Show file tree
Hide file tree
Showing 13 changed files with 837 additions and 293 deletions.
10 changes: 10 additions & 0 deletions proto/overlay-sidecar.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ message OyasumiSidecarState {
bool sleep_preparation_available = 9;
bool sleep_preparation_timed_out = 10;
bool system_mic_muted = 11;
OyasumiSidecarCCTState cct_state = 12;
}

// No longer required, but reserved for future settings
Expand Down Expand Up @@ -162,6 +163,15 @@ message OyasumiSidecarBrightnessState {
double hardware_max_brightness = 13;
}

message OyasumiSidecarCCTState {
bool enabled = 1;
uint32 value = 2;
uint32 min = 3;
uint32 max = 4;
bool transitioning = 5;
uint32 transition_target = 6;
}

enum VrcStatus {
VRC_STATUS_Offline = 0;
VRC_STATUS_Busy = 1;
Expand Down
149 changes: 149 additions & 0 deletions src-grpc-web-client/overlay-sidecar_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ export interface OyasumiSidecarState {
* @generated from protobuf field: bool system_mic_muted = 11;
*/
systemMicMuted: boolean;
/**
* @generated from protobuf field: OyasumiOverlaySidecar.OyasumiSidecarCCTState cct_state = 12;
*/
cctState?: OyasumiSidecarCCTState;
}
/**
* No longer required, but reserved for future settings
Expand Down Expand Up @@ -434,6 +438,35 @@ export interface OyasumiSidecarBrightnessState {
*/
hardwareMaxBrightness: number;
}
/**
* @generated from protobuf message OyasumiOverlaySidecar.OyasumiSidecarCCTState
*/
export interface OyasumiSidecarCCTState {
/**
* @generated from protobuf field: bool enabled = 1;
*/
enabled: boolean;
/**
* @generated from protobuf field: uint32 value = 2;
*/
value: number;
/**
* @generated from protobuf field: uint32 min = 3;
*/
min: number;
/**
* @generated from protobuf field: uint32 max = 4;
*/
max: number;
/**
* @generated from protobuf field: bool transitioning = 5;
*/
transitioning: boolean;
/**
* @generated from protobuf field: uint32 transition_target = 6;
*/
transitionTarget: number;
}
/**
* @generated from protobuf enum OyasumiOverlaySidecar.OyasumiSidecarAutomationsState_AutoAcceptInviteRequests_Mode
*/
Expand Down Expand Up @@ -962,6 +995,7 @@ class OyasumiSidecarState$Type extends MessageType<OyasumiSidecarState> {
{ no: 9, name: 'sleep_preparation_available', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 10, name: 'sleep_preparation_timed_out', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 11, name: 'system_mic_muted', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 12, name: 'cct_state', kind: 'message', T: () => OyasumiSidecarCCTState },
]);
}
create(value?: PartialMessage<OyasumiSidecarState>): OyasumiSidecarState {
Expand Down Expand Up @@ -1042,6 +1076,14 @@ class OyasumiSidecarState$Type extends MessageType<OyasumiSidecarState> {
case /* bool system_mic_muted */ 11:
message.systemMicMuted = reader.bool();
break;
case /* OyasumiOverlaySidecar.OyasumiSidecarCCTState cct_state */ 12:
message.cctState = OyasumiSidecarCCTState.internalBinaryRead(
reader,
reader.uint32(),
options,
message.cctState
);
break;
default:
let u = options.readUnknownField;
if (u === 'throw')
Expand Down Expand Up @@ -1112,6 +1154,13 @@ class OyasumiSidecarState$Type extends MessageType<OyasumiSidecarState> {
/* bool system_mic_muted = 11; */
if (message.systemMicMuted !== false)
writer.tag(11, WireType.Varint).bool(message.systemMicMuted);
/* OyasumiOverlaySidecar.OyasumiSidecarCCTState cct_state = 12; */
if (message.cctState)
OyasumiSidecarCCTState.internalBinaryWrite(
message.cctState,
writer.tag(12, WireType.LengthDelimited).fork(),
options
).join();
let u = options.writeUnknownFields;
if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
Expand Down Expand Up @@ -2414,6 +2463,106 @@ class OyasumiSidecarBrightnessState$Type extends MessageType<OyasumiSidecarBrigh
* @generated MessageType for protobuf message OyasumiOverlaySidecar.OyasumiSidecarBrightnessState
*/
export const OyasumiSidecarBrightnessState = new OyasumiSidecarBrightnessState$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OyasumiSidecarCCTState$Type extends MessageType<OyasumiSidecarCCTState> {
constructor() {
super('OyasumiOverlaySidecar.OyasumiSidecarCCTState', [
{ no: 1, name: 'enabled', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 2, name: 'value', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
{ no: 3, name: 'min', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
{ no: 4, name: 'max', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
{ no: 5, name: 'transitioning', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 6, name: 'transition_target', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
]);
}
create(value?: PartialMessage<OyasumiSidecarCCTState>): OyasumiSidecarCCTState {
const message = {
enabled: false,
value: 0,
min: 0,
max: 0,
transitioning: false,
transitionTarget: 0,
};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined) reflectionMergePartial<OyasumiSidecarCCTState>(this, message, value);
return message;
}
internalBinaryRead(
reader: IBinaryReader,
length: number,
options: BinaryReadOptions,
target?: OyasumiSidecarCCTState
): OyasumiSidecarCCTState {
let message = target ?? this.create(),
end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bool enabled */ 1:
message.enabled = reader.bool();
break;
case /* uint32 value */ 2:
message.value = reader.uint32();
break;
case /* uint32 min */ 3:
message.min = reader.uint32();
break;
case /* uint32 max */ 4:
message.max = reader.uint32();
break;
case /* bool transitioning */ 5:
message.transitioning = reader.bool();
break;
case /* uint32 transition_target */ 6:
message.transitionTarget = reader.uint32();
break;
default:
let u = options.readUnknownField;
if (u === 'throw')
throw new globalThis.Error(
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(
this.typeName,
message,
fieldNo,
wireType,
d
);
}
}
return message;
}
internalBinaryWrite(
message: OyasumiSidecarCCTState,
writer: IBinaryWriter,
options: BinaryWriteOptions
): IBinaryWriter {
/* bool enabled = 1; */
if (message.enabled !== false) writer.tag(1, WireType.Varint).bool(message.enabled);
/* uint32 value = 2; */
if (message.value !== 0) writer.tag(2, WireType.Varint).uint32(message.value);
/* uint32 min = 3; */
if (message.min !== 0) writer.tag(3, WireType.Varint).uint32(message.min);
/* uint32 max = 4; */
if (message.max !== 0) writer.tag(4, WireType.Varint).uint32(message.max);
/* bool transitioning = 5; */
if (message.transitioning !== false) writer.tag(5, WireType.Varint).bool(message.transitioning);
/* uint32 transition_target = 6; */
if (message.transitionTarget !== 0)
writer.tag(6, WireType.Varint).uint32(message.transitionTarget);
let u = options.writeUnknownFields;
if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message OyasumiOverlaySidecar.OyasumiSidecarCCTState
*/
export const OyasumiSidecarCCTState = new OyasumiSidecarCCTState$Type();
/**
* @generated ServiceType for protobuf service OyasumiOverlaySidecar.OyasumiOverlaySidecar
*/
Expand Down
45 changes: 44 additions & 1 deletion src-overlay-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src-overlay-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"just-throttle": "^4.2.0",
"lodash-es": "^4.17.21",
"material-icons": "^1.13.8",
"rxjs": "^7.8.1"
"rxjs": "^7.8.1",
"tailwindcss-multi": "^0.4.6"
}
}
}
37 changes: 37 additions & 0 deletions src-overlay-ui/splash/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width" />

<link rel="modulepreload" href="../_app/immutable/entry/start.915671cf.js">
<link rel="modulepreload" href="../_app/immutable/chunks/index.fb7a625b.js">
<link rel="modulepreload" href="../_app/immutable/chunks/singletons.7b2f7207.js">
<link rel="modulepreload" href="../_app/immutable/chunks/index.52677bcc.js">
<link rel="modulepreload" href="../_app/immutable/entry/app.63a251f4.js">
<link rel="modulepreload" href="../_app/immutable/chunks/preload-helper.41c905a7.js">
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">
<script>
{
__sveltekit_14355yy = {
assets: "/static",
base: new URL("..", location).pathname.slice(0, -1),
env: {}
};

const element = document.currentScript.parentElement;

Promise.all([
import("../_app/immutable/entry/start.915671cf.js"),
import("../_app/immutable/entry/app.63a251f4.js")
]).then(([kit, app]) => {
kit.start(app, element);
});
}
</script>
</div>
</body>
</html>
6 changes: 0 additions & 6 deletions src-overlay-ui/src/lib/components/BrightnessSlider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@
&-title-row {
@apply flex flex-row items-center mb-4;
.material-icons {
@apply text-2xl text-white text-center inline-block;
flex-shrink: 0;
}
span {
@apply text-2xl text-white text-center inline-block;
Expand Down Expand Up @@ -208,9 +204,7 @@
<div class="brightness-slider-container relative" class:disabled={disabled} class:transitioning={isTransitioning}>
<div class="w-full h-full absolute top-0 left-0 bg-black blur-3xl opacity-r50 rounded-full z-0" />
<div class="brightness-slider-title-row z-10">
<!-- <i class="material-icons brightness-level-icon glow-80">brightness_5</i>-->
<span class="glow-80">{label}</span>
<!-- <i class="material-icons brightness-level-icon glow-80">brightness_7</i>-->
</div>
<div class="brightness-slider-bar-area z-10" on:mousedown={startDragging} class:dragging={dragging}>
<div class="brightness-slider-bar-pre glow-80" style="flex: {renderProgression * 100}"></div>
Expand Down
Loading

0 comments on commit 93c8b22

Please sign in to comment.