Vixen
02b45cc4
csharp
public sealed class RemoteInspectorClient

The editor's half of doc 13's remote inspector.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Doc 20's E4 exit criterion in one object: "a build on a device can be attached to and an entity mutated live". What it owns is the conversation — greet, ask for the tree, collect what arrives, write a value back — and nothing about sockets: which transport reaches which device is Vixen.Net's question, which is what lets the whole of this be tested over a loopback transport with no network at all.

⚠ Nothing is delivered outside Poll. That is the transport's own contract and this keeps it: the entity tree is rebuilt on the thread that called Poll, which is the frame thread, so the panel reading it never needs a lock. A client that raised events from a socket thread would put a background thread inside the editor's element tree.

⚠ The tree is rebuilt into a staging list and swapped, not mutated in place. An entity list that emptied and refilled over several polls would be a panel that blinks every time somebody presses Refresh — and, worse, one whose selection is gone for a frame.

⚠ A version mismatch is a state, not an exception. An editor attached to last week's build is the ordinary case on a device; saying so is useful, and half-reading its messages would show an empty tree that looks exactly like a build with no entities in it.

Fields and properties (9)

  • public const int LogCapacity

    How many lines of conversation are kept.

  • public string EditorName

    What the editor calls itself.

  • public RemoteState State

    Where the conversation has got to.

  • public string? BuildName

    What the far end calls itself, once it has said.

  • public ushort BuildVersion

    What version it speaks.

  • public IReadOnlyList<RemoteEntity> Entities

    The entities it has reported, in the order they arrived.

  • public IReadOnlyDictionary<string, double> Counters

    The live counters, by name.

  • public IReadOnlyList<string> Log

    The last few things that happened, oldest first.

  • public bool IsFetching

    Whether a tree is still arriving.

Events (1)

  • public Action<RemoteInspectorClient>? Changed

    Raised when the entities, the counters or the state changed.

Methods (11)

  • public RemoteInspectorClient(ITransport transport, string editorName = "Vixen Editor")

    Attaches to a transport that has already been pointed at an endpoint.

  • public void Attach()

    Starts the transport's client half and greets whatever answers.

  • public void Detach()

    Stops the transport's client half and forgets everything it said.

  • public void Refresh()

    Asks the far end for its entity tree.

  • public void SetValue(ulong entity, string member, string value)

    Writes a component member on the far end.

  • public void Command(string verb)

    Asks the far end to do something — capture a frame, collect, reload shaders.

  • public void Poll(TimeSpan elapsed)

    Advances the transport and delivers whatever arrived.

  • public void OnConnected(TransportRole role, ConnectionId connection)

    A connection was established.

  • public void OnDisconnected(TransportRole role, ConnectionId connection, DisconnectReason reason)

    A connection ended, or an attempt to make one failed.

  • public void OnData(TransportRole role, ConnectionId connection, Channel channel, ReadOnlySpan<byte> payload)

    A payload arrived.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (3)

  • DiagnosticsModuleVixen.Editor.Diagnostics
  • RemoteInspectorTestsVixen.Editor.Debugger.Tests
  • RemoteInspectorViewVixen.Editor.Debugger