diff --git a/README.md b/README.md index b04aff3..f71fd22 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ or system tray (Windows). No phone, no JBL Portable app. - πŸ”„ Auto-reconnects, even though JBL speakers rotate their Bluetooth address - πŸ–ΌοΈ The speaker's photo in its actual color, built in for 17 models - πŸ”€ One-click switching when several JBL speakers are nearby +- πŸ”— Auracast and stereo pairing: flip a speaker's broadcast on, and choose which half of the pair it plays - πŸ”Š Volume and mute, while the speaker is your computer's sound output - β˜• Keep Awake: stops the speaker's auto power-off while your computer is playing to it (JBL has no setting for this) - βš™οΈ Settings: launch at login, low-battery alerts, update checks @@ -50,8 +51,8 @@ or system tray (Windows). No phone, no JBL Portable app. | Status | Models | |---|---| -| βœ… Verified | Flip 7, Charge 6, Charge 5 | -| 🟠 Beta | Xtreme 3, Xtreme 4, Go 4, Go 4 Duo, Clip 5, Tuner 3 | +| βœ… Verified | Flip 7, Charge 6, Charge 5, Go 4 | +| 🟠 Beta | Xtreme 3, Xtreme 4, Go 4 Duo, Clip 5, Tuner 3 | | 🟣 Experimental | Go 5, Grip, Xtreme 5, Boombox 2/3/4, Flip 6, Pulse 5, Flip/Charge Essential 3 SE, older models | Full list with product IDs: [docs/SUPPORTED_MODELS.md](docs/SUPPORTED_MODELS.md). Both apps share the same @@ -61,6 +62,13 @@ on Windows. Beta and experimental models read battery and EQ safely. Changing their EQ needs **Allow experimental EQ** (Settings, on both) until someone with that speaker confirms it works. +**Auracast:** on models JBL lists as Auracast-capable (the Go 4, Xtreme 4/5, Boombox 3/4, Clip 5, Charge 6, +Flip 7 and others), the app shows an Auracast switch and, for the portable models, a **Left / Right / Mono** +picker. The two speakers still pair on the hardware: press Auracast on the second one (or bump two Go 4 Duos +together), then connect to each unit in turn and set its half. A Mac cannot be an Auracast source or receiver +(no LE Audio API), so the app only sends the control frames. If a unit stops answering after it +starts broadcasting, press its Auracast button once; the app may not be able to reopen the link. + **Have a beta or experimental model?** Choose **Copy Diagnostics** (Mac: the β€’β€’β€’ menu; Windows: right-click the tray icon) and paste it into a [device report](../../issues/new?template=device-report.yml). It only sends read-only requests, and it hides your speaker's MAC address and serial number. diff --git a/Sources/JBLControl/Diagnostics.swift b/Sources/JBLControl/Diagnostics.swift index 4fd443b..c03cab6 100644 --- a/Sources/JBLControl/Diagnostics.swift +++ b/Sources/JBLControl/Diagnostics.swift @@ -4,6 +4,9 @@ import JBLControlKit /// Builds a Markdown report that's safe to paste into a public GitHub issue. @MainActor enum Diagnostics { + /// Three backticks, spelled without the character so the file stays easy to quote. + private static let fence = "\u{60}\u{60}\u{60}" + static func copyReport(_ speaker: SpeakerManager) async { await speaker.runDiagnosticProbe() let report = build(speaker) @@ -18,24 +21,43 @@ enum Diagnostics { var lines = ["## JBLControl diagnostics", "", "- App: \(version)", "- macOS: \(os)"] if let model = speaker.model { - lines.append("- Model: \(model.name) (PID `\(String(format: "%04X", model.productID))`), " - + "family `\(model.family.rawValue)`, support `\(model.support.label)`") + lines.append("- Model: \(model.name) (PID \(hex(model.productID))), " + + "family \(model.family.rawValue), support \(model.support.label)") } else if let pid = speaker.productID { - lines.append("- Model: unknown PID `\(String(format: "%04X", pid))`") + lines.append("- Model: unknown PID \(hex(pid))") } lines.append("- Status: \(speaker.status)") if let firmware = speaker.firmware { lines.append("- Firmware: \(firmware)") } if let battery = speaker.battery { lines.append("- Battery: \(battery)%\(speaker.isCharging ? " (charging)" : "")") } if let eq = speaker.eq { - lines.append("- EQ: active `\(String(format: "%02X", eq.activeCategory))`, custom \(speaker.customGains)") + lines.append("- EQ: active \(String(format: "%02X", eq.activeCategory)), custom \(speaker.customGains)") + } + if let linkMode = speaker.linkMode { lines.append("- Link mode: \(linkMode.label)") } + if let channel = speaker.stereoChannel { lines.append("- Stereo channel: \(channel.label)") } + if let role = speaker.role { lines.append("- Link role: \(role.label)") } + if let locked = speaker.stereoLock { lines.append("- Stereo lock: \(locked ? "on" : "off")") } + if let group = speaker.auracastGroup { + var groupLine = "- Group: \(group.type?.label ?? "?") \(group.channel?.label ?? "?")" + if let id = group.groupIDHex { groupLine += " \(id)" } + if let name = group.name { groupLine += " \(name)" } + if let action = group.action { groupLine += ", action \(action)" } + lines.append(groupLine) } - lines += ["", "### Nearby JBL advertisements", "```"] + lines += ["", "### Nearby JBL advertisements", fence] for s in speaker.discovered { - lines.append("\(s.model?.name ?? "unknown") pid=\(s.productID.map { String(format: "%04X", $0) } ?? "?") " + lines.append("\(s.model?.name ?? "unknown") pid=\(s.productID.map(hex) ?? "?") " + s.advertisement.sorted { $0.key < $1.key }.map { "\($0.key)=\($0.value)" }.joined(separator: " ")) } - lines += ["```", "", "### GATT", "```"] + speaker.gattSummary + ["```", "", "### Traffic (most recent last)", "```"] + lines.append(fence) + if !speaker.infoTokens.isEmpty { + lines += ["", "### Device info tokens", fence] + for (token, value) in speaker.infoTokens.sorted(by: { $0.key < $1.key }) { + lines.append(String(format: "%02X ", token) + Data(value).hex) + } + lines.append(fence) + } + lines += ["", "### GATT", fence] + speaker.gattSummary + [fence, "", "### Traffic (most recent last)", fence] let start = speaker.traffic.first?.date ?? .now for entry in speaker.traffic.suffix(80) { @@ -43,10 +65,12 @@ enum Diagnostics { let arrow = entry.direction == .sent ? "β†’" : "←" lines.append("\(t) \(arrow) \(redacted(entry.data).hex)") } - lines.append("```") + lines.append(fence) return lines.joined(separator: "\n") } + private static func hex(_ value: UInt16) -> String { String(format: "%04X", value) } + /// Masks the MAC address (info token 0x48) and serial number (0xC2). static func redacted(_ data: Data) -> Data { var b = [UInt8](data) diff --git a/Sources/JBLControl/SpeakerManager.swift b/Sources/JBLControl/SpeakerManager.swift index ab13526..368f624 100644 --- a/Sources/JBLControl/SpeakerManager.swift +++ b/Sources/JBLControl/SpeakerManager.swift @@ -37,6 +37,27 @@ final class SpeakerManager: NSObject { private(set) var isCharging = false private(set) var firmware: String? private(set) var eq: EQSnapshot? + /// Every info token the speaker has reported, raw: token id to value bytes. + private(set) var infoTokens: [UInt8: [UInt8]] = [:] + /// Link mode from `AA 6B`, or the mode we last asked for: Auracast, PartyBoost or off. + private(set) var linkMode: LinkMode? + /// Token 3C, the older "Play Together" bit. Kept as a fallback for models that don't answer 0x6A. + private(set) var playTogether: Bool? + /// Token 46: this unit's half of a stereo pair. + private(set) var channel: AudioChannel? + /// Role from `AA 6B` / `AA 16`: normal, broadcasting or receiving. + private(set) var role: DeviceRole? + /// Token 49: the chosen half is locked. + private(set) var stereoLock: Bool? + /// Token 4C: the model itself says it supports Auracast. + private(set) var auracastSupportedToken: Bool? + /// Token 45: how many units the speaker believes are linked. + private(set) var linkedDevices: Int? + /// `AA A2`: the stereo/party group this unit is in, when it reports one. + private(set) var auracastGroup: AuracastGroup? + /// The channel we wrote and the speaker ACKed. Token 46 reads back 0 outside a + /// group, so it must not overwrite this. + @ObservationIgnored private var pendingChannel: AudioChannel? /// Last known custom curve; survives replies that don't carry it. private(set) var customGains: [Float] = [] private(set) var traffic: [TrafficEntry] = [] @@ -49,6 +70,32 @@ final class SpeakerManager: NSObject { var activePreset: EQPreset? { eq.flatMap { e in model?.pickerPresets.first { $0.category == e.activeCategory } } } var isCustomActive: Bool { eq != nil && eq?.activeCategory == model?.customCategory } var canWrite: Bool { model.map { !$0.writesNeedOptIn || allowExperimentalWrites } ?? false } + /// Whether this speaker can join an Auracast broadcast, from the model table or its own tokens. + var supportsAuracast: Bool { + if model?.hasAuracast == true || auracastSupportedToken == true { return true } + return linkMode != nil || playTogether != nil + } + + /// Whether left/right is ours to choose. AirTouch pairs decide it themselves. + var canSetChannel: Bool { model?.hasStereoChannel ?? (channel != nil) } + + /// Auracast (or another multi-speaker mode) is on. Token 3C and the link role are + /// there for firmware that never answers `AA 6A`. + var isAuracastOn: Bool { + if linkMode == .auracast { return true } + if linkMode == .off { return false } + if role == .master || role == .slave { return true } + return playTogether == true + } + + /// The channel to show: prefer what the group reply says, fall back to token 46. + var stereoChannel: AudioChannel? { auracastGroup?.channel ?? channel } + + /// Another nearby unit of the same model, so the two halves of a pair can be set in turn. + var otherUnit: DiscoveredSpeaker? { + guard let model, model.hasAuracast else { return nil } + return discovered.first { $0.id != activeID && $0.model?.name == model.name } + } var connectedID: UUID? { status == .connected ? peripheral?.identifier : nil } /// Advertised name of the speaker currently being connected to. var connectingName: String? { discovered.first { $0.id == peripheral?.identifier }?.name } @@ -131,7 +178,69 @@ final class SpeakerManager: NSObject { func refresh() { guard status == .connected else { return } - enqueue([Frame.requestInfo.encoded] + (codec?.readRequests() ?? [])) + enqueue([Frame.requestInfo.encoded] + tokenRequests + auracastRequests + (codec?.readRequests() ?? [])) + } + + /// Group status is only worth asking for on a model that can hold one. + private var auracastRequests: [Data] { + guard model?.hasAuracast == true else { return [] } + if model?.family.usesProtocol4 == true { + return P4Message.get([P4Party.auracastMode, P4Party.channel, P4Party.status, + P4Party.groupType, P4Party.role, P4Party.groupID]).packets + } + return [Frame.requestLinkRole.encoded, Frame.requestAuracastGroup.encoded] + } + + /// Tokens we ask for by name: the info burst does not always include them. + private var tokenRequests: [Data] { + [Frame.requestToken(InfoTokenID.auracast).encoded, + Frame.requestToken(InfoTokenID.audioChannel).encoded, + Frame.requestToken(InfoTokenID.stereoLock).encoded, + Frame.requestToken(InfoTokenID.auracastSupport).encoded] + } + + /// Turn Auracast on or off (`AA 6A 01 02` / `AA 6A 01 00`), the same switch JBL's app uses. + /// + /// It does not create the pair by itself: the two Go 4s join each other on the speakers + /// (the Auracast button on both, or AirTouch on a Duo). This is what flips a unit into + /// broadcast mode so the second one can receive it. + func setAuracast(_ on: Bool) { + guard status == .connected, supportsAuracast, canWrite else { return } + let mode: LinkMode = on ? .auracast : .off + linkMode = mode + if model?.family.usesProtocol4 == true { + enqueue(P4Message.set([(P4Party.auracastMode, [on ? 0x01 : 0x00])]).packets) + } else { + enqueue([Frame.setLinkMode(mode).encoded]) + } + } + + /// Choose this unit's half of the pair (`AA 15 03 00 46 <0|1|2>`). + func setChannel(_ channel: AudioChannel) { + guard status == .connected, canSetChannel, canWrite else { return } + self.channel = channel + pendingChannel = channel + if model?.family.usesProtocol4 == true { + enqueue(P4Message.set([(P4Party.channel, [channel.rawValue])]).packets) + } else { + enqueue([Frame.setAudioChannel(channel).encoded]) + } + } + + /// Flip left and right on the unit we're connected to. + func swapChannel() { + setChannel((stereoChannel ?? .mono).swapped) + } + + /// Ask for the role and group status again (read-only). + func refreshAuracastGroup() { + guard status == .connected else { return } + enqueue(auracastRequests) + } + + /// Ask the speaker to re-send one info token (read-only). + func readToken(_ token: UInt8) { + enqueue([Frame.requestToken(token).encoded]) } func select(_ preset: EQPreset) { @@ -251,6 +360,9 @@ final class SpeakerManager: NSObject { /// Forget what the last speaker reported, so none of it shows for whichever speaker connects next. private func clearDeviceInfo() { name = nil; colorCode = nil; battery = nil; isCharging = false; firmware = nil; eq = nil + infoTokens = [:] + linkMode = nil; playTogether = nil; channel = nil; role = nil; stereoLock = nil + auracastSupportedToken = nil; linkedDevices = nil; auracastGroup = nil; pendingChannel = nil } private func clearDeviceState() { @@ -320,6 +432,7 @@ final class SpeakerManager: NSObject { // MARK: Incoming private func handle(_ message: Incoming) { + if case .p4(let p4) = message { handleP4Party(p4) } if let codec, let snapshot = codec.parse(message) { let superseded = eqNext != nil if eqInFlight { eqWriteFinished() } @@ -334,14 +447,43 @@ final class SpeakerManager: NSObject { switch Command(rawValue: frame.command) { case .info: guard let token = InfoToken.parse(frame.payload) else { return } + if frame.payload.count >= 3, frame.payload[1] != 0x48, frame.payload[1] != 0xC2 { + infoTokens[frame.payload[1]] = Array(frame.payload.dropFirst(2)) + } switch token { case .name(let n): name = n case .productID(let pid): setProductID(pid) case .color(let c): colorCode = c case .battery(let level, let charging): batteryChanged(level, charging: charging) case .firmware(let f): firmware = f + case .auracast(let value): playTogether = value != 0 + case .audioChannel(let c): + // Outside a group the firmware reports 00 even after an ACKed write. + if c != .mono || pendingChannel == nil || pendingChannel == .mono { + channel = c + if c != .mono { pendingChannel = nil } + } + case .stereoLock(let locked): stereoLock = locked + case .auracastSupport(let supported): auracastSupportedToken = supported + case .linkedDevices(let count): linkedDevices = count default: break } + case .linkMode: + // AA 6B 01 : the answer to our 6A write. + if let value = frame.payload.first { role = DeviceRole(roleValue: value) } + case .linkRole: + if let value = frame.payload.first { role = DeviceRole(roleValue: value) } + case .auracastGroup: + guard !frame.payload.isEmpty else { + // An empty AA A2 means this unit is not in a group. + auracastGroup = nil + break + } + let group = AuracastGroup(payload: frame.payload) + auracastGroup = group + if let c = group.channel { channel = c; pendingChannel = c } + if let r = group.role { role = r } + if group.action == .destroy { auracastGroup = nil; channel = .mono; pendingChannel = .mono } case .version: firmware = FirmwareVersion.format(frame.payload) case .notifyEQChange: @@ -354,6 +496,23 @@ final class SpeakerManager: NSObject { } } + /// Protocol 4 carries Auracast and the stereo half as features, not AA frames. + private func handleP4Party(_ message: P4Message) { + if let value = message.features[P4Party.auracastMode]?.first { + linkMode = value == 0 ? .off : .auracast + } + if let value = message.features[P4Party.channel]?.first, let channel = AudioChannel(channel: value) { + self.channel = channel + } + guard message.features[P4Party.status] != nil || message.features[P4Party.groupType] != nil else { return } + var group = auracastGroup ?? AuracastGroup() + if let value = message.features[P4Party.groupType]?.first { group.type = AuracastGroupType(rawValue: value) } + if let value = message.features[P4Party.role]?.first { group.role = DeviceRole(roleValue: value) } + if let value = message.features[P4Party.channel]?.first { group.channel = AudioChannel(channel: value) } + if let id = message.features[P4Party.groupID] { group.groupID = id } + auracastGroup = group + } + /// Whether a sighting is the speaker we're already connected to, under another address. private func isActiveSpeaker(_ s: DiscoveredSpeaker) -> Bool { guard activeID != nil else { return false } @@ -403,7 +562,7 @@ final class SpeakerManager: NSObject { enqueue([ Frame.requestInfo.encoded, Frame.requestVersion.encoded, Frame(0x61).encoded, Frame(0x6C, [0x00]).encoded, Frame.requestEQ.encoded, - ] + P4Message.set([(P4EQ.query, [0xFF])]).packets) + ] + auracastRequests + P4Message.set([(P4EQ.query, [0xFF])]).packets) try? await Task.sleep(for: .seconds(3)) } @@ -541,7 +700,7 @@ extension SpeakerManager: @preconcurrency CBPeripheralDelegate { log.info("control channel ready") decoder = MessageDecoder() status = .connected - enqueue([Frame.requestInfo.encoded, Frame.requestVersion.encoded] + (codec?.readRequests() ?? [])) + enqueue([Frame.requestInfo.encoded, Frame.requestVersion.encoded] + tokenRequests + auracastRequests + (codec?.readRequests() ?? [])) startPolling() } diff --git a/Sources/JBLControl/Views/AuracastControls.swift b/Sources/JBLControl/Views/AuracastControls.swift new file mode 100644 index 0000000..9d22c8e --- /dev/null +++ b/Sources/JBLControl/Views/AuracastControls.swift @@ -0,0 +1,60 @@ +import JBLControlKit +import SwiftUI + +/// Compact Auracast + stereo-half controls for the menu bar panel. +/// +/// The full explanation lives in the main window's card; the panel keeps it to +/// two rows so the preset picker stays the focus. +struct AuracastControls: View { + @Environment(SpeakerManager.self) private var speaker + + private var channel: Binding { + Binding(get: { speaker.stereoChannel ?? .mono }, set: { speaker.setChannel($0) }) + } + + var body: some View { + VStack(spacing: 8) { + HStack(spacing: 8) { + Image(systemName: "antenna.radiowaves.left.and.right") + .font(.caption) + .foregroundStyle(Theme.accent) + Text("Auracast") + .font(.caption.weight(.semibold)) + if let badge = speaker.stereoChannel?.badge, speaker.isAuracastOn { + Text(badge) + .font(.caption2.weight(.bold)) + .padding(.horizontal, 5) + .padding(.vertical, 1) + .background(Theme.accent.opacity(0.18), in: .capsule) + } + Spacer(minLength: 8) + Toggle("Auracast", isOn: Binding(get: { speaker.isAuracastOn }, + set: { speaker.setAuracast($0) })) + .toggleStyle(.switch) + .controlSize(.mini) + .labelsHidden() + .disabled(!speaker.canWrite) + } + + if speaker.model?.stereoIsAutomatic == true { + Text("Bump the two speakers together; AirTouch picks left and right.") + .font(.caption2) + .foregroundStyle(.secondary) + .frame(maxWidth: .infinity, alignment: .leading) + } else if speaker.canSetChannel { + Picker("Stereo channel", selection: channel) { + ForEach(AudioChannel.allCases, id: \.self) { channel in + Text(channel.label).tag(channel) + } + } + .pickerStyle(.segmented) + .labelsHidden() + .controlSize(.small) + .disabled(!speaker.canWrite) + } + } + .padding(.horizontal, 12) + .padding(.vertical, 10) + .adaptiveGlass(.regular, in: .rect(cornerRadius: 16)) + } +} diff --git a/Sources/JBLControl/Views/EqualizerView.swift b/Sources/JBLControl/Views/EqualizerView.swift index 3eb9cff..9c7e942 100644 --- a/Sources/JBLControl/Views/EqualizerView.swift +++ b/Sources/JBLControl/Views/EqualizerView.swift @@ -78,14 +78,18 @@ struct EqualizerView: View { /// Models not yet confirmed on hardware need an explicit opt-in before EQ writes. @ViewBuilder private var experimentalPrompt: some View { - if speaker.eq != nil, !speaker.canWrite, let model = speaker.model { + if !speaker.canWrite, let model = speaker.model { Button("Enable experimental EQ for \(model.shortName)") { speaker.allowExperimentalWrites = true } - .help("EQ changes on this model use JBL's protocol but haven't been tested on hardware yet.") + .help("EQ changes on this model use JBL's protocol but haven't been confirmed on hardware yet.") .font(.caption.weight(.medium)) .adaptiveGlassButtonStyle() .controlSize(.small) + } else if speaker.eq == nil, speaker.status == .connected { + Text("Waiting for the speaker to report its EQ…") + .font(.caption) + .foregroundStyle(.secondary) } } } diff --git a/Sources/JBLControl/Views/MainWindowView.swift b/Sources/JBLControl/Views/MainWindowView.swift index 24acba4..8dc9a72 100644 --- a/Sources/JBLControl/Views/MainWindowView.swift +++ b/Sources/JBLControl/Views/MainWindowView.swift @@ -214,6 +214,10 @@ private struct DetailsSection: View { .padding(16) .adaptiveGlass(.regular, in: .rect(cornerRadius: 18)) + if speaker.supportsAuracast { + AuracastCard() + } + HStack(spacing: 8) { Button("Refresh", systemImage: "arrow.clockwise") { speaker.refresh() } Button(copied ? "Copied" : "Copy Diagnostics", systemImage: copied ? "checkmark" : "stethoscope") { @@ -265,6 +269,110 @@ private struct DetailsSection: View { } } +/// The Auracast card: the link mode plus this unit's half of the stereo pair. +/// +/// It drives the same two commands JBL's app uses: `AA 6A` for the broadcast mode and +/// `AA 15 03 00 46 <0|1|2>` for left/right. It cannot create the pair by itself: two Go 4s +/// join on the speakers (press Auracast on both), then each unit is assigned its half here. +private struct AuracastCard: View { + @Environment(SpeakerManager.self) private var speaker + + var body: some View { + VStack(alignment: .leading, spacing: 10) { + HStack(spacing: 8) { + Image(systemName: "antenna.radiowaves.left.and.right") + .foregroundStyle(Theme.accent) + Text("Auracast") + .font(.headline) + Spacer() + if speaker.isAuracastOn, let role = speaker.role { + Text(role.label) + .font(.caption.weight(.medium)) + .foregroundStyle(.secondary) + } + Toggle("Auracast", isOn: Binding(get: { speaker.isAuracastOn }, + set: { speaker.setAuracast($0) })) + .toggleStyle(.switch) + .labelsHidden() + .disabled(!speaker.canWrite) + } + + if speaker.model?.stereoIsAutomatic == true { + Text("Left and right are set by AirTouch: bump the two speakers together. " + + "This unit reports \(speaker.stereoChannel?.label.lowercased() ?? "no channel").") + .font(.caption) + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) + } else if speaker.canSetChannel { + Picker("Channel", selection: Binding(get: { speaker.stereoChannel ?? .mono }, + set: { speaker.setChannel($0) })) { + ForEach(AudioChannel.allCases, id: \.self) { channel in + Text(channel.label).tag(channel) + } + } + .pickerStyle(.segmented) + .labelsHidden() + .disabled(!speaker.canWrite) + + HStack(spacing: 8) { + Text(channelDetail) + .font(.caption) + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) + Spacer(minLength: 8) + if let other = speaker.otherUnit { + Button("Connect to the other " + (speaker.model?.shortName ?? "speaker")) { + speaker.choose(other) + } + .font(.caption.weight(.semibold)) + .adaptiveGlassButtonStyle() + .controlSize(.small) + } + Button("Swap") { speaker.swapChannel() } + .font(.caption.weight(.semibold)) + .adaptiveGlassButtonStyle() + .controlSize(.small) + .disabled((speaker.stereoChannel ?? .mono) == .mono || !speaker.canWrite) + } + } else { + Text("This speaker doesn't expose a stereo channel control.") + .font(.caption) + .foregroundStyle(.secondary) + } + + Text(hint) + .font(.caption2) + .foregroundStyle(.tertiary) + .fixedSize(horizontal: false, vertical: true) + } + .padding(16) + .adaptiveGlass(.regular, in: .rect(cornerRadius: 18)) + } + + private var channelDetail: String { + switch speaker.stereoChannel { + case .left, .right: + return "This unit plays the \(speaker.stereoChannel?.label.lowercased() ?? "") channel. Set the other unit to the opposite one." + default: + return "Mono: both units play the same mix. Set one unit to Left and the other to Right for stereo." + } + } + + private var hint: String { + if !speaker.canWrite { + return "Auracast changes are off for this model until someone confirms them on the speaker. Enable experimental controls in Settings." + } + if !speaker.isAuracastOn { + return "Turn Auracast on for both speakers. The unit connected to this Mac broadcasts; press Auracast on the other so it receives." + } + if speaker.auracastGroup?.isStereo == true { + let id = speaker.auracastGroup?.groupIDHex.map { " (\($0))" } ?? "" + return "Stereo group\(id) is active. Left and right are split across the two units." + } + return "Pairing happens on the speakers: press Auracast on the second unit and wait for it to join, then choose this unit's channel." + } +} + // MARK: - Settings and About /// The Settings window's sections, on one page. diff --git a/Sources/JBLControl/Views/PanelView.swift b/Sources/JBLControl/Views/PanelView.swift index 19e9510..018835d 100644 --- a/Sources/JBLControl/Views/PanelView.swift +++ b/Sources/JBLControl/Views/PanelView.swift @@ -94,6 +94,14 @@ struct SpeakerControls: View { } else if speaker.status == .connected { NoEQNotice() } + if connected, let model = speaker.model, model.hasAuracast { + AuracastControls() + .transition(.opacity) + } + if connected, let model = speaker.model, model.hasEQ, !speaker.canWrite { + ExperimentalNotice(model: model) + .transition(.opacity) + } } .animation(.smooth, value: showSwitcher) .animation(.smooth(duration: 0.3), value: connected) @@ -109,6 +117,31 @@ struct SpeakerControls: View { } } +/// Explains why the presets and sliders do nothing on a model nobody has confirmed on hardware yet. +struct ExperimentalNotice: View { + @Environment(SpeakerManager.self) private var speaker + let model: SpeakerModel + + var body: some View { + HStack(spacing: 8) { + Image(systemName: "lock") + .font(.caption) + Text("EQ changes are off for \(model.shortName) until someone confirms them on the speaker.") + .font(.caption) + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) + Spacer(minLength: 8) + Button("Enable") { speaker.allowExperimentalWrites = true } + .font(.caption.weight(.semibold)) + .adaptiveGlassButtonStyle() + .controlSize(.small) + } + .padding(.horizontal, 12) + .padding(.vertical, 8) + .adaptiveGlass(.regular, in: .rect(cornerRadius: 16)) + } +} + struct NoEQNotice: View { @Environment(SpeakerManager.self) private var speaker @@ -193,6 +226,35 @@ enum MoreMenu { awake.state = keepAwake.isEnabled ? .on : .off awake.toolTip = "Stops the speaker's auto power-off while it's your Mac's sound output." menu.addItem(awake) + if speaker.supportsAuracast { + let auracast = ActionItem(speaker.isAuracastOn ? "Turn Auracast Off" : "Turn Auracast On", + symbol: "antenna.radiowaves.left.and.right") { + speaker.setAuracast(!speaker.isAuracastOn) + } + auracast.state = speaker.isAuracastOn ? .on : .off + auracast.isEnabled = speaker.canWrite + auracast.toolTip = speaker.canWrite + ? "Switch this speaker's Auracast broadcast on or off (the pair itself is made on the speakers)." + : "Enable experimental controls in Settings first." + menu.addItem(auracast) + if speaker.canSetChannel { + let channelItem = NSMenuItem(title: "Stereo Channel", action: nil, keyEquivalent: "") + channelItem.image = NSImage(systemSymbolName: "speaker.wave.2", accessibilityDescription: nil) + let submenu = NSMenu() + for channel in AudioChannel.allCases { + let item = ActionItem(channel.label, symbol: nil) { speaker.setChannel(channel) } + item.state = speaker.stereoChannel == channel ? .on : .off + item.isEnabled = speaker.canWrite + submenu.addItem(item) + } + submenu.addItem(.separator()) + let swap = ActionItem("Swap Left and Right", symbol: nil) { speaker.swapChannel() } + swap.isEnabled = (speaker.stereoChannel ?? .mono) != .mono && speaker.canWrite + submenu.addItem(swap) + channelItem.submenu = submenu + menu.addItem(channelItem) + } + } menu.addItem(.separator()) menu.addItem(ActionItem("Settings…", symbol: "gearshape", key: ",") { open(.settings) }) diff --git a/Sources/JBLControl/Views/SettingsView.swift b/Sources/JBLControl/Views/SettingsView.swift index b4b2eb9..f8a6406 100644 --- a/Sources/JBLControl/Views/SettingsView.swift +++ b/Sources/JBLControl/Views/SettingsView.swift @@ -81,8 +81,8 @@ struct SpeakerSettings: View { KeepAwakeSection() Section { Toggle(isOn: $speaker.allowExperimentalWrites) { - Text("Allow experimental EQ") - Text("Lets EQ changes through on models not yet confirmed on real hardware.") + Text("Allow experimental controls") + Text("Lets EQ and Auracast changes through on models not yet confirmed on real hardware.") } } header: { Text("Equalizer") diff --git a/Sources/JBLControlKit/Auracast.swift b/Sources/JBLControlKit/Auracast.swift new file mode 100644 index 0000000..bce0e41 --- /dev/null +++ b/Sources/JBLControlKit/Auracast.swift @@ -0,0 +1,236 @@ +import Foundation + +// MARK: - Auracast / stereo pair vocabulary + +/// Which half of a stereo pair a unit plays, from the JBL app's `AudioChannel` +/// (device-info token `0x46`, and the `04` TLV of an Auracast group reply). +public enum AudioChannel: UInt8, Sendable, CaseIterable, Equatable { + /// Not in a stereo pair: the unit plays the whole mix (JBL calls this NONE). + case mono = 0 + case left = 1 + case right = 2 + + public var label: String { + switch self { + case .mono: "Mono" + case .left: "Left" + case .right: "Right" + } + } + + public var badge: String? { + switch self { + case .mono: nil + case .left: "L" + case .right: "R" + } + } + + public var swapped: AudioChannel { + switch self { + case .mono: .mono + case .left: .right + case .right: .left + } + } + + /// Unknown byte values are ignored rather than guessed at. + public init?(channel: UInt8) { + self.init(rawValue: channel) + } +} + +/// `SetLinkMode` value: what the speaker's radio is doing. +/// Go 4 and every other Auracast-capable portable use `auracast`; older +/// PartyBoost models use `partyBoost`. +public enum LinkMode: UInt8, Sendable, CaseIterable, Equatable { + case off = 0 + case partyBoost = 1 + case auracast = 2 + + public var label: String { + switch self { + case .off: "Off" + case .partyBoost: "PartyBoost" + case .auracast: "Auracast" + } + } +} + +/// Role reported by `AA 6B` / `AA 16` and by the `03` TLV of a group reply. +public enum DeviceRole: UInt8, Sendable, Equatable { + case normal = 0 + case master = 1 + case slave = 2 + case standby = 3 + case twsMaster = 101 + case twsSlave = 102 + + public var label: String { + switch self { + case .normal: "Normal" + case .master: "Broadcasting" + case .slave: "Receiving" + case .standby: "Standby" + case .twsMaster: "TWS master" + case .twsSlave: "TWS slave" + } + } + + public init?(roleValue: UInt8) { + self.init(rawValue: roleValue) + } +} + +public enum AuracastGroupAction: UInt8, Sendable, Equatable { + case create = 1 + case destroy = 2 + case prepare = 3 +} + +public enum AuracastGroupType: UInt8, Sendable, Equatable { + case stereo = 1 + case party = 2 + + public var label: String { + switch self { + case .stereo: "Stereo" + case .party: "Party" + } + } +} + +// MARK: - Group request / status + +/// A create/destroy request for `AA A0`. +/// +/// JBL's app has two shapes: the compact one it sends to non-long-lasting +/// models (Go 4, Clip 5, Xtreme 4) and the longer one used by AirTouch and +/// long-lasting-stereo models. `longLasting` picks between them. +public struct AuracastGroupRequest: Equatable, Sendable { + public var action: AuracastGroupAction + public var type: AuracastGroupType + public var role: DeviceRole? + public var channel: AudioChannel + public var groupID: [UInt8]? + public var name: String? + public var partnerAddress: [UInt8]? + public var longLasting: Bool + + public init(action: AuracastGroupAction = .create, type: AuracastGroupType = .stereo, + role: DeviceRole? = nil, channel: AudioChannel, + groupID: [UInt8]? = nil, name: String? = nil, partnerAddress: [UInt8]? = nil, + longLasting: Bool = false) { + self.action = action + self.type = type + self.role = role + self.channel = channel + self.groupID = groupID + self.name = name + self.partnerAddress = partnerAddress + self.longLasting = longLasting + } +} + +/// What the speaker reports for `AA A1`: `token | length | value` entries. +public struct AuracastGroup: Equatable, Sendable { + public var action: AuracastGroupAction? + public var type: AuracastGroupType? + public var role: DeviceRole? + public var channel: AudioChannel? + public var groupID: [UInt8]? + public var name: String? + public var partnerAddress: [UInt8]? + /// The `08` TLV: the app writes `14` here and only reads it back. + public var extra: UInt8? + /// Bytes we could not place, kept for diagnostics. + public var unknown: [[UInt8]] = [] + + public init() {} + + public init(payload: [UInt8]) { + var offset = 0 + while offset + 2 <= payload.count { + let token = payload[offset] + let length = Int(payload[offset + 1]) + guard offset + 2 + length <= payload.count else { break } + let value = Array(payload[(offset + 2)..<(offset + 2 + length)]) + switch token { + case 0x01: action = value.first.flatMap(AuracastGroupAction.init(rawValue:)) + case 0x02: type = value.first.flatMap(AuracastGroupType.init(rawValue:)) + case 0x03: role = value.first.flatMap(DeviceRole.init(roleValue:)) + case 0x04: channel = value.first.flatMap(AudioChannel.init(channel:)) + case 0x05: groupID = value + case 0x06: name = String(decoding: value, as: UTF8.self) + case 0x07: partnerAddress = value + case 0x08: extra = value.first + default: unknown.append([token] + value) + } + offset += 2 + length + } + } + + /// True when this unit is part of a stereo group. + public var isStereo: Bool { type == .stereo && channel != .mono && channel != nil } + public var isParty: Bool { type == .party } + public var groupIDHex: String? { + groupID.map { $0.map { String(format: "%02X", $0) }.joined() } + } +} + +// MARK: - Frames + +public extension Frame { + /// `AA 6A 01 ` β€” the switch behind JBL's Auracast / PartyBoost button. + /// Answered by `AA 6B 01 `. + static func setLinkMode(_ mode: LinkMode) -> Frame { + Frame(.setLinkMode, [mode.rawValue]) + } + + /// `AA 17 00` β€” role check, answered by `AA 16 01 `. + static let requestLinkRole = Frame(.requestLinkRole) + + /// `AA 15 03 46 ` β€” select this unit's stereo half. + /// + /// This is the same SetDeviceInfo frame JBL's app builds for + /// `SetChannelCommand`: channel 0 none, 1 left, 2 right. The speaker + /// answers with a DEV_ACK (`AA 00 02 15 00`). + static func setAudioChannel(_ channel: AudioChannel, deviceIndex: UInt8 = 0) -> Frame { + Frame(.setDeviceInfo, [deviceIndex, InfoTokenID.audioChannel, channel.rawValue]) + } + + /// `AA 15 03 49 <0|1>` β€” lock the stereo half so it survives a power cycle. + static func setStereoLock(_ locked: Bool, deviceIndex: UInt8 = 0) -> Frame { + Frame(.setDeviceInfo, [deviceIndex, InfoTokenID.stereoLock, locked ? 0x01 : 0x00]) + } + + /// `AA A1 00` β€” ask for the current Auracast group; `AA A2` answers. + static let requestAuracastGroup = Frame(.requestAuracastGroup) + + /// `AA A0 ` β€” create or destroy a stereo/party group. + /// + /// Compact form (Go 4, Clip 5, Xtreme 4): `01 01 action | 02 01 type | 04 01 channel`, + /// plus `05 04 `. Long-lasting / AirTouch adds the role, name, partner + /// address and a trailing `08 01 14`, exactly as `SetAuraCastGroupCommand` does. + static func setAuracastGroup(_ request: AuracastGroupRequest) -> Frame { + var payload: [UInt8] = [0x01, 0x01, request.action.rawValue, 0x02, 0x01, request.type.rawValue] + if request.longLasting, let role = request.role { + payload += [0x03, 0x01, role.rawValue] + } + payload += [0x04, 0x01, request.channel.rawValue] + if let id = request.groupID, id.count == 4 { + payload += [0x05, 0x04] + id + } + if let name = request.name { + let bytes = Array(name.utf8.prefix(30)) + payload += [0x06, UInt8(bytes.count)] + bytes + } + if let address = request.partnerAddress, address.count == 6 { + payload += [0x07, 0x06] + address + } + if request.longLasting { + payload += [0x08, 0x01, 0x14] + } + return Frame(.setAuracastGroup, payload) + } +} diff --git a/Sources/JBLControlKit/Catalog+Generated.swift b/Sources/JBLControlKit/Catalog+Generated.swift index d914954..1df4755 100644 --- a/Sources/JBLControlKit/Catalog+Generated.swift +++ b/Sources/JBLControlKit/Catalog+Generated.swift @@ -32,78 +32,78 @@ enum GeneratedCatalog { static let models: [SpeakerModel] = [ SpeakerModel(productID: 0x208C, name: "JBL Charge 5 Wi-Fi", family: .infoOnly, support: .unsupported, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xF593CA, 0x26A4BD)]), + colors: [0x00: SpeakerColor("Black", 0xF593CA, 0x26A4BD)], features: .none), SpeakerModel(productID: 0x2075, name: "JBL Boombox 3 Wi-Fi", family: .infoOnly, support: .unsupported, formFactor: .boombox, presets: [], - colors: [0x00: SpeakerColor("Black", 0xF593CA, 0x26A4BD)]), + colors: [0x00: SpeakerColor("Black", 0xF593CA, 0x26A4BD)], features: .none), SpeakerModel(productID: 0x2050, name: "JBL Pulse 5", family: .legacySimple, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x01: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x02: SpeakerColor("White", 0xF593CA, 0x26A4BD)]), + colors: [0x00: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x01: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x02: SpeakerColor("White", 0xF593CA, 0x26A4BD)], features: .none), SpeakerModel(productID: 0x206D, name: "JBL Boombox 3", family: .legacySimple, support: .experimental, formFactor: .boombox, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x214E, name: "JBL Boombox 4", family: .protocol4Parametric, support: .experimental, formFactor: .boombox, presets: flip7_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x05: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x14: SpeakerColor("Brown", 0xE1D2B7, 0x956200), 0x1A: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x1F: SpeakerColor("Orange", 0xE1D2B7, 0x956200)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x05: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x14: SpeakerColor("Brown", 0xE1D2B7, 0x956200), 0x1A: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x1F: SpeakerColor("Orange", 0xE1D2B7, 0x956200)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x2132, name: "JBL Grip", family: .protocol4Quantized, support: .experimental, formFactor: .compact, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x03: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x04: SpeakerColor("Green", 0xBAC0AD, 0x3A412C), 0x05: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x18: SpeakerColor("Yellow", 0xFFD675, 0xF0EADD), 0x19: SpeakerColor("Rose", 0xE07784, 0xF3DEE5), 0x1A: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x1B: SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E), 0x1C: SpeakerColor("Peachorange", 0xFE6E2C, 0xF9D3C1)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x03: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x04: SpeakerColor("Green", 0xBAC0AD, 0x3A412C), 0x05: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x18: SpeakerColor("Yellow", 0xFFD675, 0xF0EADD), 0x19: SpeakerColor("Rose", 0xE07784, 0xF3DEE5), 0x1A: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x1B: SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E), 0x1C: SpeakerColor("Peachorange", 0xFE6E2C, 0xF9D3C1)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x2168, name: "JBL Go 5", family: .protocol4Quantized, support: .experimental, formFactor: .compact, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xB1B1B1, 0x434343), 0x03: SpeakerColor("Red", 0xB1B1B1, 0x434343), 0x05: SpeakerColor("Purple", 0xB1B1B1, 0x434343), 0x18: SpeakerColor("Yellow", 0xB1B1B1, 0x434343), 0x19: SpeakerColor("Rose", 0xB1B1B1, 0x434343), 0x1A: SpeakerColor("Squad", 0xB1B1B1, 0x434343), 0x1B: SpeakerColor("Turquoise", 0xB1B1B1, 0x434343), 0x1C: SpeakerColor("Peachorange", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xB1B1B1, 0x434343), 0x03: SpeakerColor("Red", 0xB1B1B1, 0x434343), 0x05: SpeakerColor("Purple", 0xB1B1B1, 0x434343), 0x18: SpeakerColor("Yellow", 0xB1B1B1, 0x434343), 0x19: SpeakerColor("Rose", 0xB1B1B1, 0x434343), 0x1A: SpeakerColor("Squad", 0xB1B1B1, 0x434343), 0x1B: SpeakerColor("Turquoise", 0xB1B1B1, 0x434343), 0x1C: SpeakerColor("Peachorange", 0xB1B1B1, 0x434343)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x2169, name: "JBL Xtreme 5", family: .protocol4Parametric, support: .experimental, formFactor: .cylinder, presets: flip7_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xB1B1B1, 0x434343), 0x1A: SpeakerColor("Squad", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Blue", 0xB1B1B1, 0x434343), 0x1A: SpeakerColor("Squad", 0xB1B1B1, 0x434343)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x204F, name: "JBL Flip 6", family: .legacySimple, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x05: SpeakerColor("Green", 0xC0C4B7, 0x3A412C), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x09: SpeakerColor("Teal", 0xAEE6DB, 0x28605E), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Martin Garrix", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x05: SpeakerColor("Green", 0xC0C4B7, 0x3A412C), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x09: SpeakerColor("Teal", 0xAEE6DB, 0x28605E), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Martin Garrix", 0xB1B1B1, 0x434343)], features: .none), SpeakerModel(productID: 0x2040, name: "JBL Charge 5", family: .legacySimple, support: .verified, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x05: SpeakerColor("Green", 0xC0C4B7, 0x3A412C), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x09: SpeakerColor("Teal", 0xAEE6DB, 0x28605E), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x12: SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), 0x13: SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x05: SpeakerColor("Green", 0xC0C4B7, 0x3A412C), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x09: SpeakerColor("Teal", 0xAEE6DB, 0x28605E), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x12: SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), 0x13: SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C)], features: .none), SpeakerModel(productID: 0x202F, name: "JBL Xtreme 3", family: .legacySimple, support: .beta, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)], features: .none), SpeakerModel(productID: 0x1F53, name: "JBL Boombox 2", family: .legacySimple, support: .experimental, formFactor: .boombox, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)], features: .none), SpeakerModel(productID: 0x1F56, name: "JBL Pulse 4", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x01: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x02: SpeakerColor("White", 0xFF8064, 0xCCFFDC7E)]), + colors: [0x00: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x01: SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), 0x02: SpeakerColor("White", 0xFF8064, 0xCCFFDC7E)], features: .none), SpeakerModel(productID: 0x1F31, name: "JBL Flip 5", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x05: SpeakerColor("Green", 0xC0C4B7, 0x3A412C), 0x06: SpeakerColor("Mustard Yellow", 0xE1D2B7, 0x956200), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Sand", 0xE1D2B7, 0x956200), 0x09: SpeakerColor("Teal", 0xAEE6DB, 0x28605E), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x11: SpeakerColor("Blackstar", 0xBFBFBF, 0x402E22), 0x12: SpeakerColor("Tomorrowland", 0xE1D2B7, 0x956200), 0x13: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Ecoblu", 0xADCBD8, 0x1A1F50), 0x15: SpeakerColor("Ecogrn", 0xAEE6DB, 0x28605E), 0x16: SpeakerColor("White Camouflage", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x05: SpeakerColor("Green", 0xC0C4B7, 0x3A412C), 0x06: SpeakerColor("Mustard Yellow", 0xE1D2B7, 0x956200), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Sand", 0xE1D2B7, 0x956200), 0x09: SpeakerColor("Teal", 0xAEE6DB, 0x28605E), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x11: SpeakerColor("Blackstar", 0xBFBFBF, 0x402E22), 0x12: SpeakerColor("Tomorrowland", 0xE1D2B7, 0x956200), 0x13: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Ecoblu", 0xADCBD8, 0x1A1F50), 0x15: SpeakerColor("Ecogrn", 0xAEE6DB, 0x28605E), 0x16: SpeakerColor("White Camouflage", 0xB1B1B1, 0x434343)], features: .none), SpeakerModel(productID: 0x1F17, name: "JBL Charge 4", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x05: SpeakerColor("Green", 0xBAC0AD, 0x3A412C), 0x06: SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x09: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x11: SpeakerColor("Squad", 0x8C8C8C, 0x313131), 0x12: SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), 0x13: SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x05: SpeakerColor("Green", 0xBAC0AD, 0x3A412C), 0x06: SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x09: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x11: SpeakerColor("Squad", 0x8C8C8C, 0x313131), 0x12: SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), 0x13: SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832)], features: .none), SpeakerModel(productID: 0x1F29, name: "JBL Charge 4", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x05: SpeakerColor("Green", 0xBAC0AD, 0x3A412C), 0x06: SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x09: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x11: SpeakerColor("Squad", 0x8C8C8C, 0x313131), 0x12: SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), 0x13: SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x05: SpeakerColor("Green", 0xBAC0AD, 0x3A412C), 0x06: SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x09: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x11: SpeakerColor("Squad", 0x8C8C8C, 0x313131), 0x12: SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), 0x13: SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832)], features: .none), SpeakerModel(productID: 0x1ED2, name: "JBL Pulse 3", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xFF98B7, 0x0064AC), 0x01: SpeakerColor("Black", 0xFF98B7, 0x0064AC), 0x02: SpeakerColor("White", 0xFF98B7, 0x0064AC)]), + colors: [0x00: SpeakerColor("Black", 0xFF98B7, 0x0064AC), 0x01: SpeakerColor("Black", 0xFF98B7, 0x0064AC), 0x02: SpeakerColor("White", 0xFF98B7, 0x0064AC)], features: .none), SpeakerModel(productID: 0x1EE7, name: "JBL Boombox", family: .infoOnly, support: .experimental, formFactor: .boombox, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), 0x08: SpeakerColor("Squad", 0xBEC3BC, 0x454932)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), 0x08: SpeakerColor("Squad", 0xBEC3BC, 0x454932)], features: .none), SpeakerModel(productID: 0x1F27, name: "JBL Boombox", family: .infoOnly, support: .experimental, formFactor: .boombox, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), 0x08: SpeakerColor("Squad", 0xBEC3BC, 0x454932)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), 0x08: SpeakerColor("Squad", 0xBEC3BC, 0x454932)], features: .none), SpeakerModel(productID: 0x1EFC, name: "JBL Xtreme 2", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("Teal", 0xBEC3BC, 0x454932), 0x08: SpeakerColor("Squad", 0x7D9B73, 0x553832)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("Teal", 0xBEC3BC, 0x454932), 0x08: SpeakerColor("Squad", 0x7D9B73, 0x553832)], features: .none), SpeakerModel(productID: 0x1F26, name: "JBL Xtreme 2", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("Teal", 0xBEC3BC, 0x454932), 0x08: SpeakerColor("Squad", 0x7D9B73, 0x553832)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x9EBECC, 0x32404B), 0x04: SpeakerColor("Teal", 0xBEC3BC, 0x454932), 0x08: SpeakerColor("Squad", 0x7D9B73, 0x553832)], features: .none), SpeakerModel(productID: 0x2038, name: "JBL Xtreme 2", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x12: SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x12: SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343)], features: .none), SpeakerModel(productID: 0x1ED1, name: "JBL Flip 4", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), 0x04: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x05: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x06: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x07: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), 0x08: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x09: SpeakerColor("Zap", 0xDAC39C, 0x1225BA), 0x0A: SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), 0x0B: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), 0x10: SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), 0x11: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), 0x12: SpeakerColor("Oceanblue", 0x9EBECC, 0x32404B)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), 0x04: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x05: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x06: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x07: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), 0x08: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x09: SpeakerColor("Zap", 0xDAC39C, 0x1225BA), 0x0A: SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), 0x0B: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), 0x10: SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), 0x11: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), 0x12: SpeakerColor("Oceanblue", 0x9EBECC, 0x32404B)], features: .none), SpeakerModel(productID: 0x1EBC, name: "JBL Charge 3", family: .infoOnly, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x04: SpeakerColor("Blue", 0x8FA9DB, 0x1A1F50), 0x05: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x06: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), 0x07: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x08: SpeakerColor("Zap", 0xDAC39C, 0x1225BA), 0x09: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x04: SpeakerColor("Blue", 0x8FA9DB, 0x1A1F50), 0x05: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x06: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), 0x07: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x08: SpeakerColor("Zap", 0xDAC39C, 0x1225BA), 0x09: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA)], features: .none), SpeakerModel(productID: 0x0024, name: "JBL Xtreme", family: .infoOnly, support: .unsupported, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), 0x04: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x05: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), 0x04: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x05: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA)], features: .none), SpeakerModel(productID: 0x0023, name: "JBL Flip 3", family: .infoOnly, support: .unsupported, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Orange", 0xF79D87, 0xB63125), 0x04: SpeakerColor("Pink", 0xF4C1D5, 0xA91950), 0x05: SpeakerColor("Gray", 0xB1B1B1, 0x434343), 0x06: SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), 0x07: SpeakerColor("Yellow", 0xDAC39C, 0x956200), 0x08: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x09: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), 0x10: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x11: SpeakerColor("Zap", 0xDAC39C, 0x1225BA), 0x12: SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), 0x13: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xFFAFA7, 0x772921), 0x03: SpeakerColor("Orange", 0xF79D87, 0xB63125), 0x04: SpeakerColor("Pink", 0xF4C1D5, 0xA91950), 0x05: SpeakerColor("Gray", 0xB1B1B1, 0x434343), 0x06: SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), 0x07: SpeakerColor("Yellow", 0xDAC39C, 0x956200), 0x08: SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), 0x09: SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), 0x10: SpeakerColor("Squad", 0xBEC3BC, 0x454932), 0x11: SpeakerColor("Zap", 0xDAC39C, 0x1225BA), 0x12: SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), 0x13: SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D)], features: .none), SpeakerModel(productID: 0x20DC, name: "JBL Xtreme 4", family: .legacyLevels, support: .beta, formFactor: .cylinder, presets: xtreme4_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x12: SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), 0x13: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)]), - SpeakerModel(productID: 0x20E4, name: "JBL Go 4", family: .legacyLevels, support: .beta, formFactor: .compact, presets: xtreme4_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x16: SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E)]), - SpeakerModel(productID: 0x210A, name: "JBL Go 4", family: .legacyLevels, support: .beta, formFactor: .compact, presets: xtreme4_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x16: SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x07: SpeakerColor("Grey", 0xB1B1B1, 0x434343), 0x12: SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), 0x13: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C)], features: ModelFeatures(auracast: true, longLastingStereo: true, newStereoFlow: true)), + SpeakerModel(productID: 0x20E4, name: "JBL Go 4", family: .legacyLevels, support: .verified, formFactor: .compact, presets: xtreme4_preset_eq, + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x16: SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E)], features: ModelFeatures(auracast: true, partyBoost: true)), + SpeakerModel(productID: 0x210A, name: "JBL Go 4", family: .legacyLevels, support: .verified, formFactor: .compact, presets: xtreme4_preset_eq, + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x16: SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E)], features: ModelFeatures(auracast: true, partyBoost: true, longLastingStereo: true, newStereoFlow: true)), SpeakerModel(productID: 0x215C, name: "JBL Go 4 Duo (L)", family: .legacyLevels, support: .beta, formFactor: .compact, presets: xtreme4_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343)], features: ModelFeatures(auracast: true, partyBoost: true, airTouchStereo: true)), SpeakerModel(productID: 0x2181, name: "JBL Go 4 Duo (R)", family: .legacyLevels, support: .beta, formFactor: .compact, presets: xtreme4_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343)], features: ModelFeatures(auracast: true, partyBoost: true, airTouchStereo: true)), SpeakerModel(productID: 0x20F5, name: "JBL Clip 5", family: .legacyLevels, support: .beta, formFactor: .compact, presets: xtreme4_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x16: SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xB1B1B1, 0x434343), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x13: SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x16: SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x20E3, name: "JBL Charge 6", family: .legacyParametric, support: .verified, formFactor: .cylinder, presets: charge6_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x16: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x17: SpeakerColor("Black And Orange", 0xB1B1B1, 0x434343), 0x18: SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x16: SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), 0x17: SpeakerColor("Black And Orange", 0xB1B1B1, 0x434343), 0x18: SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E)], features: ModelFeatures(auracast: true, partyBoost: true, newStereoFlow: true)), SpeakerModel(productID: 0x2107, name: "JBL Flip 7", family: .legacyParametric, support: .verified, formFactor: .cylinder, presets: flip7_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x12: SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), 0x13: SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x18: SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x02: SpeakerColor("Red", 0xE1D1D6, 0x8D5260), 0x03: SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA), 0x08: SpeakerColor("Sand", 0xC5BBAD, 0x735B39), 0x10: SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), 0x12: SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), 0x13: SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), 0x14: SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), 0x15: SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), 0x18: SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E)], features: ModelFeatures(auracast: true, partyBoost: true, newStereoFlow: true)), SpeakerModel(productID: 0x214C, name: "JBL Tuner 3", family: .legacyLevels, support: .beta, formFactor: .compact, presets: tuner3_preset_eq, - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x04: SpeakerColor("White", 0xE0E0E0, 0xAAACAA)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x218A, name: "JBL Charge Essential 3 SE", family: .protocol4Quantized, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x26: SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), 0x27: SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x26: SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), 0x27: SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343)], features: ModelFeatures(auracast: true, partyBoost: true)), SpeakerModel(productID: 0x2185, name: "JBL Flip Essential 3 SE", family: .protocol4Quantized, support: .experimental, formFactor: .cylinder, presets: [], - colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x26: SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), 0x27: SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343)]), + colors: [0x00: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x01: SpeakerColor("Black", 0xB1B1B1, 0x434343), 0x26: SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), 0x27: SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343)], features: ModelFeatures(auracast: true, partyBoost: true)), ] } diff --git a/Sources/JBLControlKit/EQCodec.swift b/Sources/JBLControlKit/EQCodec.swift index 65cefb7..393ef88 100644 --- a/Sources/JBLControlKit/EQCodec.swift +++ b/Sources/JBLControlKit/EQCodec.swift @@ -41,11 +41,20 @@ public struct EQCodec: Sendable { case .legacyParametric: return [Frame.setEQ(category: preset.category, bands: preset.bands).encoded] case .legacyLevels: - return [levelsFrame(active: preset.category, gains: customGains).encoded] + // Presets are biquad coefficients, not level values: the firmware + // ignores an AA 97 whose active byte is a preset but whose body is + // the level form (confirmed on a Go 4). + guard model.supportsPresets, !preset.bands.isEmpty else { return [] } + return [Frame(.setAdvancedEQ, PresetEQ.payload(category: preset.category, bands: preset.bands)).encoded] case .protocol4Parametric: guard let mapped = P4EQ.categoryMap[preset.category], preset.bands.count == 7 else { return [] } return P4Message.set([(P4EQ.parametric, P4EQ.parametricValue(category: mapped, bands: preset.bands))]).packets - case .legacySimple, .protocol4Quantized, .infoOnly: + case .legacySimple: + // `AA 6E 02 01 00`: select JBL Signature and send no band values, the + // frame JBL's app builds for SetSimpleEqCommand(category: 01, []). + guard preset.category == 0x01 else { return [] } + return [Frame(0x6E, [0x01, 0x00]).encoded] + case .protocol4Quantized, .infoOnly: return [] } } @@ -135,8 +144,10 @@ public struct EQCodec: Sendable { } private func levelsFrame(active: UInt8, gains: [Float]) -> Frame { - var p: [UInt8] = [active, 0xC1, 0x06, UInt8(gains.count)] - for (i, g) in gains.enumerated() { + // The advanced-level firmware takes 1…7 bands; an empty list has to become a flat curve. + let levels = gains.isEmpty ? Array(repeating: 0, count: max(model.customBands.count, 1)) : gains + var p: [UInt8] = [active, 0xC1, 0x06, UInt8(levels.count)] + for (i, g) in levels.enumerated() { p += [UInt8(i + 1), UInt8(bitPattern: Int8(clamping: Int(g.rounded())))] } return Frame(.setAdvancedEQ, p) diff --git a/Sources/JBLControlKit/JBLProtocol.swift b/Sources/JBLControlKit/JBLProtocol.swift index ac34478..49401dc 100644 --- a/Sources/JBLControlKit/JBLProtocol.swift +++ b/Sources/JBLControlKit/JBLProtocol.swift @@ -25,12 +25,26 @@ public enum Command: UInt8, Sendable { case devAck = 0x00 case requestInfo = 0x11 case info = 0x12 + /// Ask for one info token (AA 13 02 00 ); with a length and value, sets it. + case requestToken = 0x13 case requestVersion = 0x41 case version = 0x42 + /// `AA 15` β€” set one device-info token (channel, stereo lock, …). + case setDeviceInfo = 0x15 + /// `AA 17` β€” role check, answered by `AA 16`. + case requestLinkRole = 0x17 + case linkRole = 0x16 case notifyEQChange = 0x64 + /// `AA 6A` / `AA 6B` β€” PartyBoost / Auracast link mode and the role it produces. + case setLinkMode = 0x6A + case linkMode = 0x6B case setAdvancedEQ = 0x97 case requestAdvancedEQ = 0x98 case advancedEQ = 0x99 + /// `AA A0` / `AA A1` / `AA A2` β€” Auracast stereo/party group. + case setAuracastGroup = 0xA0 + case requestAuracastGroup = 0xA1 + case auracastGroup = 0xA2 case unsupported = 0xEE } @@ -104,8 +118,17 @@ public enum InfoToken: Equatable, Sendable { case color(UInt8) /// Percentage in the low 7 bits; the high bit is set while charging (Flip 7: `0x8A` = charging, 10%). case battery(level: Int, charging: Bool) - case audioChannel(UInt8) + /// Token 46: this unit's half of a stereo pair (0 none, 1 left, 2 right). + case audioChannel(AudioChannel) case audioSourceConnected(Bool) + /// Token 49: the stereo half is locked (JBL's "stereo preference"). + case stereoLock(Bool) + /// Token 4C: the model reports Auracast support. + case auracastSupport(Bool) + /// Token 45: how many units the speaker believes are linked. + case linkedDevices(Int) + /// Token 3C: 1 while the speaker is in Auracast / Play Together mode, 0 when it isn't. + case auracast(UInt8) case firmware(String) case other(token: UInt8, value: [UInt8]) @@ -126,17 +149,50 @@ public enum InfoToken: Equatable, Sendable { case (0x42, 2...): return .productID(UInt16(value[0]) << 8 | UInt16(value[1])) case (0x43, 1...): return .color(value[0]) case (0x44, 1...): return .battery(level: Int(value[0] & 0x7F), charging: value[0] & 0x80 != 0) - case (0x46, 1...): return .audioChannel(value[0]) + case (0x45, 1...): return .linkedDevices(Int(value[0])) + case (0x46, 1...): return AudioChannel(channel: value[0]).map { .audioChannel($0) } case (0x47, 1...): return .audioSourceConnected(value[0] != 0) + case (0x49, 1...): return .stereoLock(value[0] != 0) + case (0x4C, 1...): return .auracastSupport(value[0] != 0) + case (0x3C, 1...): return .auracast(value[0]) case (0x4D, 1...): return .firmware(FirmwareVersion.format(value)) default: return .other(token: token, value: value) } } } +/// Info-token ids used by the 0x11 / 0x12 / 0x13 commands. +public enum InfoTokenID { + /// 3C β€” Auracast / Play Together mode: 1 on, 0 off. + public static let auracast: UInt8 = 0x3C + public static let productID: UInt8 = 0x42 + public static let color: UInt8 = 0x43 + public static let battery: UInt8 = 0x44 + public static let linkedDevices: UInt8 = 0x45 + public static let audioChannel: UInt8 = 0x46 + public static let audioSourceConnected: UInt8 = 0x47 + /// Set through `AA 15 03 00 49 <0|1>`. + public static let stereoLock: UInt8 = 0x49 + /// Reported by models that can join an Auracast broadcast. + public static let auracastSupport: UInt8 = 0x4C + public static let firmware: UInt8 = 0x4D +} + +public extension Frame { + /// AA 13 | 00 | token β€” asks for a single info token, the shape JBL's app calls a token request. + static func requestToken(_ token: UInt8) -> Frame { + Frame(.requestToken, [0x00, token]) + } +} + public enum FirmwareVersion { - /// `00 07 02 00` β†’ "0.7.2.0" + /// `00 07 02 00` β†’ "0.7.2.0", and the ASCII form the Go 4 sends, + /// `30 36 34 30` ("0640") β†’ "0.6.4.0". public static func format(_ bytes: [UInt8]) -> String { - bytes.map(String.init).joined(separator: ".") + let asciiDigits = (UInt8(0x30)...UInt8(0x39)) + if !bytes.isEmpty, bytes.allSatisfy(asciiDigits.contains) { + return bytes.map { String(UnicodeScalar($0)) }.joined(separator: ".") + } + return bytes.map(String.init).joined(separator: ".") } } diff --git a/Sources/JBLControlKit/Models.swift b/Sources/JBLControlKit/Models.swift index 4f5fd5c..6d68a8a 100644 --- a/Sources/JBLControlKit/Models.swift +++ b/Sources/JBLControlKit/Models.swift @@ -114,6 +114,32 @@ public struct EQBandSpec: Sendable, Equatable { } } +/// The multi-speaker capabilities the JBL app's model table declares. +/// None of them changes the AA framing; they decide which controls make sense. +public struct ModelFeatures: Sendable, Equatable { + /// `AURACAST_SUPPORT`: the unit can join or start an Auracast broadcast. + public var auracast: Bool + /// `NON_PARTY_BOOST_SUPPORT` / `PARTYBOOST_BUTTON_SUPPORT`: the older PartyBoost link. + public var partyBoost: Bool + /// `LONG_LASTING_STEREO`: the pair survives a power cycle. + public var longLastingStereo: Bool + /// `AIR_TOUCH_STEREO`: the Duo picks its own halves when bumped together. + public var airTouchStereo: Bool + /// The models JBL's app drives with its newer stereo flow (Go 4 Actions, Xtreme 4, Flip 7, Charge 6). + public var newStereoFlow: Bool + + public init(auracast: Bool = false, partyBoost: Bool = false, longLastingStereo: Bool = false, + airTouchStereo: Bool = false, newStereoFlow: Bool = false) { + self.auracast = auracast + self.partyBoost = partyBoost + self.longLastingStereo = longLastingStereo + self.airTouchStereo = airTouchStereo + self.newStereoFlow = newStereoFlow + } + + public static let none = ModelFeatures() +} + public struct SpeakerModel: Sendable, Identifiable { public let productID: UInt16 public let name: String @@ -122,10 +148,12 @@ public struct SpeakerModel: Sendable, Identifiable { public let formFactor: FormFactor public let presets: [EQPreset] public let colors: [UInt8: SpeakerColor] + public let features: ModelFeatures public var id: UInt16 { productID } public init(productID: UInt16, name: String, family: ProtocolFamily, support: SupportLevel, - formFactor: FormFactor, presets: [EQPreset], colors: [UInt8: SpeakerColor]) { + formFactor: FormFactor, presets: [EQPreset], colors: [UInt8: SpeakerColor], + features: ModelFeatures = .none) { self.productID = productID self.name = name self.family = family @@ -133,6 +161,7 @@ public struct SpeakerModel: Sendable, Identifiable { self.formFactor = formFactor self.presets = presets self.colors = colors + self.features = features } public func color(_ code: UInt8?) -> SpeakerColor { @@ -145,13 +174,36 @@ public struct SpeakerModel: Sendable, Identifiable { public var customCategory: UInt8 { family == .legacyParametric ? 0xC2 : 0xC1 } /// Presets the picker offers: the model's own, then Custom. + /// + /// A 3-band (simple EQ) model has no preset table in the JBL app, but its + /// firmware still carries JBL Signature as category `01`; selecting it is + /// `AA 6E 02 01 00`, the same frame the app sends. public var pickerPresets: [EQPreset] { guard hasEQ else { return [] } - return presets + [EQPreset(category: customCategory, name: "Custom", bands: [])] + let custom = EQPreset(category: customCategory, name: "Custom", bands: []) + guard supportsPresets else { return [custom] } + if family == .legacySimple, !presets.contains(where: { $0.category == 0x01 }) { + return [EQPreset(category: 0x01, name: "Signature", bands: [])] + presets + [custom] + } + return presets + [custom] } + /// Whether JBL's preset payload for this model is implemented. + /// Xtreme 4 uses a different (AKM) coefficient encoder that isn't ported yet. + public var supportsPresets: Bool { !(family == .legacyLevels && productID == 0x20DC) } + public var hasEQ: Bool { family != .infoOnly && support != .unsupported } + /// The unit can join or start an Auracast broadcast. + public var hasAuracast: Bool { features.auracast } + + /// Left/right can be chosen over the control channel. AirTouch models decide + /// it themselves when the two units are bumped together. + public var hasStereoChannel: Bool { features.auracast && !features.airTouchStereo } + + /// The two halves are chosen by AirTouch, not by an `AA 15` write. + public var stereoIsAutomatic: Bool { features.airTouchStereo } + /// Writes are allowed without opting in only where they have been confirmed on hardware. public var writesNeedOptIn: Bool { support != .verified } diff --git a/Sources/JBLControlKit/PresetEQ.swift b/Sources/JBLControlKit/PresetEQ.swift new file mode 100644 index 0000000..65db4ce --- /dev/null +++ b/Sources/JBLControlKit/PresetEQ.swift @@ -0,0 +1,107 @@ +import Foundation + +/// JBL's preset encoder for the five-band "advanced level" models (Go 4, Clip 5, Tuner 3). +/// +/// Selecting a preset is not a level write: JBL's app sends each preset band's +/// biquad coefficients as five fixed-point int32s (DefaultPresetEQPayload in +/// JBL Portable). The speaker replies with an AA 99 whose first byte is the +/// newly active category, which is how the app confirms the switch. +/// +/// Ported one-for-one from the decompiled DefaultPresetEQPayload.genFirmwarePayload. +public enum PresetEQ { + /// 2^29: the Q-format scale JBL's encoder uses for every coefficient. + static let scale = 536_870_912.0 + /// Java's 3.1415927f, converted to the double the encoder actually multiplies. + static let pi = Double(Float.pi) + + /// Five coefficients, in JBL's order: b0, b1, b2, -a1, -a2. + public static func coefficients(for band: EQBand, sampleRate: Double = 48000) -> [Int32] { + let frequency = Double(band.frequency) + let gain = Double(band.gain) + var q = Double(band.q) + let tan = 1 / tan((pi * frequency) / sampleRate) + let tan2 = tan * tan + let amplitude = pow(10, gain * 0.05) + + var b0 = 0.0, b1 = 0.0, b2 = 0.0, a0 = 1.0, a1 = 0.0, a2 = 0.0 + + switch band.type { + case .peaking: + if amplitude < 1 { q *= amplitude } + let peak = (amplitude * tan) / q + let denominator = 1 + (tan / q) + tan2 + b0 = 1 + peak + tan2 + b1 = 2 * (1 - tan2) + b2 = (1 - peak) + tan2 + a0 = denominator + a1 = b1 + a2 = tan2 + (1 - (tan / q)) + + case .highShelf: + var a = amplitude + var inverse = 1.0 + if a <= 1 { inverse = 1 / a; a = 1 } + let root = sqrt(a) + let scaled = a * tan2 + let numerator0 = 1 + (root * tan / q) + scaled + let numerator1 = 2 * (1 - scaled) + let numerator2 = (1 - (root * tan / q)) + scaled + let inverseTan = tan2 * inverse + a0 = 1 + (sqrt(inverse) * tan / q) + inverseTan + a1 = 2 * (1 - inverseTan) + a2 = inverseTan + (1 - (sqrt(inverse) * tan / q)) + b0 = numerator0 + b1 = numerator1 + b2 = numerator2 + + case .lowShelf: + var a = amplitude + var inverse = 1.0 + if a <= 1 { inverse = 1 / a; a = 1 } + let root = sqrt(a) + let numerator0 = (root * tan / q) + a + tan2 + let numerator1 = 2 * (a - tan2) + let numerator2 = (a - (root * tan / q)) + tan2 + a0 = inverse + (sqrt(inverse) * tan / q) + tan2 + a1 = 2 * (inverse - tan2) + a2 = (inverse - (sqrt(inverse) * tan / q)) + tan2 + b0 = numerator0 + b1 = numerator1 + b2 = numerator2 + + case .highPass: + b0 = tan2 + b1 = -2 * tan2 + b2 = tan2 + a0 = 1 + (tan / q) + tan2 + a1 = 2 * (1 - tan2) + a2 = (1 - (tan / q)) + tan2 + + case .lowPass: + b0 = 1 + b1 = 2 + b2 = 1 + a0 = 1 + (tan / q) + tan2 + a1 = 2 * (1 - tan2) + a2 = tan2 + (1 - (tan / q)) + } + + let normal = 1 / a0 + return [b0, b1, b2, -a1, -a2].map { value in + Int32((value * normal * scale) + 0.5) + } + } + + /// Category then coefficients: the payload an AA 97 carries to select a preset. + public static func payload(category: UInt8, bands: [EQBand], sampleRate: Double = 48000) -> [UInt8] { + var payload: [UInt8] = [category] + for band in bands { + for value in coefficients(for: band, sampleRate: sampleRate) { + let bits = UInt32(bitPattern: value) + payload += [UInt8(bits & 0xFF), UInt8((bits >> 8) & 0xFF), + UInt8((bits >> 16) & 0xFF), UInt8((bits >> 24) & 0xFF)] + } + } + return payload + } +} diff --git a/Sources/JBLControlKit/Protocol4.swift b/Sources/JBLControlKit/Protocol4.swift index 9f59f3b..3951e69 100644 --- a/Sources/JBLControlKit/Protocol4.swift +++ b/Sources/JBLControlKit/Protocol4.swift @@ -57,6 +57,24 @@ public struct P4Message: Equatable, Sendable { private func le16(_ v: UInt16) -> [UInt8] { [UInt8(v & 0xFF), UInt8(v >> 8)] } +/// Protocol 4's multi-speaker features (`DeviceFeature` in JBL's app). +/// +/// Protocol 4 models (Boombox 4, Xtreme 5, Grip, Go 5) carry Auracast and the +/// stereo channel as features instead of the legacy `AA 6A` / `AA 15` frames. +public enum P4Party { + /// 8196: 0 off, 1 on. JBL's app sends only 0/1 here, unlike the legacy link mode's 0/1/2. + public static let auracastMode: UInt16 = 0x2004 + public static let status: UInt16 = 0x2C00 + public static let groupType: UInt16 = 0x2C01 + public static let connection: UInt16 = 0x2C02 + public static let role: UInt16 = 0x2C03 + public static let channel: UInt16 = 0x2C04 + public static let groupName: UInt16 = 0x2C05 + public static let groupID: UInt16 = 0x2C06 + public static let groupAction: UInt16 = 0x2C07 + public static let partnerAddress: UInt16 = 0x2C81 +} + /// Anything the speaker sends on the notify characteristic. public enum Incoming: Equatable, Sendable { case legacy(Frame) diff --git a/Tests/JBLControlKitTests/AuracastTests.swift b/Tests/JBLControlKitTests/AuracastTests.swift new file mode 100644 index 0000000..71a0da2 --- /dev/null +++ b/Tests/JBLControlKitTests/AuracastTests.swift @@ -0,0 +1,126 @@ +import Foundation +import Testing +@testable import JBLControlKit + +// Frames from JBL Portable 6.9.33 (com.harman.ble.jbllink), decompiled: +// SetLinkModeCommand, SetChannelCommand, SetChannelLockCommand, ReqAuracastGroupCommand, +// SetAuraCastGroupCommand and SetAuracastGroupNonLLSCommand. + +@Test func linkModeFramesMatchJBLApp() { + #expect(Frame.setLinkMode(.auracast).encoded == bytes("AA 6A 01 02")) + #expect(Frame.setLinkMode(.partyBoost).encoded == bytes("AA 6A 01 01")) + #expect(Frame.setLinkMode(.off).encoded == bytes("AA 6A 01 00")) + #expect(Frame.requestLinkRole.encoded == bytes("AA 17 00")) +} + +@Test func channelFramesMatchJBLApp() { + // SetDeviceInfo (0x15): device index, token 0x46, channel byte. + #expect(Frame.setAudioChannel(.left).encoded == bytes("AA 15 03 00 46 01")) + #expect(Frame.setAudioChannel(.right).encoded == bytes("AA 15 03 00 46 02")) + #expect(Frame.setAudioChannel(.mono).encoded == bytes("AA 15 03 00 46 00")) + #expect(Frame.setStereoLock(true).encoded == bytes("AA 15 03 00 49 01")) + #expect(Frame.setStereoLock(false).encoded == bytes("AA 15 03 00 49 00")) +} + +@Test func audioChannelSwaps() { + #expect(AudioChannel.left.swapped == .right) + #expect(AudioChannel.right.swapped == .left) + #expect(AudioChannel.mono.swapped == .mono) + #expect(AudioChannel(channel: 2) == .right) + #expect(AudioChannel(channel: 9) == nil) +} + +@Test func stereoInfoTokensParse() { + #expect(InfoToken.parse([0x00, 0x46, 0x01]) == .audioChannel(.left)) + #expect(InfoToken.parse([0x00, 0x46, 0x02]) == .audioChannel(.right)) + #expect(InfoToken.parse([0x00, 0x46, 0x00]) == .audioChannel(.mono)) + #expect(InfoToken.parse([0x00, 0x49, 0x01]) == .stereoLock(true)) + #expect(InfoToken.parse([0x00, 0x4C, 0x01]) == .auracastSupport(true)) + #expect(InfoToken.parse([0x00, 0x45, 0x02]) == .linkedDevices(2)) +} + +@Test func compactStereoGroupWriteMatchesApp() throws { + let frame = Frame.setAuracastGroup(.init(action: .create, type: .stereo, channel: .left, + groupID: [0x1A, 0x2B, 0x3C, 0x4D])) + #expect(frame.encoded == bytes("AA A0 0F 01 01 01 02 01 01 04 01 01 05 04 1A 2B 3C 4D")) + + let destroy = Frame.setAuracastGroup(.init(action: .destroy, type: .stereo, channel: .mono, + groupID: [0x1A, 0x2B, 0x3C, 0x4D])) + #expect(destroy.encoded == bytes("AA A0 0F 01 01 02 02 01 01 04 01 00 05 04 1A 2B 3C 4D")) +} + +@Test func longLastingStereoGroupWriteMatchesApp() { + let frame = Frame.setAuracastGroup(.init(action: .create, type: .stereo, role: .master, + channel: .right, groupID: [0x01, 0x02, 0x03, 0x04], + name: "Go 4", partnerAddress: [1, 2, 3, 4, 5, 6], + longLasting: true)) + #expect(frame.encoded == bytes(""" + AA A0 23 01 01 01 02 01 01 03 01 01 04 01 02 05 04 01 02 03 04 06 04 47 6F 20 34 07 06 01 02 03 04 05 06 08 01 14 + """)) +} + +@Test func auracastGroupReplyParses() throws { + var d = MessageDecoder() + let messages = d.feed(bytes(""" + AA A2 17 01 01 01 02 01 01 03 01 01 04 01 01 05 04 1A 2B 3C 4D 06 03 4B 69 74 + """)) + guard case .legacy(let frame) = try #require(messages.first) else { + Issue.record("expected a legacy frame") + return + } + #expect(frame.command == Command.auracastGroup.rawValue) + let group = AuracastGroup(payload: frame.payload) + #expect(group.action == .create) + #expect(group.type == .stereo) + #expect(group.role == .master) + #expect(group.channel == .left) + #expect(group.groupID == [0x1A, 0x2B, 0x3C, 0x4D]) + #expect(group.name == "Kit") + #expect(group.isStereo) + #expect(group.groupIDHex == "1A2B3C4D") +} + +@Test func protocol4AuracastAndChannelFrames() { + // DeviceFeature ids from JBL's app: AuraCastMode 0x2004, PartyChannelType 0x2C04. + #expect(P4Message.set([(P4Party.auracastMode, [0x01])]).packets + == [bytes("00 DD 02 00 01 00 05 00 04 20 01 00 01")]) + #expect(P4Message.set([(P4Party.channel, [AudioChannel.right.rawValue])]).packets + == [bytes("00 DD 02 00 01 00 05 00 04 2C 01 00 02")]) +} + +@Test func protocol4PartyFeaturesAreParsed() { + let model = Catalog.model(0x214E)! + let channel = P4Message(command: P4Message.get, + payload: [0x04, 0x2C, 0x01, 0x00, 0x02]) + #expect(model.family.usesProtocol4) + #expect(P4Party.channel == 0x2C04) + #expect(channel.features[P4Party.channel] == [0x02]) +} + +@Test func go4AdvertisesAuracastAndStereoChannel() throws { + let go4 = try #require(Catalog.model(0x20E4)) + #expect(go4.hasAuracast) + #expect(go4.hasStereoChannel) + #expect(!go4.stereoIsAutomatic) + #expect(!go4.writesNeedOptIn) + + let duo = try #require(Catalog.model(0x215C)) + #expect(duo.hasAuracast) + #expect(duo.stereoIsAutomatic) + #expect(!duo.hasStereoChannel) + #expect(duo.writesNeedOptIn) +} + +@Test func simpleEQSignatureFrameMatchesApp() throws { + let charge5 = try #require(Catalog.model(0x2040)) + #expect(charge5.pickerPresets.map(\.name) == ["Signature", "Custom"]) + let signature = try #require(charge5.pickerPresets.first) + #expect(signature.category == 0x01) + #expect(EQCodec(model: charge5).select(signature, customGains: [0, 0, 0]) == [bytes("AA 6E 02 01 00")]) +} + +@Test func simpleEQCannotSelectAnUnknownPreset() throws { + let charge5 = try #require(Catalog.model(0x2040)) + let energetic = EQPreset(category: 0x08, name: "Energetic", bands: []) + #expect(EQCodec(model: charge5).select(energetic, customGains: [0, 0, 0]).isEmpty) +} diff --git a/Tests/JBLControlKitTests/Go4Tests.swift b/Tests/JBLControlKitTests/Go4Tests.swift new file mode 100644 index 0000000..afa3f0a --- /dev/null +++ b/Tests/JBLControlKitTests/Go4Tests.swift @@ -0,0 +1,125 @@ +import Foundation +import Testing +@testable import JBLControlKit + +/// The JBL Go 4 speaks the legacy "advanced level" EQ: five integer bands inside the AA 97 frame. +/// +/// The frames below are byte-for-byte what openjbl 0.3.0 builds for PID 20E4 from the JBL Portable +/// app's own model data, so this is a regression fence rather than a guess. Whether a given Go 4 +/// firmware accepts the write still has to be confirmed on hardware: reads are safe either way. + +private let go4PIDs: [UInt16] = [0x20E4, 0x210A, 0x215C, 0x2181] + +@Test func go4ModelsUseFiveLevelBands() throws { + for pid in go4PIDs { + let model = try #require(Catalog.model(pid)) + #expect(model.family == .legacyLevels) + #expect(model.customCategory == 0xC1) + #expect(model.customBands.count == 5) + #expect(model.customBands.map(\.frequency) == [100, 1000, 2000, 7000, 10000]) + #expect(model.customBands.allSatisfy { $0.range == -6...6 && $0.step == 1 }) + } +} + +@Test func go4CustomWriteIsByteExact() throws { + let go4 = try #require(Catalog.model(0x20E4)) + let frame = try #require(EQCodec(model: go4).setCustom([0, 0, 0, 0, 0]).first) + #expect(frame == bytes("AA 97 00 0E C1 C1 06 05 01 00 02 00 03 00 04 00 05 00")) +} + +@Test func go4PresetSelectSendsBiquadCoefficients() throws { + // Captured on a real Go 4: this is the frame JBL's DefaultPresetEQPayload + // builds for Signature, and the speaker answers with AA 99 … 06 … (active = 06). + let go4 = try #require(Catalog.model(0x210A)) + let signature = try #require(go4.presets.first { $0.category == 0x06 }) + let frame = try #require(EQCodec(model: go4).select(signature, customGains: []).first) + expectPresetFrame(frame, "AA 97 00 65 06 00 00 00 20 62 ED 6B C0 9F 77 95 1F 9F 12 94 3F 62 88 6A E0 00 00 00 20 8C 57 6F C4 F4 3C 14 1C 75 A8 90 3B 0D C3 EB E3 00 00 00 20 AC 9B 43 C9 0F B2 AA 18 55 64 BC 36 F2 4D 55 E7 00 00 00 20 B7 CC 1A E4 25 B4 D2 0D 4A 33 E5 1B DC 4B 2D F2 00 00 00 20 F1 86 D4 F4 FC 26 28 0B 10 79 2B 0B 05 D9 D7 F4") +} + +@Test func go4ChillPresetCoversShelvesAndLowPass() throws { + // Chill exercises the low-shelf, high-shelf and low-pass coefficient paths, + // which Signature (peaking only) does not. Captured on the same Go 4. + let go4 = try #require(Catalog.model(0x20E4)) + let chill = try #require(go4.presets.first { $0.category == 0x22 }) + let frame = try #require(EQCodec(model: go4).select(chill, customGains: []).first) + expectPresetFrame(frame, "AA 97 00 65 22 50 F4 EB 1F FA A4 FC C0 8A C8 18 1F 0B 12 03 3F 2B FA FA E0 00 00 00 20 8C 57 6F C4 F4 3C 14 1C 75 A8 90 3B 0D C3 EB E3 86 B9 47 1F 75 51 18 C8 EB 56 B8 19 8C AE E7 37 90 EF FF E6 2F 54 EA 18 E4 04 5C EB 2D 59 46 04 F7 47 EB 1E CB 05 88 F8 48 55 55 09 91 AA AA 12 48 55 55 09 2F 00 00 00 B0 AA AA FA") +} + +/// The header and category must be byte-exact; a coefficient may drift by a few +/// LSBs between platforms' tan/sqrt implementations, which the firmware accepts. +private func expectPresetFrame(_ frame: Data, _ expectedHex: String) { + let expected = bytes(expectedHex) + #expect(frame.prefix(5) == expected.prefix(5)) + #expect(frame.count == expected.count) + guard frame.count == expected.count else { return } + func int32(_ data: Data, _ offset: Int) -> Int32 { + let b = data.startIndex + offset + return Int32(bitPattern: UInt32(data[b]) | UInt32(data[b + 1]) << 8 + | UInt32(data[b + 2]) << 16 | UInt32(data[b + 3]) << 24) + } + var offset = 5 + while offset + 3 < frame.count { + #expect(abs(Int(int32(frame, offset)) - Int(int32(expected, offset))) <= 2048, + "coefficient at byte \(offset)") + offset += 4 + } +} + +@Test func xtreme4PresetsAreNotImplementedYet() throws { + // Xtreme 4 uses the AKM encoder instead of DefaultPresetEQPayload. + let xtreme4 = try #require(Catalog.model(0x20DC)) + #expect(!xtreme4.supportsPresets) + #expect(xtreme4.pickerPresets.map(\.name) == ["Custom"]) + let signature = try #require(xtreme4.presets.first) + #expect(EQCodec(model: xtreme4).select(signature, customGains: []).isEmpty) +} + +@Test func emptyCustomCurveNeverSendsZeroBands() throws { + let go4 = try #require(Catalog.model(0x20E4)) + let frame = try #require(EQCodec(model: go4).setCustom([]).first) + #expect(frame == bytes("AA 97 00 0E C1 C1 06 05 01 00 02 00 03 00 04 00 05 00")) +} + +@Test func go4LevelReplyParsesBack() throws { + let go4 = try #require(Catalog.model(0x20E4)) + let reply = Incoming.legacy(Frame(0x99, [0x06, 0xC1, 0x06, 0x05, 0x01, 0x01, 0x02, 0xFE, + 0x03, 0x00, 0x04, 0x03, 0x05, 0xFA])) + #expect(EQCodec(model: go4).parse(reply) == EQSnapshot(activeCategory: 0x06, gains: [1, -2, 0, 3, -6])) +} + +// MARK: - Captured from a real Go 4 (PID 20E4, firmware 0.6.4.0) + +@Test func go4InfoBurstParses() { + var d = FrameDecoder() + let frames = d.feed(bytes(""" + AA 12 0B 00 C1 08 4A 42 4C 20 47 6F 20 34 AA 12 04 00 42 20 E4 AA 12 03 00 43 15 AA 12 03 00 44 2D AA 12 03 00 46 00 AA 12 03 00 4C 01 AA 12 06 00 4D 30 36 34 30 + """)) + let tokens = frames.compactMap { InfoToken.parse($0.payload) } + #expect(tokens == [ + .name("JBL Go 4"), .productID(0x20E4), .color(0x15), .battery(level: 45, charging: false), + .audioChannel(.mono), .auracastSupport(true), .firmware("0.6.4.0"), + ]) +} + +@Test func firmwareAcceptsBothByteAndAsciiForms() { + #expect(FirmwareVersion.format([0x00, 0x07, 0x02, 0x00]) == "0.7.2.0") + #expect(FirmwareVersion.format([0x30, 0x36, 0x34, 0x30]) == "0.6.4.0") + #expect(FirmwareVersion.format([0x03, 0x05, 0x01]) == "3.5.1") +} + +@Test func emptyGroupStatusMeansNoGroup() { + let group = AuracastGroup(payload: []) + #expect(group.channel == nil) + #expect(group.type == nil) + #expect(!group.isStereo) +} + +// MARK: - Auracast (token 3C) + +@Test func auracastTokenParses() { + #expect(InfoToken.parse([0x00, 0x3C, 0x01]) == .auracast(0x01)) + #expect(InfoToken.parse([0x00, 0x3C, 0x00]) == .auracast(0x00)) + var decoder = FrameDecoder() + let frames = decoder.feed(bytes("AA 12 03 00 3C 01")) + #expect(frames.first.flatMap { InfoToken.parse($0.payload) } == .auracast(0x01)) +} diff --git a/docs/PROTOCOL-FLIP7.md b/docs/PROTOCOL-FLIP7.md index c369e36..34e8116 100644 --- a/docs/PROTOCOL-FLIP7.md +++ b/docs/PROTOCOL-FLIP7.md @@ -87,5 +87,5 @@ battery `94` = charging, 20%. ## Not yet mapped -Playtime Boost, feedback tones, Auracast, auto standby. Next step: capture JBL Portable on an iPhone with -Apple's Bluetooth logging profile + PacketLogger while toggling each one, then diff the `AA 12` tokens above. +Playtime Boost, feedback tones, auto standby. Auracast and the stereo channel are documented in +[PROTOCOL-GO4.md](PROTOCOL-GO4.md); they use `AA 6A` (link mode) and `AA 15 03 00 46 …` (channel). diff --git a/docs/PROTOCOL-GO4.md b/docs/PROTOCOL-GO4.md new file mode 100644 index 0000000..115388f --- /dev/null +++ b/docs/PROTOCOL-GO4.md @@ -0,0 +1,136 @@ +# JBL Go 4 β€” protocol notes + +Go 4 owners (PIDs `20E4`, `210A`; the Duo is `215C` left / `2181` +right) speak the same AA control protocol as the Flip 7, with two differences: EQ is the +five-band integer "advanced level" form, and the unit exposes a real stereo channel command. + +Sources: an openjbl EQ audit on PID `20E4` (2026-11-14, read-back verified), this project's +Flip 7 captures, and static analysis of **JBL Portable 6.9.33** (`com.harman.ble.jbllink`) +decompiled with jadx. Class names below come from that APK. + +## EQ β€” legacy advanced level (`AA 97 / 98 / 99`), five bands + +```text +request AA 98 00 00 +set AA 97 | len:u16be | active_category | C1 | 06 | count | (band_index | s8 level) * count +reply AA 99 | active_category | C1 | 06 | count | (band_index | s8 level) * count +request one token AA 13 02 00 +``` + +A flat custom curve on a Go 4 is exactly: + +```text +AA 97 00 0E C1 C1 06 05 01 00 02 00 03 00 04 00 05 00 +``` + +- Five bands at 100 Hz, 1 kHz, 2 kHz, 7 kHz and 10 kHz; integer levels in βˆ’6…+6 dB. +- The level byte indexes the firmware's own table, so out-of-range values are undefined, not louder. +- `C1` selects the custom curve. The four presets are the model data's categories: + 06 Signature, 22 Chill, 08 Energetic, 03 Vocal. +- `0x97` is answered by `0x99` with the new state, not by a separate `DEV_ACK`; `EE` + means the firmware rejected the write. +- Verified on hardware: openjbl wrote `AA 97 00 0E C1 C1 06 05 01 FF 02 03 03 04 04 00 05 00` + and read every band back with `AA 98 00 00`. The Go 4 is therefore marked **Verified** in the + catalog and needs no experimental opt-in. + +JBL's app selects a **preset** with a different payload: `DefaultPresetEQPayload` turns each +preset band into five fixed-point biquad coefficients and sends + +```text +AA 97 | len:u16be | active_category | (b0 | b1 | b2 | -a1 | -a2):int32le * bands +``` + +That is 101 bytes for the Go 4's five bands (`AA 97 00 65 …`), and the speaker replies with an +`AA 99` whose first byte is the new active category. JBLControl implements this encoder +(`PresetEQ`) and it was verified on a Go 4: Signature, Chill and Vocal each switched the active +category and echoed the coefficients. The custom curve stays untouched, as the reply's `C1` +levels show. + +Xtreme 4 is the one `.legacyLevels` model that uses a different (AKM) coefficient encoder; its +presets are hidden until that encoder is ported. + +## Auracast and stereo β€” `AA 6A`, `AA 15`, `AA A0/A1/A2` + +JBL's app has an Auracast screen with a broadcast switch, a PartyBoost mode and a left/right +channel picker. The commands are: + +```text +link mode on AA 6A 01 02 (0 off, 1 PartyBoost, 2 Auracast) +link mode off AA 6A 01 00 +link mode reply AA 6B 01 (0 normal, 1 master, 2 slave, 3 standby) +role check AA 17 00 β†’ AA 16 01 + +channel AA 15 03 00 46 00 (00 none/mono, 01 left, 02 right) +stereo lock AA 15 03 00 49 00 (00 unlocked, 01 locked) +set-token ack AA 00 02 15 00 + +group status AA A1 00 β†’ AA A2 +group create AA A0 TLV (compact: 01 01 action | 02 01 type | 04 01 channel | 05 04 id) +``` + +`SetLinkModeCommand`, `SetChannelCommand`, `SetChannelLockCommand` and +`SetAuraCastGroupCommand` in the APK build exactly these frames. `SetLinkModeCommand` answers +`AA 6B` with the role the unit took; `SetChannelCommand` checks the device-info ACK +`AA 00 02 15 00`. + +### Token map (`AA 12`) + +| Token | Meaning | Values | +|---|---|---| +| `0x3C` | older Play Together / Auracast bit | 0 off, 1 on | +| `0x45` | linked units | count | +| `0x46` | **audio channel** | 0 none, 1 left, 2 right | +| `0x49` | stereo lock | 0 / 1 | +| `0x4C` | Auracast supported | 0 / 1 | + +### Group status (`AA A2`) + +TLVs are `token | length | value`: + +| Token | Meaning | +|---|---| +| `01` | action: 1 create, 2 destroy, 3 prepare | +| `02` | type: 1 stereo, 2 party | +| `03` | role | +| `04` | channel | +| `05` | 4-byte group id | +| `06` | group name (UTF-8) | +| `07` | partner address (6 bytes) | +| `08` | app writes `14`; only read back | + +### How the pair is formed + +- Two Go 4s join each other on the speakers: press the Auracast button on the second one. +- The app then assigns each unit its half with `AA 15 03 00 46 01` (left) or `...02` (right). +- The Duo (`215C` / `2181`) uses AirTouch: bump the two units together and the firmware + picks the halves itself. The APK deliberately ignores the channel TLV for AirTouch models, so + JBLControl shows AirTouch models as read-only and offers the button flow instead. +- JBL's app can also create the group from the phone, because it holds a link to both units at + once (`createStereoGroupCommandToPrimary` / `...ToSec`). JBLControl talks to one speaker at a + time; its `AuracastGroupRequest` frame builder covers that command for a future two-link + pairing flow. + +## Hardware status (2026-11-15) + +Verified on a Go 4 (`20E4`, firmware `0.6.4.0`) over BLE: + +- Custom EQ: wrote a modified five-band curve, the `0x99` reply and a fresh `0x98` read both + matched, and the original curve was restored. +- Presets: the `DefaultPresetEQPayload` frames for Signature, Chill and Vocal each switched the + active category (`AA 99 … 06/22/03 …`) and echoed the coefficients. +- Channel: `AA 15 03 00 46 01/02/00` was ACKed (`AA 00 02 15 00`); token `0x46` still read + `00` outside a group, which is why the app trusts the ACK over a later token read. +- Link mode: `AA 6A 01 02` answered `AA 16 01 01` (role master). The unit then stopped + answering new BLE control connections until it left broadcast mode. The speaker's Auracast + button is the way out if a link drops; JBLControl holds its own link, but a Mac cannot reopen + one while the unit is broadcasting. + +Not yet tested on hardware: a second Go 4, the actual left/right split, and the group +`AA A0` / `AA A2` flow. That is the next step with two units. + +## What a Mac cannot do + +- CoreBluetooth is GATT only. macOS has no LE Audio / ISO / BASS API, so JBLControl cannot be the + audio source or a receiver; it only sends the control frames above. +- Left/right is a normal control-channel write, not an OS-level operation, so assigning it from + a Mac works β€” that is what the Auracast card does. diff --git a/docs/SUPPORTED_MODELS.md b/docs/SUPPORTED_MODELS.md index 4657072..048f6c1 100644 --- a/docs/SUPPORTED_MODELS.md +++ b/docs/SUPPORTED_MODELS.md @@ -2,45 +2,45 @@ Generated by `scripts/generate-catalog.py`. Don't edit by hand. -| Model | PID | Support | EQ | -|---|---|---|---| -| JBL Charge 5 | `2040` | βœ… Verified | Bass / mid / treble | -| JBL Charge 6 | `20E3` | βœ… Verified | 7-band parametric + presets | -| JBL Flip 7 | `2107` | βœ… Verified | 7-band parametric + presets | -| JBL Clip 5 | `20F5` | 🟠 Beta | Band levels + presets | -| JBL Go 4 | `20E4` | 🟠 Beta | Band levels + presets | -| JBL Go 4 | `210A` | 🟠 Beta | Band levels + presets | -| JBL Go 4 Duo (L) | `215C` | 🟠 Beta | Band levels + presets | -| JBL Go 4 Duo (R) | `2181` | 🟠 Beta | Band levels + presets | -| JBL Tuner 3 | `214C` | 🟠 Beta | Band levels + presets | -| JBL Xtreme 3 | `202F` | 🟠 Beta | Bass / mid / treble | -| JBL Xtreme 4 | `20DC` | 🟠 Beta | Band levels + presets | -| JBL Boombox | `1EE7` | 🟣 Experimental | None (battery and info only) | -| JBL Boombox | `1F27` | 🟣 Experimental | None (battery and info only) | -| JBL Boombox 2 | `1F53` | 🟣 Experimental | Bass / mid / treble | -| JBL Boombox 3 | `206D` | 🟣 Experimental | Bass / mid / treble | -| JBL Boombox 4 | `214E` | 🟣 Experimental | 7-band parametric + presets (Protocol 4) | -| JBL Charge 3 | `1EBC` | 🟣 Experimental | None (battery and info only) | -| JBL Charge 4 | `1F17` | 🟣 Experimental | None (battery and info only) | -| JBL Charge 4 | `1F29` | 🟣 Experimental | None (battery and info only) | -| JBL Charge Essential 3 SE | `218A` | 🟣 Experimental | 7-band custom (Protocol 4) | -| JBL Flip 4 | `1ED1` | 🟣 Experimental | None (battery and info only) | -| JBL Flip 5 | `1F31` | 🟣 Experimental | None (battery and info only) | -| JBL Flip 6 | `204F` | 🟣 Experimental | Bass / mid / treble | -| JBL Flip Essential 3 SE | `2185` | 🟣 Experimental | 7-band custom (Protocol 4) | -| JBL Go 5 | `2168` | 🟣 Experimental | 7-band custom (Protocol 4) | -| JBL Grip | `2132` | 🟣 Experimental | 7-band custom (Protocol 4) | -| JBL Pulse 3 | `1ED2` | 🟣 Experimental | None (battery and info only) | -| JBL Pulse 4 | `1F56` | 🟣 Experimental | None (battery and info only) | -| JBL Pulse 5 | `2050` | 🟣 Experimental | Bass / mid / treble | -| JBL Xtreme 2 | `1EFC` | 🟣 Experimental | None (battery and info only) | -| JBL Xtreme 2 | `1F26` | 🟣 Experimental | None (battery and info only) | -| JBL Xtreme 2 | `2038` | 🟣 Experimental | None (battery and info only) | -| JBL Xtreme 5 | `2169` | 🟣 Experimental | 7-band parametric + presets (Protocol 4) | -| JBL Boombox 3 Wi-Fi | `2075` | β›” Unsupported | None (battery and info only) | -| JBL Charge 5 Wi-Fi | `208C` | β›” Unsupported | None (battery and info only) | -| JBL Flip 3 | `0023` | β›” Unsupported | None (battery and info only) | -| JBL Xtreme | `0024` | β›” Unsupported | None (battery and info only) | +| Model | PID | Support | EQ | Multi-speaker | +|---|---|---|---|---| +| JBL Charge 5 | `2040` | βœ… Verified | Bass / mid / treble | β€” | +| JBL Charge 6 | `20E3` | βœ… Verified | 7-band parametric + presets | Auracast Β· PartyBoost | +| JBL Flip 7 | `2107` | βœ… Verified | 7-band parametric + presets | Auracast Β· PartyBoost | +| JBL Go 4 | `20E4` | βœ… Verified | Band levels + presets | Auracast Β· PartyBoost | +| JBL Go 4 | `210A` | βœ… Verified | Band levels + presets | Auracast Β· PartyBoost Β· Stereo (kept) | +| JBL Clip 5 | `20F5` | 🟠 Beta | Band levels + presets | Auracast Β· PartyBoost | +| JBL Go 4 Duo (L) | `215C` | 🟠 Beta | Band levels + presets | Auracast Β· PartyBoost Β· AirTouch stereo | +| JBL Go 4 Duo (R) | `2181` | 🟠 Beta | Band levels + presets | Auracast Β· PartyBoost Β· AirTouch stereo | +| JBL Tuner 3 | `214C` | 🟠 Beta | Band levels + presets | Auracast Β· PartyBoost | +| JBL Xtreme 3 | `202F` | 🟠 Beta | Bass / mid / treble | β€” | +| JBL Xtreme 4 | `20DC` | 🟠 Beta | Band levels + custom (AKM preset encoder pending) | Auracast Β· Stereo (kept) | +| JBL Boombox | `1EE7` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Boombox | `1F27` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Boombox 2 | `1F53` | 🟣 Experimental | Bass / mid / treble | β€” | +| JBL Boombox 3 | `206D` | 🟣 Experimental | Bass / mid / treble | Auracast Β· PartyBoost | +| JBL Boombox 4 | `214E` | 🟣 Experimental | 7-band parametric + presets (Protocol 4) | Auracast Β· PartyBoost | +| JBL Charge 3 | `1EBC` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Charge 4 | `1F17` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Charge 4 | `1F29` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Charge Essential 3 SE | `218A` | 🟣 Experimental | 7-band custom (Protocol 4) | Auracast Β· PartyBoost | +| JBL Flip 4 | `1ED1` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Flip 5 | `1F31` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Flip 6 | `204F` | 🟣 Experimental | Bass / mid / treble | β€” | +| JBL Flip Essential 3 SE | `2185` | 🟣 Experimental | 7-band custom (Protocol 4) | Auracast Β· PartyBoost | +| JBL Go 5 | `2168` | 🟣 Experimental | 7-band custom (Protocol 4) | Auracast Β· PartyBoost | +| JBL Grip | `2132` | 🟣 Experimental | 7-band custom (Protocol 4) | Auracast Β· PartyBoost | +| JBL Pulse 3 | `1ED2` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Pulse 4 | `1F56` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Pulse 5 | `2050` | 🟣 Experimental | Bass / mid / treble | β€” | +| JBL Xtreme 2 | `1EFC` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Xtreme 2 | `1F26` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Xtreme 2 | `2038` | 🟣 Experimental | None (battery and info only) | β€” | +| JBL Xtreme 5 | `2169` | 🟣 Experimental | 7-band parametric + presets (Protocol 4) | Auracast Β· PartyBoost | +| JBL Boombox 3 Wi-Fi | `2075` | β›” Unsupported | None (battery and info only) | β€” | +| JBL Charge 5 Wi-Fi | `208C` | β›” Unsupported | None (battery and info only) | β€” | +| JBL Flip 3 | `0023` | β›” Unsupported | None (battery and info only) | β€” | +| JBL Xtreme | `0024` | β›” Unsupported | None (battery and info only) | β€” | - **Verified**: reads and EQ writes confirmed byte for byte on real hardware. - **Beta**: protocol from the JBL Portable app. Battery/info and EQ reads are safe; EQ changes need diff --git a/scripts/generate-catalog.py b/scripts/generate-catalog.py index 4cd766d..7e035ce 100755 --- a/scripts/generate-catalog.py +++ b/scripts/generate-catalog.py @@ -25,8 +25,26 @@ } SUPPORT_LABEL = {"verified": "βœ… Verified", "beta": "🟠 Beta", "experimental": "🟣 Experimental", "unsupported": "β›” Unsupported"} + +def MULTI_LABEL(feat): + names = [] + if feat["auracast"]: + names.append("Auracast") + if feat["partyBoost"]: + names.append("PartyBoost") + if feat["longLastingStereo"]: + names.append("Stereo (kept)") + if feat["airTouchStereo"]: + names.append("AirTouch stereo") + return " Β· ".join(names) or "β€”" + # Models whose wire format has been confirmed byte for byte on real hardware. -VERIFIED = {"2107", "20e3", "2040"} # Flip 7 (this project), Charge 6 (openjbl), Charge 5 (issue #1) +# Flip 7 (this project), Charge 6 (openjbl), Charge 5 (issue #1), and the Go 4 +# (audit log: a C1 level write read back band for band on PID 20e4). The Duo is the +# same firmware but has not been captured, so it stays Beta. +VERIFIED = {"2107", "20e3", "2040", "20e4", "210a"} +# The models JBL's own app drives with its newer stereo flow (DeviceUtils.supportNewStereoFlow). +NEW_STEREO_FLOW = {"20dc", "210a", "2107", "20e3"} # Protocol 4 models that take quantized 0E7F EQ instead of 0E02 parametric. QUANTIZED_P4 = {"2132", "2168", "2185", "218a"} @@ -64,6 +82,28 @@ def family(model): return "infoOnly" +def features(model): + """Multi-speaker capabilities from the same APK feature list.""" + f = set(model.get("features", [])) + return { + "auracast": "AURACAST_SUPPORT" in f, + "partyBoost": "NON_PARTY_BOOST_SUPPORT" in f or "PARTYBOOST_BUTTON_SUPPORT" in f, + "longLastingStereo": "LONG_LASTING_STEREO" in f, + "airTouchStereo": "AIR_TOUCH_STEREO" in f, + "newStereoFlow": model["pid"].lower() in NEW_STEREO_FLOW, + } + + +def swift_features(feat): + args = ", ".join(f"{k}: true" for k, v in feat.items() if v) + return f"ModelFeatures({args})" if args else ".none" + + +def csharp_features(feat): + args = ", ".join(f"{k}: true" for k, v in feat.items() if v) + return f"new ModelFeatures({args})" if args else "new ModelFeatures()" + + def support(model, fam): name, transport = model["deviceName"], model.get("protocol", "") if "Wi-Fi" in name or transport == "PROTOCOL_SPP": @@ -164,11 +204,12 @@ def main(): for code, c in sorted(m.get("productImageUrls", {}).items(), key=lambda kv: int(kv[0], 16)) if c.get("gradientS") and c.get("gradientE") ) - rows.append((["verified", "beta", "experimental", "unsupported"].index(sup), name, m["pid"].upper(), sup, fam)) + feat = features(m) + rows.append((["verified", "beta", "experimental", "unsupported"].index(sup), name, m["pid"].upper(), sup, fam, feat)) lines.append( f' SpeakerModel(productID: 0x{int(m["pid"], 16):04X}, name: "{name}", family: .{fam}, ' f'support: .{sup}, formFactor: .{form_factor(name)}, presets: {presets},\n' - f' colors: [{colors or ":"}]),' + f' colors: [{colors or ":"}], features: {swift_features(feat)}),' ) cs_colors_block = (f"new Dictionary {{ {cs_colors} }}" if cs_colors else "new Dictionary()") @@ -176,7 +217,7 @@ def main(): f' new SpeakerModel(productId: 0x{int(m["pid"], 16):04X}, name: "{name}", ' f'family: ProtocolFamily.{FAMILY_CS[fam]}, support: SupportLevel.{SUPPORT_CS[sup]}, ' f'formFactor: FormFactor.{FORM_CS[form_factor(name)]}, presets: {cs_presets},\n' - f' colors: {cs_colors_block}),' + f' colors: {cs_colors_block}, features: {csharp_features(feat)}),' ) swift = ["// Generated by scripts/generate-catalog.py from the JBL Portable app's model data.", @@ -197,10 +238,13 @@ def main(): doc = [ "# Supported models", "", "Generated by `scripts/generate-catalog.py`. Don't edit by hand.", "", - "| Model | PID | Support | EQ |", "|---|---|---|---|", + "| Model | PID | Support | EQ | Multi-speaker |", "|---|---|---|---|---|", ] - for _, name, pid, sup, fam in sorted(rows): - doc.append(f"| {name} | `{pid}` | {SUPPORT_LABEL[sup]} | {FAMILY_EQ[fam]} |") + for _, name, pid, sup, fam, feat in sorted(rows): + eq_label = FAMILY_EQ[fam] + if pid.lower() == "20dc": + eq_label = "Band levels + custom (AKM preset encoder pending)" + doc.append(f"| {name} | `{pid}` | {SUPPORT_LABEL[sup]} | {eq_label} | {MULTI_LABEL(feat)} |") doc += [ "", "- **Verified**: reads and EQ writes confirmed byte for byte on real hardware.", diff --git a/windows/JBLControlKit.Windows.Tests/AuracastTests.cs b/windows/JBLControlKit.Windows.Tests/AuracastTests.cs new file mode 100644 index 0000000..52f6e70 --- /dev/null +++ b/windows/JBLControlKit.Windows.Tests/AuracastTests.cs @@ -0,0 +1,133 @@ +using JBLControlKit.Windows; +using Xunit; +using static JBLControlKit.Windows.Tests.TestFixtures; + +namespace JBLControlKit.Windows.Tests; + +// Frames from JBL Portable 6.9.33 (com.harman.ble.jbllink), decompiled: +// SetLinkModeCommand, SetChannelCommand, SetChannelLockCommand, ReqAuracastGroupCommand, +// SetAuraCastGroupCommand and SetAuracastGroupNonLLSCommand. +public class AuracastTests +{ + [Fact] + public void LinkModeFramesMatchJblApp() + { + Assert.Equal(Bytes("AA 6A 01 02"), Frame.SetLinkMode(LinkMode.Auracast).Encoded); + Assert.Equal(Bytes("AA 6A 01 01"), Frame.SetLinkMode(LinkMode.PartyBoost).Encoded); + Assert.Equal(Bytes("AA 6A 01 00"), Frame.SetLinkMode(LinkMode.Off).Encoded); + Assert.Equal(Bytes("AA 17 00"), Frame.RequestLinkRole.Encoded); + } + + [Fact] + public void ChannelFramesMatchJblApp() + { + Assert.Equal(Bytes("AA 15 03 00 46 01"), Frame.SetAudioChannel(AudioChannel.Left).Encoded); + Assert.Equal(Bytes("AA 15 03 00 46 02"), Frame.SetAudioChannel(AudioChannel.Right).Encoded); + Assert.Equal(Bytes("AA 15 03 00 46 00"), Frame.SetAudioChannel(AudioChannel.Mono).Encoded); + Assert.Equal(Bytes("AA 15 03 00 49 01"), Frame.SetStereoLock(true).Encoded); + Assert.Equal(Bytes("AA 15 03 00 49 00"), Frame.SetStereoLock(false).Encoded); + } + + [Fact] + public void StereoInfoTokensParse() + { + Assert.Equal(new InfoToken.Channel(AudioChannel.Left), InfoToken.Parse(new byte[] { 0x00, 0x46, 0x01 })); + Assert.Equal(new InfoToken.Channel(AudioChannel.Right), InfoToken.Parse(new byte[] { 0x00, 0x46, 0x02 })); + Assert.Equal(new InfoToken.Channel(AudioChannel.Mono), InfoToken.Parse(new byte[] { 0x00, 0x46, 0x00 })); + Assert.Equal(new InfoToken.StereoLock(true), InfoToken.Parse(new byte[] { 0x00, 0x49, 0x01 })); + Assert.Equal(new InfoToken.AuracastSupport(true), InfoToken.Parse(new byte[] { 0x00, 0x4C, 0x01 })); + Assert.Equal(new InfoToken.LinkedDevices(2), InfoToken.Parse(new byte[] { 0x00, 0x45, 0x02 })); + } + + [Fact] + public void CompactStereoGroupWriteMatchesApp() + { + var create = Frame.SetAuracastGroup(new AuracastGroupRequest + { + Action = AuracastGroupAction.Create, + Type = AuracastGroupType.Stereo, + Channel = AudioChannel.Left, + GroupId = new byte[] { 0x1A, 0x2B, 0x3C, 0x4D }, + }); + Assert.Equal(Bytes("AA A0 0F 01 01 01 02 01 01 04 01 01 05 04 1A 2B 3C 4D"), create.Encoded); + + var destroy = Frame.SetAuracastGroup(new AuracastGroupRequest + { + Action = AuracastGroupAction.Destroy, + Type = AuracastGroupType.Stereo, + Channel = AudioChannel.Mono, + GroupId = new byte[] { 0x1A, 0x2B, 0x3C, 0x4D }, + }); + Assert.Equal(Bytes("AA A0 0F 01 01 02 02 01 01 04 01 00 05 04 1A 2B 3C 4D"), destroy.Encoded); + } + + [Fact] + public void LongLastingStereoGroupWriteMatchesApp() + { + var frame = Frame.SetAuracastGroup(new AuracastGroupRequest + { + Action = AuracastGroupAction.Create, + Type = AuracastGroupType.Stereo, + Role = DeviceRole.Master, + Channel = AudioChannel.Right, + GroupId = new byte[] { 0x01, 0x02, 0x03, 0x04 }, + Name = "Go 4", + PartnerAddress = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 }, + LongLasting = true, + }); + Assert.Equal(Bytes( + "AA A0 23 01 01 01 02 01 01 03 01 01 04 01 02 05 04 01 02 03 04 " + + "06 04 47 6F 20 34 07 06 01 02 03 04 05 06 08 01 14"), frame.Encoded); + } + + [Fact] + public void AuracastGroupReplyParses() + { + var group = AuracastGroup.Parse(Bytes( + "01 01 01 02 01 01 03 01 01 04 01 01 05 04 1A 2B 3C 4D 06 03 4B 69 74")); + Assert.Equal(AuracastGroupAction.Create, group.Action); + Assert.Equal(AuracastGroupType.Stereo, group.Type); + Assert.Equal(DeviceRole.Master, group.Role); + Assert.Equal(AudioChannel.Left, group.Channel); + Assert.Equal(new byte[] { 0x1A, 0x2B, 0x3C, 0x4D }, group.GroupId); + Assert.Equal("Kit", group.Name); + Assert.True(group.IsStereo); + Assert.Equal("1A2B3C4D", group.GroupIdHex); + } + + [Fact] + public void Protocol4AuracastAndChannelFrames() + { + Assert.Equal(Bytes("00 DD 02 00 01 00 05 00 04 20 01 00 01"), + P4Message.Set(new[] { (P4Party.AuracastMode, new byte[] { 0x01 }) }).Packets.Single()); + Assert.Equal(Bytes("00 DD 02 00 01 00 05 00 04 2C 01 00 02"), + P4Message.Set(new[] { (P4Party.Channel, new byte[] { (byte)AudioChannel.Right }) }).Packets.Single()); + } + + [Fact] + public void Go4AdvertisesAuracastAndStereoChannel() + { + var go4 = Catalog.Model(0x20E4)!; + Assert.Equal(SupportLevel.Verified, go4.Support); + Assert.True(go4.HasAuracast); + Assert.True(go4.HasStereoChannel); + Assert.False(go4.StereoIsAutomatic); + Assert.False(go4.WritesNeedOptIn); + + var duo = Catalog.Model(0x215C)!; + Assert.True(duo.HasAuracast); + Assert.True(duo.StereoIsAutomatic); + Assert.False(duo.HasStereoChannel); + Assert.True(duo.WritesNeedOptIn); + } + + [Fact] + public void SimpleEqSignatureFrameMatchesApp() + { + var charge5 = Catalog.Model(0x2040)!; + Assert.Equal(new[] { "Signature", "Custom" }, charge5.PickerPresets.Select(p => p.Name)); + var signature = charge5.PickerPresets[0]; + Assert.Equal(0x01, signature.Category); + Assert.Equal(Bytes("AA 6E 02 01 00"), new EQCodec(charge5).Select(signature, new float[] { 0, 0, 0 }).Single()); + } +} diff --git a/windows/JBLControlKit.Windows.Tests/CodecTests.cs b/windows/JBLControlKit.Windows.Tests/CodecTests.cs index d75ab95..2d547db 100644 --- a/windows/JBLControlKit.Windows.Tests/CodecTests.cs +++ b/windows/JBLControlKit.Windows.Tests/CodecTests.cs @@ -88,6 +88,40 @@ public void LegacyLevelsWriteLayout() Assert.Equal(Bytes("AA 97 00 0E C1 C1 06 05 01 01 02 FE 03 00 04 03 05 FA"), write); } + [Fact] + public void Go4PresetSelectSendsBiquadCoefficients() + { + // Captured on a real Go 4: JBL's DefaultPresetEQPayload frame for Signature, + // answered by AA 99 ... 06 ... (active = 06). + var go4 = Catalog.Model(0x210A)!; + var signature = go4.Presets.First(p => p.Category == 0x06); + var frame = new EQCodec(go4).Select(signature, Array.Empty()).Single(); + var expected = Bytes("AA 97 00 65 06 00 00 00 20 62 ED 6B C0 9F 77 95 1F 9F 12 94 3F 62 88 6A E0 " + + "00 00 00 20 8C 57 6F C4 F4 3C 14 1C 75 A8 90 3B 0D C3 EB E3 " + + "00 00 00 20 AC 9B 43 C9 0F B2 AA 18 55 64 BC 36 F2 4D 55 E7 " + + "00 00 00 20 B7 CC 1A E4 25 B4 D2 0D 4A 33 E5 1B DC 4B 2D F2 " + + "00 00 00 20 F1 86 D4 F4 FC 26 28 0B 10 79 2B 0B 05 D9 D7 F4"); + // Header and category are exact; a coefficient may drift by a few LSBs + // between platforms' tan/sqrt implementations, which the firmware accepts. + Assert.Equal(expected.Take(5), frame.Take(5)); + Assert.Equal(expected.Length, frame.Length); + for (int i = 5; i + 3 < expected.Length; i += 4) + { + int wanted = BitConverter.ToInt32(expected, i); + int actual = BitConverter.ToInt32(frame, i); + Assert.InRange(actual, wanted - 2048, wanted + 2048); + } + } + + [Fact] + public void Xtreme4PresetsAreNotImplementedYet() + { + var xtreme4 = Catalog.Model(0x20DC)!; + Assert.False(xtreme4.SupportsPresets); + Assert.Equal(new[] { "Custom" }, xtreme4.PickerPresets.Select(p => p.Name)); + Assert.Empty(new EQCodec(xtreme4).Select(xtreme4.Presets[0], Array.Empty())); + } + [Fact] public void LegacySimpleWriteAndReply() { diff --git a/windows/JBLControlKit.Windows/Auracast.cs b/windows/JBLControlKit.Windows/Auracast.cs new file mode 100644 index 0000000..90e6936 --- /dev/null +++ b/windows/JBLControlKit.Windows/Auracast.cs @@ -0,0 +1,245 @@ +namespace JBLControlKit.Windows; + +// Ported from Sources/JBLControlKit/Auracast.swift. +// Frames from JBL Portable 6.9.33 (SetLinkModeCommand, SetChannelCommand, +// SetChannelLockCommand, ReqAuracastGroupCommand, SetAuraCastGroupCommand, +// SetAuracastGroupNonLLSCommand). + +/// Which half of a stereo pair a unit plays (device-info token 0x46). +public enum AudioChannel : byte +{ + /// Not in a stereo pair: the unit plays the whole mix (JBL calls this NONE). + Mono = 0, + Left = 1, + Right = 2, +} + +public static class AudioChannelExtensions +{ + public static string Label(this AudioChannel channel) => channel switch + { + AudioChannel.Mono => "Mono", + AudioChannel.Left => "Left", + AudioChannel.Right => "Right", + _ => throw new ArgumentOutOfRangeException(nameof(channel)), + }; + + public static string? Badge(this AudioChannel channel) => channel switch + { + AudioChannel.Left => "L", + AudioChannel.Right => "R", + _ => null, + }; + + public static AudioChannel Swapped(this AudioChannel channel) => channel switch + { + AudioChannel.Left => AudioChannel.Right, + AudioChannel.Right => AudioChannel.Left, + _ => AudioChannel.Mono, + }; +} + +/// SetLinkMode value: what the speaker's radio is doing. +public enum LinkMode : byte +{ + Off = 0, + PartyBoost = 1, + Auracast = 2, +} + +public static class LinkModeExtensions +{ + public static string Label(this LinkMode mode) => mode switch + { + LinkMode.Off => "Off", + LinkMode.PartyBoost => "PartyBoost", + LinkMode.Auracast => "Auracast", + _ => throw new ArgumentOutOfRangeException(nameof(mode)), + }; +} + +/// Role reported by AA 6B / AA 16 and by the 03 TLV of a group reply. +public enum DeviceRole : byte +{ + Normal = 0, + Master = 1, + Slave = 2, + Standby = 3, + TwsMaster = 101, + TwsSlave = 102, +} + +public static class DeviceRoleExtensions +{ + public static string Label(this DeviceRole role) => role switch + { + DeviceRole.Normal => "Normal", + DeviceRole.Master => "Broadcasting", + DeviceRole.Slave => "Receiving", + DeviceRole.Standby => "Standby", + DeviceRole.TwsMaster => "TWS master", + DeviceRole.TwsSlave => "TWS slave", + _ => throw new ArgumentOutOfRangeException(nameof(role)), + }; +} + +public enum AuracastGroupAction : byte +{ + Create = 1, + Destroy = 2, + Prepare = 3, +} + +public enum AuracastGroupType : byte +{ + Stereo = 1, + Party = 2, +} + +public static class AuracastGroupTypeExtensions +{ + public static string Label(this AuracastGroupType type) => type switch + { + AuracastGroupType.Stereo => "Stereo", + AuracastGroupType.Party => "Party", + _ => throw new ArgumentOutOfRangeException(nameof(type)), + }; +} + +/// A create/destroy request for AA A0. +public sealed class AuracastGroupRequest +{ + public AuracastGroupAction Action { get; init; } = AuracastGroupAction.Create; + public AuracastGroupType Type { get; init; } = AuracastGroupType.Stereo; + public DeviceRole? Role { get; init; } + public AudioChannel Channel { get; init; } = AudioChannel.Mono; + public byte[]? GroupId { get; init; } + public string? Name { get; init; } + public byte[]? PartnerAddress { get; init; } + + /// Pick the longer form JBL's app sends to AirTouch / long-lasting-stereo models. + public bool LongLasting { get; init; } +} + +/// What the speaker reports for AA A1: token | length | value entries. +public sealed class AuracastGroup +{ + public AuracastGroupAction? Action { get; private set; } + public AuracastGroupType? Type { get; private set; } + public DeviceRole? Role { get; private set; } + public AudioChannel? Channel { get; private set; } + public byte[]? GroupId { get; private set; } + public string? Name { get; private set; } + public byte[]? PartnerAddress { get; private set; } + public byte? Extra { get; private set; } + public List Unknown { get; } = new(); + + public static AuracastGroup Parse(byte[] payload) + { + var group = new AuracastGroup(); + int offset = 0; + while (offset + 2 <= payload.Length) + { + byte token = payload[offset]; + int length = payload[offset + 1]; + if (offset + 2 + length > payload.Length) break; + byte[] value = payload[(offset + 2)..(offset + 2 + length)]; + switch (token) + { + case 0x01 when value.Length > 0: + group.Action = (AuracastGroupAction)value[0]; + break; + case 0x02 when value.Length > 0: + group.Type = (AuracastGroupType)value[0]; + break; + case 0x03 when value.Length > 0: + group.Role = (DeviceRole)value[0]; + break; + case 0x04 when value.Length > 0: + group.Channel = (AudioChannel)value[0]; + break; + case 0x05: + group.GroupId = value; + break; + case 0x06: + group.Name = System.Text.Encoding.UTF8.GetString(value); + break; + case 0x07: + group.PartnerAddress = value; + break; + case 0x08 when value.Length > 0: + group.Extra = value[0]; + break; + default: + group.Unknown.Add(new[] { token }.Concat(value).ToArray()); + break; + } + offset += 2 + length; + } + return group; + } + + public bool IsStereo => Type == AuracastGroupType.Stereo + && Channel is AudioChannel.Left or AudioChannel.Right; + + public bool IsParty => Type == AuracastGroupType.Party; + + public string? GroupIdHex => GroupId is null ? null : Convert.ToHexString(GroupId); +} + +public readonly partial struct Frame +{ + /// AA 6A 01 <mode>, answered by AA 6B 01 <role>. + public static Frame SetLinkMode(LinkMode mode) => new((byte)0x6A, new[] { (byte)mode }); + + /// AA 17 00 β€” role check, answered by AA 16 01 <role>. + public static Frame RequestLinkRole => new((byte)0x17); + + /// AA 15 03 <deviceIndex> 46 <channel>. + public static Frame SetAudioChannel(AudioChannel channel, byte deviceIndex = 0) => + new((byte)0x15, new[] { deviceIndex, (byte)0x46, (byte)channel }); + + /// AA 15 03 <deviceIndex> 49 <0|1>. + public static Frame SetStereoLock(bool locked, byte deviceIndex = 0) => + new((byte)0x15, new[] { deviceIndex, (byte)0x49, locked ? (byte)1 : (byte)0 }); + + /// AA A1 00 β€” ask for the current group; AA A2 answers. + public static Frame RequestAuracastGroup => new((byte)0xA1); + + /// AA A0 <length> <TLV…> β€” create or destroy a stereo/party group. + public static Frame SetAuracastGroup(AuracastGroupRequest request) + { + var payload = new List + { + 0x01, 0x01, (byte)request.Action, + 0x02, 0x01, (byte)request.Type, + }; + if (request.LongLasting && request.Role is { } role) + { + payload.AddRange(new byte[] { 0x03, 0x01, (byte)role }); + } + payload.AddRange(new byte[] { 0x04, 0x01, (byte)request.Channel }); + if (request.GroupId is { Length: 4 } id) + { + payload.AddRange(new byte[] { 0x05, 0x04 }); + payload.AddRange(id); + } + if (request.Name is { } name) + { + byte[] bytes = System.Text.Encoding.UTF8.GetBytes(name); + if (bytes.Length > 30) bytes = bytes[..30]; + payload.AddRange(new byte[] { 0x06, (byte)bytes.Length }); + payload.AddRange(bytes); + } + if (request.PartnerAddress is { Length: 6 } address) + { + payload.AddRange(new byte[] { 0x07, 0x06 }); + payload.AddRange(address); + } + if (request.LongLasting) + { + payload.AddRange(new byte[] { 0x08, 0x01, 0x14 }); + } + return new Frame((byte)0xA0, payload.ToArray()); + } +} diff --git a/windows/JBLControlKit.Windows/Catalog.Generated.cs b/windows/JBLControlKit.Windows/Catalog.Generated.cs index 7796079..5c4de78 100644 --- a/windows/JBLControlKit.Windows/Catalog.Generated.cs +++ b/windows/JBLControlKit.Windows/Catalog.Generated.cs @@ -6,181 +6,107 @@ namespace JBLControlKit.Windows; public static class GeneratedCatalog { public static readonly EQPreset[] charge6_preset_eq = { - new EQPreset(category: 0x06, name: "Signature", bands: [new EQBand(FilterType.LowShelf, 125.0f, 0.0f, q: 0.707f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 4000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.HighShelf, 8000.0f, 0.0f, q: 0.707f)]), new EQPreset(category: 0x22, name: "Chill", bands: [new EQBand(FilterType.LowShelf, 200.0f, -4.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1500.0f, -3.0f, q: 1.0f), new EQBand(FilterType.LowPass, 10000.0f, 0.0f, q: 0.7f), new EQBand(FilterType.HighShelf, 6000.0f, -3.0f, q: 0.5f)]), new EQPreset(category: 0x08, name: "Energetic", bands: [new EQBand(FilterType.LowShelf, 60.0f, -2.0f, q: 0.707f), new EQBand(FilterType.Peaking, 200.0f, 7.0f, q: 1.5f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1500.0f, 3.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 7000.0f, 2.0f, q: 2.0f), new EQBand(FilterType.HighShelf, 8000.0f, 0.0f, q: 0.707f)]), - new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.Peaking, 4000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.LowPass, 9000.0f, 0.0f, q: 0.7f)]), }; + new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.Peaking, 4000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.LowPass, 9000.0f, 0.0f, q: 0.7f)]), + }; public static readonly EQPreset[] flip7_preset_eq = { - new EQPreset(category: 0x06, name: "Signature", bands: [new EQBand(FilterType.LowShelf, 125.0f, 0.0f, q: 0.707f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 4000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.HighShelf, 8000.0f, 0.0f, q: 0.707f)]), new EQPreset(category: 0x22, name: "Chill", bands: [new EQBand(FilterType.LowShelf, 200.0f, -4.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1500.0f, -3.0f, q: 1.0f), new EQBand(FilterType.LowPass, 10000.0f, 0.0f, q: 0.7f), new EQBand(FilterType.HighShelf, 6000.0f, -3.0f, q: 0.5f)]), new EQPreset(category: 0x08, name: "Energetic", bands: [new EQBand(FilterType.LowShelf, 60.0f, -2.0f, q: 0.707f), new EQBand(FilterType.Peaking, 200.0f, 7.0f, q: 1.5f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1500.0f, 3.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 7000.0f, 2.0f, q: 2.0f), new EQBand(FilterType.HighShelf, 8000.0f, 0.0f, q: 0.707f)]), - new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.Peaking, 4000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.LowPass, 9000.0f, 0.0f, q: 0.7f)]), }; + new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.Peaking, 4000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.LowPass, 9000.0f, 0.0f, q: 0.7f)]), + }; public static readonly EQPreset[] tuner3_preset_eq = { - new EQPreset(category: 0x06, name: "Signature", bands: [new EQBand(FilterType.LowShelf, 125.0f, 0.0f, q: 0.707f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 4000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.HighShelf, 8000.0f, 0.0f, q: 0.707f)]), new EQPreset(category: 0x22, name: "Chill", bands: [new EQBand(FilterType.LowShelf, 200.0f, -4.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1500.0f, -3.0f, q: 1.0f), new EQBand(FilterType.LowPass, 10000.0f, 0.0f, q: 0.7f), new EQBand(FilterType.HighShelf, 6000.0f, -3.0f, q: 0.5f)]), new EQPreset(category: 0x08, name: "Energetic", bands: [new EQBand(FilterType.LowShelf, 60.0f, -2.0f, q: 0.707f), new EQBand(FilterType.Peaking, 200.0f, 7.0f, q: 1.5f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1500.0f, 3.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 7000.0f, 2.0f, q: 2.0f), new EQBand(FilterType.HighShelf, 8000.0f, 0.0f, q: 0.707f)]), - new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.Peaking, 4000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.LowPass, 9000.0f, 0.0f, q: 0.7f)]), }; + new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 250.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 500.0f, 0.0f, q: 2.0f), new EQBand(FilterType.Peaking, 1000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.Peaking, 4000.0f, 4.0f, q: 1.0f), new EQBand(FilterType.LowPass, 9000.0f, 0.0f, q: 0.7f)]), + }; public static readonly EQPreset[] xtreme4_preset_eq = { - new EQPreset(category: 0x06, name: "Signature", bands: [new EQBand(FilterType.Peaking, 100.0f, 0.0f, q: 1.0f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 1.0f), new EQBand(FilterType.Peaking, 2000.0f, 0.0f, q: 1.0f), new EQBand(FilterType.Peaking, 7000.0f, 0.0f, q: 1.0f), new EQBand(FilterType.Peaking, 10000.0f, 0.0f, q: 1.0f)]), new EQPreset(category: 0x22, name: "Chill", bands: [new EQBand(FilterType.LowShelf, 100.0f, -3.0f, q: 0.5f), new EQBand(FilterType.Peaking, 1000.0f, 0.0f, q: 1.0f), new EQBand(FilterType.Peaking, 1500.0f, -2.0f, q: 1.0f), new EQBand(FilterType.HighShelf, 6000.0f, -3.0f, q: 0.5f), new EQBand(FilterType.LowPass, 12000.0f, 0.0f, q: 0.7f)]), new EQPreset(category: 0x08, name: "Energetic", bands: [new EQBand(FilterType.LowShelf, 80.0f, -3.0f, q: 0.7f), new EQBand(FilterType.Peaking, 200.0f, 4.0f, q: 2.0f), new EQBand(FilterType.Peaking, 2000.0f, 3.0f, q: 1.0f), new EQBand(FilterType.HighShelf, 7000.0f, 3.0f, q: 0.7f), new EQBand(FilterType.Peaking, 10000.0f, 0.0f, q: 1.0f)]), - new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 1000.0f, 5.0f, q: 1.0f), new EQBand(FilterType.Peaking, 4000.0f, 5.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.LowPass, 12000.0f, 0.0f, q: 0.7f)]), }; + new EQPreset(category: 0x03, name: "Vocal", bands: [new EQBand(FilterType.LowShelf, 80.0f, -5.0f, q: 0.5f), new EQBand(FilterType.Peaking, 1000.0f, 5.0f, q: 1.0f), new EQBand(FilterType.Peaking, 4000.0f, 5.0f, q: 1.0f), new EQBand(FilterType.Peaking, 9000.0f, -2.0f, q: 0.7f), new EQBand(FilterType.LowPass, 12000.0f, 0.0f, q: 0.7f)]), + }; public static readonly SpeakerModel[] Models = { - new SpeakerModel(productId: 0x208C, name: "JBL Charge 5 Wi-Fi", family: ProtocolFamily.InfoOnly, support: SupportLevel.Unsupported, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xF593CA, 0x26A4BD) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xF593CA, 0x26A4BD) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x2075, name: "JBL Boombox 3 Wi-Fi", family: ProtocolFamily.InfoOnly, support: SupportLevel.Unsupported, formFactor: FormFactor.Boombox, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xF593CA, 0x26A4BD) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xF593CA, 0x26A4BD) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x2050, name: "JBL Pulse 5", family: ProtocolFamily.LegacySimple, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x01] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x02] = new SpeakerColor("White", 0xF593CA, 0x26A4BD) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x01] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x02] = new SpeakerColor("White", 0xF593CA, 0x26A4BD) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x206D, name: "JBL Boombox 3", family: ProtocolFamily.LegacySimple, support: SupportLevel.Experimental, formFactor: FormFactor.Boombox, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x214E, name: "JBL Boombox 4", family: ProtocolFamily.Protocol4Parametric, support: SupportLevel.Experimental, formFactor: FormFactor.Boombox, presets: flip7_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x05] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x14] = new SpeakerColor("Brown", 0xE1D2B7, 0x956200), [0x1A] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x1F] = new SpeakerColor("Orange", 0xE1D2B7, 0x956200) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x05] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x14] = new SpeakerColor("Brown", 0xE1D2B7, 0x956200), [0x1A] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x1F] = new SpeakerColor("Orange", 0xE1D2B7, 0x956200) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x2132, name: "JBL Grip", family: ProtocolFamily.Protocol4Quantized, support: SupportLevel.Experimental, formFactor: FormFactor.Compact, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x03] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x04] = new SpeakerColor("Green", 0xBAC0AD, 0x3A412C), [0x05] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x18] = new SpeakerColor("Yellow", 0xFFD675, 0xF0EADD), [0x19] = new SpeakerColor("Rose", 0xE07784, 0xF3DEE5), [0x1A] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x1B] = new SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E), [0x1C] = new SpeakerColor("Peachorange", 0xFE6E2C, 0xF9D3C1) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x03] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x04] = new SpeakerColor("Green", 0xBAC0AD, 0x3A412C), [0x05] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x18] = new SpeakerColor("Yellow", 0xFFD675, 0xF0EADD), [0x19] = new SpeakerColor("Rose", 0xE07784, 0xF3DEE5), [0x1A] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x1B] = new SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E), [0x1C] = new SpeakerColor("Peachorange", 0xFE6E2C, 0xF9D3C1) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x2168, name: "JBL Go 5", family: ProtocolFamily.Protocol4Quantized, support: SupportLevel.Experimental, formFactor: FormFactor.Compact, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xB1B1B1, 0x434343), [0x03] = new SpeakerColor("Red", 0xB1B1B1, 0x434343), [0x05] = new SpeakerColor("Purple", 0xB1B1B1, 0x434343), [0x18] = new SpeakerColor("Yellow", 0xB1B1B1, 0x434343), [0x19] = new SpeakerColor("Rose", 0xB1B1B1, 0x434343), [0x1A] = new SpeakerColor("Squad", 0xB1B1B1, 0x434343), [0x1B] = new SpeakerColor("Turquoise", 0xB1B1B1, 0x434343), [0x1C] = new SpeakerColor("Peachorange", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xB1B1B1, 0x434343), [0x03] = new SpeakerColor("Red", 0xB1B1B1, 0x434343), [0x05] = new SpeakerColor("Purple", 0xB1B1B1, 0x434343), [0x18] = new SpeakerColor("Yellow", 0xB1B1B1, 0x434343), [0x19] = new SpeakerColor("Rose", 0xB1B1B1, 0x434343), [0x1A] = new SpeakerColor("Squad", 0xB1B1B1, 0x434343), [0x1B] = new SpeakerColor("Turquoise", 0xB1B1B1, 0x434343), [0x1C] = new SpeakerColor("Peachorange", 0xB1B1B1, 0x434343) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x2169, name: "JBL Xtreme 5", family: ProtocolFamily.Protocol4Parametric, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: flip7_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xB1B1B1, 0x434343), [0x1A] = new SpeakerColor("Squad", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Blue", 0xB1B1B1, 0x434343), [0x1A] = new SpeakerColor("Squad", 0xB1B1B1, 0x434343) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x204F, name: "JBL Flip 6", family: ProtocolFamily.LegacySimple, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x05] = new SpeakerColor("Green", 0xC0C4B7, 0x3A412C), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x09] = new SpeakerColor("Teal", 0xAEE6DB, 0x28605E), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Martin Garrix", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x05] = new SpeakerColor("Green", 0xC0C4B7, 0x3A412C), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x09] = new SpeakerColor("Teal", 0xAEE6DB, 0x28605E), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Martin Garrix", 0xB1B1B1, 0x434343) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x2040, name: "JBL Charge 5", family: ProtocolFamily.LegacySimple, support: SupportLevel.Verified, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x05] = new SpeakerColor("Green", 0xC0C4B7, 0x3A412C), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x09] = new SpeakerColor("Teal", 0xAEE6DB, 0x28605E), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x12] = new SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), [0x13] = new SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x05] = new SpeakerColor("Green", 0xC0C4B7, 0x3A412C), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x09] = new SpeakerColor("Teal", 0xAEE6DB, 0x28605E), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x12] = new SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), [0x13] = new SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x202F, name: "JBL Xtreme 3", family: ProtocolFamily.LegacySimple, support: SupportLevel.Beta, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F53, name: "JBL Boombox 2", family: ProtocolFamily.LegacySimple, support: SupportLevel.Experimental, formFactor: FormFactor.Boombox, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F56, name: "JBL Pulse 4", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x01] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x02] = new SpeakerColor("White", 0xFF8064, 0xCCFFDC7E) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x01] = new SpeakerColor("Black", 0xFF8064, 0xCCFFDC7E), [0x02] = new SpeakerColor("White", 0xFF8064, 0xCCFFDC7E) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F31, name: "JBL Flip 5", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x05] = new SpeakerColor("Green", 0xC0C4B7, 0x3A412C), [0x06] = new SpeakerColor("Mustard Yellow", 0xE1D2B7, 0x956200), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Sand", 0xE1D2B7, 0x956200), [0x09] = new SpeakerColor("Teal", 0xAEE6DB, 0x28605E), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x11] = new SpeakerColor("Blackstar", 0xBFBFBF, 0x402E22), [0x12] = new SpeakerColor("Tomorrowland", 0xE1D2B7, 0x956200), [0x13] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Ecoblu", 0xADCBD8, 0x1A1F50), [0x15] = new SpeakerColor("Ecogrn", 0xAEE6DB, 0x28605E), [0x16] = new SpeakerColor("White Camouflage", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x05] = new SpeakerColor("Green", 0xC0C4B7, 0x3A412C), [0x06] = new SpeakerColor("Mustard Yellow", 0xE1D2B7, 0x956200), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Sand", 0xE1D2B7, 0x956200), [0x09] = new SpeakerColor("Teal", 0xAEE6DB, 0x28605E), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x11] = new SpeakerColor("Blackstar", 0xBFBFBF, 0x402E22), [0x12] = new SpeakerColor("Tomorrowland", 0xE1D2B7, 0x956200), [0x13] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Ecoblu", 0xADCBD8, 0x1A1F50), [0x15] = new SpeakerColor("Ecogrn", 0xAEE6DB, 0x28605E), [0x16] = new SpeakerColor("White Camouflage", 0xB1B1B1, 0x434343) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F17, name: "JBL Charge 4", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x05] = new SpeakerColor("Green", 0xBAC0AD, 0x3A412C), [0x06] = new SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x09] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x11] = new SpeakerColor("Squad", 0x8C8C8C, 0x313131), [0x12] = new SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), [0x13] = new SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x05] = new SpeakerColor("Green", 0xBAC0AD, 0x3A412C), [0x06] = new SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x09] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x11] = new SpeakerColor("Squad", 0x8C8C8C, 0x313131), [0x12] = new SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), [0x13] = new SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F29, name: "JBL Charge 4", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x05] = new SpeakerColor("Green", 0xBAC0AD, 0x3A412C), [0x06] = new SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x09] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x11] = new SpeakerColor("Squad", 0x8C8C8C, 0x313131), [0x12] = new SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), [0x13] = new SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x05] = new SpeakerColor("Green", 0xBAC0AD, 0x3A412C), [0x06] = new SpeakerColor("Mustard Yellow", 0xDAC39C, 0x956200), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x09] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x11] = new SpeakerColor("Squad", 0x8C8C8C, 0x313131), [0x12] = new SpeakerColor("Magenta", 0xFFB1E3, 0x770A5D), [0x13] = new SpeakerColor("Black Camouflage", 0x7D9B73, 0x553832) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1ED2, name: "JBL Pulse 3", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xFF98B7, 0x0064AC), [0x01] = new SpeakerColor("Black", 0xFF98B7, 0x0064AC), [0x02] = new SpeakerColor("White", 0xFF98B7, 0x0064AC) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xFF98B7, 0x0064AC), [0x01] = new SpeakerColor("Black", 0xFF98B7, 0x0064AC), [0x02] = new SpeakerColor("White", 0xFF98B7, 0x0064AC) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1EE7, name: "JBL Boombox", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Boombox, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), [0x08] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), [0x08] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F27, name: "JBL Boombox", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Boombox, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), [0x08] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Forest Green", 0xBAC0AD, 0x3A412C), [0x08] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1EFC, name: "JBL Xtreme 2", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("Teal", 0xBEC3BC, 0x454932), [0x08] = new SpeakerColor("Squad", 0x7D9B73, 0x553832) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("Teal", 0xBEC3BC, 0x454932), [0x08] = new SpeakerColor("Squad", 0x7D9B73, 0x553832) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1F26, name: "JBL Xtreme 2", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("Teal", 0xBEC3BC, 0x454932), [0x08] = new SpeakerColor("Squad", 0x7D9B73, 0x553832) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x9EBECC, 0x32404B), [0x04] = new SpeakerColor("Teal", 0xBEC3BC, 0x454932), [0x08] = new SpeakerColor("Squad", 0x7D9B73, 0x553832) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x2038, name: "JBL Xtreme 2", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x12] = new SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x12] = new SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1ED1, name: "JBL Flip 4", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), [0x04] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x05] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x06] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x07] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), [0x08] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x09] = new SpeakerColor("Zap", 0xDAC39C, 0x1225BA), [0x0A] = new SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), [0x0B] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), [0x10] = new SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), [0x11] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), [0x12] = new SpeakerColor("Oceanblue", 0x9EBECC, 0x32404B) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), [0x04] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x05] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x06] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x07] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), [0x08] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x09] = new SpeakerColor("Zap", 0xDAC39C, 0x1225BA), [0x0A] = new SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), [0x0B] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), [0x10] = new SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), [0x11] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), [0x12] = new SpeakerColor("Oceanblue", 0x9EBECC, 0x32404B) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x1EBC, name: "JBL Charge 3", family: ProtocolFamily.InfoOnly, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x04] = new SpeakerColor("Blue", 0x8FA9DB, 0x1A1F50), [0x05] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x06] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), [0x07] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x08] = new SpeakerColor("Zap", 0xDAC39C, 0x1225BA), [0x09] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x04] = new SpeakerColor("Blue", 0x8FA9DB, 0x1A1F50), [0x05] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x06] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D), [0x07] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x08] = new SpeakerColor("Zap", 0xDAC39C, 0x1225BA), [0x09] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x0024, name: "JBL Xtreme", family: ProtocolFamily.InfoOnly, support: SupportLevel.Unsupported, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), [0x04] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x05] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), [0x04] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x05] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x0023, name: "JBL Flip 3", family: ProtocolFamily.InfoOnly, support: SupportLevel.Unsupported, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Orange", 0xF79D87, 0xB63125), [0x04] = new SpeakerColor("Pink", 0xF4C1D5, 0xA91950), [0x05] = new SpeakerColor("Gray", 0xB1B1B1, 0x434343), [0x06] = new SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), [0x07] = new SpeakerColor("Yellow", 0xDAC39C, 0x956200), [0x08] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x09] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), [0x10] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x11] = new SpeakerColor("Zap", 0xDAC39C, 0x1225BA), [0x12] = new SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), [0x13] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xFFAFA7, 0x772921), [0x03] = new SpeakerColor("Orange", 0xF79D87, 0xB63125), [0x04] = new SpeakerColor("Pink", 0xF4C1D5, 0xA91950), [0x05] = new SpeakerColor("Gray", 0xB1B1B1, 0x434343), [0x06] = new SpeakerColor("Blue", 0x8FA9D8, 0x1A1F50), [0x07] = new SpeakerColor("Yellow", 0xDAC39C, 0x956200), [0x08] = new SpeakerColor("Teal", 0xAAE2D8, 0x326C6B), [0x09] = new SpeakerColor("Malta", 0xFFAFA7, 0x1225BA), [0x10] = new SpeakerColor("Squad", 0xBEC3BC, 0x454932), [0x11] = new SpeakerColor("Zap", 0xDAC39C, 0x1225BA), [0x12] = new SpeakerColor("Trio", 0xB1B1B1, 0x326C6B), [0x13] = new SpeakerColor("Mosaic", 0xAAE2D8, 0x32809D) }, features: new ModelFeatures()), new SpeakerModel(productId: 0x20DC, name: "JBL Xtreme 4", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Cylinder, presets: xtreme4_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x12] = new SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), [0x13] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) - }), - new SpeakerModel(productId: 0x20E4, name: "JBL Go 4", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x16] = new SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E) - }), - new SpeakerModel(productId: 0x210A, name: "JBL Go 4", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x16] = new SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x07] = new SpeakerColor("Grey", 0xB1B1B1, 0x434343), [0x12] = new SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), [0x13] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C) }, features: new ModelFeatures(auracast: true, longLastingStereo: true, newStereoFlow: true)), + new SpeakerModel(productId: 0x20E4, name: "JBL Go 4", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Verified, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x16] = new SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E) }, features: new ModelFeatures(auracast: true, partyBoost: true)), + new SpeakerModel(productId: 0x210A, name: "JBL Go 4", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Verified, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x16] = new SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E) }, features: new ModelFeatures(auracast: true, partyBoost: true, longLastingStereo: true, newStereoFlow: true)), new SpeakerModel(productId: 0x215C, name: "JBL Go 4 Duo (L)", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343) }, features: new ModelFeatures(auracast: true, partyBoost: true, airTouchStereo: true)), new SpeakerModel(productId: 0x2181, name: "JBL Go 4 Duo (R)", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343) }, features: new ModelFeatures(auracast: true, partyBoost: true, airTouchStereo: true)), new SpeakerModel(productId: 0x20F5, name: "JBL Clip 5", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Compact, presets: xtreme4_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x16] = new SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xB1B1B1, 0x434343), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x13] = new SpeakerColor("Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x16] = new SpeakerColor("Wembledongrn Green", 0xD0C8C1, 0x28605E) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x20E3, name: "JBL Charge 6", family: ProtocolFamily.LegacyParametric, support: SupportLevel.Verified, formFactor: FormFactor.Cylinder, presets: charge6_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x16] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x17] = new SpeakerColor("Black And Orange", 0xB1B1B1, 0x434343), [0x18] = new SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x16] = new SpeakerColor("Squad", 0xC0C4B7, 0x3A412C), [0x17] = new SpeakerColor("Black And Orange", 0xB1B1B1, 0x434343), [0x18] = new SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E) }, features: new ModelFeatures(auracast: true, partyBoost: true, newStereoFlow: true)), new SpeakerModel(productId: 0x2107, name: "JBL Flip 7", family: ProtocolFamily.LegacyParametric, support: SupportLevel.Verified, formFactor: FormFactor.Cylinder, presets: flip7_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x12] = new SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), [0x13] = new SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x18] = new SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x02] = new SpeakerColor("Red", 0xE1D1D6, 0x8D5260), [0x03] = new SpeakerColor("Blue", 0xADCBD8, 0x1A1F50), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA), [0x08] = new SpeakerColor("Sand", 0xC5BBAD, 0x735B39), [0x10] = new SpeakerColor("Pink", 0xE1D1D6, 0x8D5260), [0x12] = new SpeakerColor("Tomorrowland", 0xB1B1B1, 0x434343), [0x13] = new SpeakerColor("Black Camouflage", 0xC0C4B7, 0x3A412C), [0x14] = new SpeakerColor("Purple", 0xC6B7D9, 0x5A3A8C), [0x15] = new SpeakerColor("Funcky Black", 0xB1B1B1, 0x434343), [0x18] = new SpeakerColor("Turquoise", 0xAEE6DB, 0x28605E) }, features: new ModelFeatures(auracast: true, partyBoost: true, newStereoFlow: true)), new SpeakerModel(productId: 0x214C, name: "JBL Tuner 3", family: ProtocolFamily.LegacyLevels, support: SupportLevel.Beta, formFactor: FormFactor.Compact, presets: tuner3_preset_eq, - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x04] = new SpeakerColor("White", 0xE0E0E0, 0xAAACAA) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x218A, name: "JBL Charge Essential 3 SE", family: ProtocolFamily.Protocol4Quantized, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x26] = new SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), [0x27] = new SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343) - }), + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x26] = new SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), [0x27] = new SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343) }, features: new ModelFeatures(auracast: true, partyBoost: true)), new SpeakerModel(productId: 0x2185, name: "JBL Flip Essential 3 SE", family: ProtocolFamily.Protocol4Quantized, support: SupportLevel.Experimental, formFactor: FormFactor.Cylinder, presets: Array.Empty(), - colors: new Dictionary { - [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x26] = new SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), [0x27] = new SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343) - }), }; + colors: new Dictionary { [0x00] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x01] = new SpeakerColor("Black", 0xB1B1B1, 0x434343), [0x26] = new SpeakerColor("Gun Metal", 0xB1B1B1, 0x434343), [0x27] = new SpeakerColor("Gun Metal Alt", 0xB1B1B1, 0x434343) }, features: new ModelFeatures(auracast: true, partyBoost: true)), + }; } diff --git a/windows/JBLControlKit.Windows/EQCodec.cs b/windows/JBLControlKit.Windows/EQCodec.cs index 00d029b..a5c56ab 100644 --- a/windows/JBLControlKit.Windows/EQCodec.cs +++ b/windows/JBLControlKit.Windows/EQCodec.cs @@ -61,12 +61,21 @@ public List Select(EQPreset preset, float[] customGains) case ProtocolFamily.LegacyParametric: return new List { Frame.SetEq(preset.Category, preset.Bands).Encoded }; case ProtocolFamily.LegacyLevels: - return new List { LevelsFrame(preset.Category, customGains).Encoded }; + // Presets are biquad coefficients, not level values: the firmware + // ignores an AA 97 whose active byte is a preset but whose body is + // the level form (confirmed on a Go 4). + if (!Model.SupportsPresets || preset.Bands.Length == 0) return new List(); + return new List { new Frame(0x97, PresetEQ.Payload(preset.Category, preset.Bands)).Encoded }; case ProtocolFamily.Protocol4Parametric: if (!P4EQ.CategoryMap.TryGetValue(preset.Category, out byte mapped) || preset.Bands.Length != 7) return new List(); return P4Message.Set(new[] { (P4EQ.Parametric, P4EQ.ParametricValue(mapped, preset.Bands)) }).Packets; - default: // legacySimple, protocol4Quantized, infoOnly + case ProtocolFamily.LegacySimple: + // AA 6E 02 01 00: select JBL Signature and send no band values. + return preset.Category == 0x01 + ? new List { new Frame(0x6E, new byte[] { 0x01, 0x00 }).Encoded } + : new List(); + default: // protocol4Quantized, infoOnly return new List(); } } diff --git a/windows/JBLControlKit.Windows/JBLProtocol.cs b/windows/JBLControlKit.Windows/JBLProtocol.cs index c9c59ba..2790df3 100644 --- a/windows/JBLControlKit.Windows/JBLProtocol.cs +++ b/windows/JBLControlKit.Windows/JBLProtocol.cs @@ -36,10 +36,22 @@ public enum Command : byte Info = 0x12, RequestVersion = 0x41, Version = 0x42, + /// AA 15 β€” set one device-info token (channel, stereo lock, …). + SetDeviceInfo = 0x15, + /// AA 17 β€” role check, answered by AA 16. + RequestLinkRole = 0x17, + LinkRole = 0x16, NotifyEqChange = 0x64, + /// AA 6A / AA 6B β€” PartyBoost / Auracast link mode and the role it produces. + SetLinkMode = 0x6A, + LinkMode = 0x6B, SetAdvancedEq = 0x97, RequestAdvancedEq = 0x98, AdvancedEq = 0x99, + /// AA A0 / AA A1 / AA A2 β€” Auracast stereo/party group. + SetAuracastGroup = 0xA0, + RequestAuracastGroup = 0xA1, + AuracastGroup = 0xA2, Unsupported = 0xEE, } @@ -156,10 +168,20 @@ public sealed record Color(byte Value) : InfoToken; /// Percentage in the low 7 bits; the high bit is set while charging (Flip 7: 0x8A = charging, 10%). public sealed record Battery(int Level, bool Charging) : InfoToken; - public sealed record AudioChannel(byte Value) : InfoToken; + /// Token 46: this unit's half of a stereo pair. + public sealed record Channel(AudioChannel Value) : InfoToken; public sealed record AudioSourceConnected(bool Value) : InfoToken; + /// Token 49: the stereo half is locked so it survives a power cycle. + public sealed record StereoLock(bool Value) : InfoToken; + + /// Token 4C: the model reports Auracast support. + public sealed record AuracastSupport(bool Value) : InfoToken; + + /// Token 45: how many units the speaker believes are linked. + public sealed record LinkedDevices(int Count) : InfoToken; + public sealed record Firmware(string Value) : InfoToken; public sealed record Other(byte Token, byte[] Value) : InfoToken @@ -197,8 +219,12 @@ public override int GetHashCode() (0x42, >= 2) => new ProductId((ushort)((value[0] << 8) | value[1])), (0x43, >= 1) => new Color(value[0]), (0x44, >= 1) => new Battery(value[0] & 0x7F, (value[0] & 0x80) != 0), - (0x46, >= 1) => new AudioChannel(value[0]), + (0x45, >= 1) => new LinkedDevices(value[0]), + (0x46, >= 1) when value[0] <= 2 => new Channel((AudioChannel)value[0]), + (0x46, >= 1) => new Other(token, value), (0x47, >= 1) => new AudioSourceConnected(value[0] != 0), + (0x49, >= 1) => new StereoLock(value[0] != 0), + (0x4C, >= 1) => new AuracastSupport(value[0] != 0), (0x4D, >= 1) => new Firmware(FirmwareVersion.Format(value)), _ => new Other(token, value), }; @@ -207,6 +233,16 @@ public override int GetHashCode() public static class FirmwareVersion { - /// 00 07 02 00 β†’ "0.7.2.0" - public static string Format(byte[] bytes) => string.Join(".", bytes); + /// + /// 00 07 02 00 β†’ "0.7.2.0", and the ASCII form the Go 4 sends, + /// 30 36 34 30 ("0640") β†’ "0.6.4.0". + /// + public static string Format(byte[] bytes) + { + if (bytes.Length > 0 && bytes.All(b => b is >= 0x30 and <= 0x39)) + { + return string.Join(".", bytes.Select(b => ((char)b).ToString())); + } + return string.Join(".", bytes); + } } diff --git a/windows/JBLControlKit.Windows/Models.cs b/windows/JBLControlKit.Windows/Models.cs index 99816f7..5791900 100644 --- a/windows/JBLControlKit.Windows/Models.cs +++ b/windows/JBLControlKit.Windows/Models.cs @@ -162,6 +162,35 @@ public float Snap(float value) } } +/// The multi-speaker capabilities the JBL app's model table declares. +public sealed class ModelFeatures +{ + /// AURACAST_SUPPORT: the unit can join or start an Auracast broadcast. + public bool Auracast { get; } + + /// NON_PARTY_BOOST_SUPPORT / PARTYBOOST_BUTTON_SUPPORT: the older PartyBoost link. + public bool PartyBoost { get; } + + /// LONG_LASTING_STEREO: the pair survives a power cycle. + public bool LongLastingStereo { get; } + + /// AIR_TOUCH_STEREO: the Duo picks its own halves when bumped together. + public bool AirTouchStereo { get; } + + /// The models JBL's app drives with its newer stereo flow. + public bool NewStereoFlow { get; } + + public ModelFeatures(bool auracast = false, bool partyBoost = false, bool longLastingStereo = false, + bool airTouchStereo = false, bool newStereoFlow = false) + { + Auracast = auracast; + PartyBoost = partyBoost; + LongLastingStereo = longLastingStereo; + AirTouchStereo = airTouchStereo; + NewStereoFlow = newStereoFlow; + } +} + public sealed class SpeakerModel { public ushort ProductId { get; } @@ -171,10 +200,11 @@ public sealed class SpeakerModel public FormFactor FormFactor { get; } public EQPreset[] Presets { get; } public Dictionary Colors { get; } + public ModelFeatures Features { get; } public ushort Id => ProductId; public SpeakerModel(ushort productId, string name, ProtocolFamily family, SupportLevel support, - FormFactor formFactor, EQPreset[] presets, Dictionary colors) + FormFactor formFactor, EQPreset[] presets, Dictionary colors, ModelFeatures? features = null) { ProductId = productId; Name = name; @@ -183,6 +213,7 @@ public SpeakerModel(ushort productId, string name, ProtocolFamily family, Suppor FormFactor = formFactor; Presets = presets; Colors = colors; + Features = features ?? new ModelFeatures(); } public SpeakerColor Color(byte? code) @@ -198,18 +229,44 @@ public SpeakerColor Color(byte? code) public byte CustomCategory => Family == ProtocolFamily.LegacyParametric ? (byte)0xC2 : (byte)0xC1; /// Presets the picker offers: the model's own, then Custom. + /// + /// A 3-band (simple EQ) model has no preset table in the JBL app, but its + /// firmware still carries JBL Signature as category 01; selecting it is + /// AA 6E 02 01 00, the same frame the app sends. public List PickerPresets { get { if (!HasEq) return new List(); - var list = new List(Presets) { new(CustomCategory, "Custom", Array.Empty()) }; + var custom = new EQPreset(CustomCategory, "Custom", Array.Empty()); + if (!SupportsPresets) return new List { custom }; + var list = new List(Presets); + if (Family == ProtocolFamily.LegacySimple && !list.Exists(p => p.Category == 0x01)) + { + list.Insert(0, new EQPreset(0x01, "Signature", Array.Empty())); + } + list.Add(custom); return list; } } public bool HasEq => Family != ProtocolFamily.InfoOnly && Support != SupportLevel.Unsupported; + /// + /// Whether JBL's preset payload for this model is implemented. + /// Xtreme 4 uses a different (AKM) coefficient encoder that isn't ported yet. + /// + public bool SupportsPresets => !(Family == ProtocolFamily.LegacyLevels && ProductId == 0x20DC); + + /// The unit can join or start an Auracast broadcast. + public bool HasAuracast => Features.Auracast; + + /// Left/right can be chosen over the control channel (not on AirTouch models). + public bool HasStereoChannel => Features.Auracast && !Features.AirTouchStereo; + + /// The two halves are chosen by AirTouch, not by an AA 15 write. + public bool StereoIsAutomatic => Features.AirTouchStereo; + /// Writes are allowed without opting in only where they have been confirmed on hardware. public bool WritesNeedOptIn => Support != SupportLevel.Verified; diff --git a/windows/JBLControlKit.Windows/PresetEQ.cs b/windows/JBLControlKit.Windows/PresetEQ.cs new file mode 100644 index 0000000..be3e2f2 --- /dev/null +++ b/windows/JBLControlKit.Windows/PresetEQ.cs @@ -0,0 +1,115 @@ +namespace JBLControlKit.Windows; + +// Ported from Sources/JBLControlKit/PresetEQ.swift. +// JBL's DefaultPresetEQPayload: five fixed-point biquad coefficients per preset band. + +/// JBL's preset encoder for the five-band "advanced level" models (Go 4, Clip 5, Tuner 3). +public static class PresetEQ +{ + private const double Scale = 536_870_912.0; + private static readonly double Pi = (double)MathF.PI; + + /// Five coefficients, in JBL's order: b0, b1, b2, -a1, -a2. + public static int[] Coefficients(EQBand band, double sampleRate = 48000) + { + double frequency = band.Frequency; + double gain = band.Gain; + double q = band.Q; + double tan = 1 / Math.Tan((Pi * frequency) / sampleRate); + double tan2 = tan * tan; + double amplitude = Math.Pow(10, gain * 0.05); + + double b0 = 0, b1 = 0, b2 = 0, a0 = 1, a1 = 0, a2 = 0; + + switch (band.Type) + { + case FilterType.Peaking: + if (amplitude < 1) q *= amplitude; + double peak = (amplitude * tan) / q; + b0 = 1 + peak + tan2; + b1 = 2 * (1 - tan2); + b2 = (1 - peak) + tan2; + a0 = 1 + (tan / q) + tan2; + a1 = b1; + a2 = tan2 + (1 - (tan / q)); + break; + + case FilterType.HighShelf: + { + double a = amplitude; + double inverse = 1; + if (a <= 1) { inverse = 1 / a; a = 1; } + double root = Math.Sqrt(a); + double scaled = a * tan2; + double numerator0 = 1 + (root * tan / q) + scaled; + double numerator1 = 2 * (1 - scaled); + double numerator2 = (1 - (root * tan / q)) + scaled; + double inverseTan = tan2 * inverse; + a0 = 1 + (Math.Sqrt(inverse) * tan / q) + inverseTan; + a1 = 2 * (1 - inverseTan); + a2 = inverseTan + (1 - (Math.Sqrt(inverse) * tan / q)); + b0 = numerator0; + b1 = numerator1; + b2 = numerator2; + break; + } + + case FilterType.LowShelf: + { + double a = amplitude; + double inverse = 1; + if (a <= 1) { inverse = 1 / a; a = 1; } + double root = Math.Sqrt(a); + double numerator0 = (root * tan / q) + a + tan2; + double numerator1 = 2 * (a - tan2); + double numerator2 = (a - (root * tan / q)) + tan2; + a0 = inverse + (Math.Sqrt(inverse) * tan / q) + tan2; + a1 = 2 * (inverse - tan2); + a2 = (inverse - (Math.Sqrt(inverse) * tan / q)) + tan2; + b0 = numerator0; + b1 = numerator1; + b2 = numerator2; + break; + } + + case FilterType.HighPass: + b0 = tan2; + b1 = -2 * tan2; + b2 = tan2; + a0 = 1 + (tan / q) + tan2; + a1 = 2 * (1 - tan2); + a2 = (1 - (tan / q)) + tan2; + break; + + case FilterType.LowPass: + b0 = 1; + b1 = 2; + b2 = 1; + a0 = 1 + (tan / q) + tan2; + a1 = 2 * (1 - tan2); + a2 = tan2 + (1 - (tan / q)); + break; + } + + double normal = 1 / a0; + return new[] { b0, b1, b2, -a1, -a2 }.Select(value => (int)((value * normal * Scale) + 0.5)).ToArray(); + } + + /// Category then coefficients: the payload an AA 97 carries to select a preset. + public static byte[] Payload(byte category, IEnumerable bands, double sampleRate = 48000) + { + var payload = new List { category }; + foreach (var band in bands) + { + foreach (int value in Coefficients(band, sampleRate)) + { + uint bits = (uint)value; + payload.Add((byte)(bits & 0xFF)); + payload.Add((byte)((bits >> 8) & 0xFF)); + payload.Add((byte)((bits >> 16) & 0xFF)); + payload.Add((byte)((bits >> 24) & 0xFF)); + } + } + return payload.ToArray(); + } +} diff --git a/windows/JBLControlKit.Windows/Protocol4.cs b/windows/JBLControlKit.Windows/Protocol4.cs index 3feddef..8101d8b 100644 --- a/windows/JBLControlKit.Windows/Protocol4.cs +++ b/windows/JBLControlKit.Windows/Protocol4.cs @@ -1,5 +1,25 @@ namespace JBLControlKit.Windows; +/// +/// Protocol 4's multi-speaker features (DeviceFeature in JBL's app). +/// Protocol 4 models carry Auracast and the stereo channel as features instead +/// of the legacy AA 6A / AA 15 frames. +/// +public static class P4Party +{ + /// 8196: 0 off, 1 on (only 0/1 here, unlike the legacy link mode's 0/1/2). + public const ushort AuracastMode = 0x2004; + public const ushort Status = 0x2C00; + public const ushort GroupType = 0x2C01; + public const ushort Connection = 0x2C02; + public const ushort Role = 0x2C03; + public const ushort Channel = 0x2C04; + public const ushort GroupName = 0x2C05; + public const ushort GroupID = 0x2C06; + public const ushort GroupAction = 0x2C07; + public const ushort PartnerAddress = 0x2C81; +} + /// /// "Protocol 4", the frame format of newer JBL speakers (Go 5, Grip, Xtreme 5, Boombox 4). /// From the JBL Portable app via openjbl; not yet confirmed on hardware.