NetMD.Simulator (NetMD v0.1.0)

Copy Markdown View Source

A virtual NetMD device that runs the whole library in-process.

This is a NetMD.Transport backed by a GenServer that decodes the NetMD control and bulk protocol and keeps disc state, so you can drive the real library against a simulated recorder without any USB, VM or root access:

{:ok, device} = NetMD.open(transport: NetMD.Simulator)
{:ok, disc} = NetMD.list_content(device)
:ok = NetMD.play(device)

Pass disc: %NetMD.Simulator.Disc{...} to open/1 to start from a custom disc; the default is a small demo disc. State survives across calls and mutates in response to edits and downloads, so a listing after a rename or download reflects the change.

It implements the command subset the library actually uses: disc and track listing, status and playback, editing, the secure download session, and enough of factory mode to authenticate. Unknown commands answer not implemented, which surfaces as a clear error.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start the device brain as a standalone process.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Start the device brain as a standalone process.

The same process serves both this module's NetMD.Transport callbacks and NetMD.Simulator.Gadget. Options: :disc, :vendor_id, :product_id, :name.