# Class Wire

java.lang.Object
com.codename1.bluetooth.helper.Wire

public final class Wire extends Object
The line-delimited JSON codec of the `cn1-ble-helper` protocol: command serialization (with escaping) and event-line parsing via `JSONParser`, with Base64-encoded characteristic/descriptor payloads.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `Wire.Obj`
  Builder for one command line.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `boolVal(Map<String,Object> m, String key, boolean def)`
  `static byte[]`
  `decodeBase64(String s)`
  `static String`
  `encodeBase64(byte[] data)`
  `static String`
  `escape(String s)`
  `static int`
  `intVal(Map<String,Object> m, String key, int def)`
  `static List<Object>`
  `list(Map<String,Object> m, String key)`
  `static long`
  `longVal(Map<String,Object> m, String key, long def)`
  `static Map<String,Object>`
  `map(Object v)`
  `static Wire.Obj`
  `obj()`
  `static Map<String,Object>`
  `parse(String line)`
  Parses one event line into a map.
  `static String`
  `str(Map<String,Object> m, String key, String def)`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### obj

    public static Wire.Obj obj()

  - ### escape

    public static String escape(String s)

  - ### parse

    public static Map<String,Object> parse(String line) throws IOException
    Parses one event line into a map.
    Throws:
      `IOException`

  - ### str

    public static String str(Map<String,Object> m, String key, String def)

  - ### longVal

    public static long longVal(Map<String,Object> m, String key, long def)

  - ### intVal

    public static int intVal(Map<String,Object> m, String key, int def)

  - ### boolVal

    public static boolean boolVal(Map<String,Object> m, String key, boolean def)

  - ### list

    public static List<Object> list(Map<String,Object> m, String key)

  - ### map

    public static Map<String,Object> map(Object v)

  - ### encodeBase64

    public static String encodeBase64(byte[] data)

  - ### decodeBase64

    public static byte[] decodeBase64(String s)