From 19175b88e9a61d3c197a4627aee270de49df5269 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 23 Mar 2015 22:38:17 +0100 Subject: implement enum support --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8a20272..ec8e7b1 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,11 @@ parser.push(data) The concrete message implementations are generated according to the selected dialect (see section Keys). ### Types +#### Messages Every message is mapped to a Scala case class, its name converted to CamelCase. The fields of the case class correspond to the fields defined in the dialect definition (names are converted to camelCase). +#### Fields Field types are mapped according to the following table | Definition Type | Scala Type | @@ -62,11 +64,17 @@ Field types are mapped according to the following table *Note that since Scala only supports signed integer types, it is up to the client to interpret the values of fields correctly.* +#### Enums +Enums are mapped to Scala objects, their fields defined as final vals (CamelCase) of type Int. + +*Note that since many MAVLink messages that use enums do not define a dependency on them in XML (no 'enum=' attribute), no type safety +can be guaranteed when generating messages.* + ## Usage Add the following to your plugins: ```scala - addSbtPlugin("com.github.jodersky" % "sbt-mavlink" % "0.2")` + addSbtPlugin("com.github.jodersky" % "sbt-mavlink" % "0.4")` ``` Set a MAVLink dialect @@ -85,9 +93,6 @@ All keys are defined in ```com.github.jodersky.mavlink.sbt.MavlinkKeys``` - ```mavlinkTarget``` - [Setting] - Output directory of generated Scala sources. This should be within ```sourceManaged```. -## Limitations - - Enums are not used, instead their corresponding integer value is substituted - ## Credits Copyright (c) 2015 Jakob Odersky -- cgit v1.2.3