Changelog

v0.5.1

  • Fixed a bug that was causing every function to have an opts argument, even if it didn’t have any optional args.
  • Fixed a crash when a Connection tries to terminate because its parent process has exited. Now it should crash correctly. 🙂
  • Added some tests. More to come.

v0.5.0

Major (and very breaking) overhaul to function arguments.

Connection references

  • Functions that return remote object reference(s) — SpaceCenter.active_vessel, Orbit.body, etc. — will now return structure(s) containing the reference and the connection it was retrieved via.
  • Functions that take a this parameter as their first argument — Vessel.max_thrust, Flight.mean_altitude, etc. — no longer take a conn argument before the this argument. Instead, they use the connection from this.
  • For example, Vessel.max_thrust(conn, vessel) becomes Vessel.max_thrust(vessel).
  • This also means functions are now chainable, e.g. SpaceCenter.active_vessel(conn) |> Vessel.max_thrust().

Optional arguments

  • Functions that have arguments with default values, now expect those arguments in a key: value keyword list form.
  • Said arguments can be omitted, and will send the default value if so.
  • For example, Vessel.flight(vessel, frame) is now either Vessel.flight(vessel, reference_frame: frame), or Vessel.flight(vessel) if the default value is desired.

Stream changes

  • New stream functions added:

    • SpaceEx.Stream.start/2
    • SpaceEx.Stream.remove/2
  • Multiple attempts to stream the same data will no longer result in hanging behaviour.

    • Instead, they’ll all reuse the same Stream process.
  • Streams are no longer linked to the process that creates them.

    • This becomes dangerous behaviour when multiple independent streaming requests can result in using the same process.
    • Instead, they’re linked to the StreamConnection process.
  • The StreamConnection process is now linked to the Connection process.

    • They were previously “linked by proxy” via the process that created them, but became unlinked if that process exited normally.
    • Now, the Connection, StreamConnection, and all Stream processes are linked, and an error in any will take the whole connection stack down.
  • Streams are now “bonded” to any process that requests their creation, even if they’re being reused.

    • Calling remove/2 will terminate the bond.
    • The stream will automatically shut itself down (and request removal from the server) if all bonds call remove/2 or terminate.
  • Event.remove added; delegates to Stream.remove.

Other changes

  • Procedure.new removed.

    • Procedures are now generated by internal methods on the service modules themselves; it no longer makes sense to manually create them.
  • Connections now explicitly Process.monitor the process that launched them, and exit when that process does.
  • Documentation now correctly lists parameters in snake_case rather than camelCase.
  • Several KRPC functions are now marked as undocumented (hidden):

    • add_stream
    • add_event
    • remove_stream
    • set_stream_rate
    • start_stream
    • These functions are used internally by the Event and Stream classes and should not be used directly.
  • Upgraded to Elixir 1.6:

    • All warnings fixed.
    • All code reformatted using the new auto-formatter.

v0.4.0

  • Complete rewrite of the API JSON parsing code.

    • The API should remain 100% the same, but the internals are much cleaner now.
    • All aspects of the JSON are parsed immediately under the SpaceEx.API module.
    • Types are parsed into SpaceEx.API.Type.* structs at compile time.
    • Runtime type encoding/decoding uses functions instead of macros.
    • Documentation now builds an index of cross-references and uses that instead of guesswork.

v0.3.0

  • Stream.wait added.
  • Events added.
  • sub_orbital_flight.exs and .craft added, ported from kRPC SubOrbitalFlight.py. Provides example of Events.
  • launch_into_orbit.craft added, and .exs made more true to original.
  • Breaking changes to RPC call syntax:

    • All calls return their return value directly, not an {:ok, value} tuple.
    • SpaceEx.Connection.RPCError is raised on errors instead.
    • All get_ and static_ function prefixes are removed.
    • ExDoc examples and example scripts still need to be updated.

v0.2.0

  • Changelog created.
  • Stream functionality added.