Files
RCM-Emulator/t210/btpeer.h
T

27 lines
1.2 KiB
C++

// Fake Bluetooth controllers for the CYW4356 model (mmio.cpp): what a
// payload acting as an HCI host finds and talks to once the radio is up.
//
// Two peers in pairing mode: a Pro Controller that insists on Secure Simple
// Pairing with bonding before it opens its HID channels, and a right Joy-Con
// that needs no security at all, so both paths of a host are exercised.
// Once a host has both HID channels open, the connected one streams input
// reports in guest time, pressing each of its buttons in turn and sweeping
// its sticks, so a screenshot shows the host's view moving.
//
// This proves a host against this model's reading of the protocol, not
// against a real controller.
#pragma once
#include <cstdint>
struct EmuState;
// The radio went through a power-on reset: forget every connection.
void btpeer_reset(EmuState *state);
// An HCI command the reset model does not answer itself. True when handled.
bool btpeer_command(EmuState *state, uint16_t opcode, const uint8_t *p,
uint32_t n);
// One ACL packet from the host: handle/flags (2), length (2), then data.
void btpeer_acl(EmuState *state, const uint8_t *pkt, uint32_t n);
// Deliver what is due by now. Called on every UART-D register access.
void btpeer_tick(EmuState *state);