Nod Developer Center

Developer Guide

The OpenSpatial Framework

  • The source for the Nod OSX SDK is contained in the Open Spatial OSX SDK Folder in our OSX github repository.
  • To use the SDK just import all the .h/.m files into your project. Here is a complete list of what you should have imported.
    • ButtonEvent.h
    • ButtonEvent.m
    • GestureEvent.h
    • GestureEvent.m
    • OpenSpatialBluetooth.h
    • OpenSpatialBluetooth.m
    • OpenSpatialDecoder.h
    • OpenSpatialDecoder.m
    • PointerEvent.h
    • PointerEvent.m
    • RotationEvent.h
    • RotatiomEvent.m
  • The source contains a class called OpenSpatialBluetooth which handles all of the interfacing with the Nod device.
  • There are 3 aspects to using the OpenSpatialBluetooth object
    • Understanding the Subscription/Event model
    • Using the OpenSpatialBluetooth object
    • Implementing the OpenSpatialBluetoothDelegate
      • The Subscription/Event Model
        • The subscription/event model describes the way the SDK asks for and receives data from Nod.
        • There are 4 types of events (Please refer to your device manual for a description of each
          • Button Events – Events that correspond to button touches on Nod
          • 2D Pointer Events – Events that correspond to a 2D position based on movement from Nod (similar to a mouse pointer)
          • Gesture Events – Gesture’s from Nod. Please refer to your manual for more information about gestures.
          • Pose6D Events – X, Y, Z, Roll, Pitch, Yaw 3D data from Nod.
          • These events are subscribed to using the OpenSpatialBluetooth Object and then the Events are fired by calling the corresponding method in the OpenSpatialBluetoothDelegate you implement.
      • The OpenSpatialBluetooth Object
        • The Open Spatial Bluetooth Object is a singleton object that must be instantiated using its static singleton method [OpenSpatialBluetooth sharedBluetoothServ] which will return the singleton object.
        • ex/ your OpenSpatialBluetooth instance = [OpenSpatialBluetooth sharedBluetoothServ]
        • The OpenSpatialBluetooth object allows you to send commands to Nod to ask for the data you need.
        • There are six methods relevant to communicating with Nod
          • (void)scanForPeripherals
            • Call this method to find paired Nods, all devices found will be stored in the connectedPeripherals NSMutableArray property of the OpenSpatialBluetooth object.
          • NOTE: NOD DEVICES MUST BE PAIRED TO THE OSX SYSTEM TO BE FOUND BY THIS METHOD
            • (void)connectToPeripheral: (CBPeripheral*) peripheral connects to the specified peripheral
          • Four methods to subscribe to events:
            -(void)subscribeToRotationEvents:(NSString *) peripheralName;
            -(void)subscribeToGestureEvents:(NSString *) peripheralName;
            -(void)subscribeToButtonEvents:(NSString *) peripheralName;
            -(void)subscribeToPointerEvents:(NSString *) peripheralName;
            
      • The OpenSpatialBluetoothDelegate
        • You must create a class which implements the OpenSpatialBluetoothDelegate to receive data from Nod. Subscribing to events calls the event methods of the delegate corresponding to the event type.
        • There are six methods to implement from the OpenSpatialBluetoothDelegate
          • (void) didConnectToNod: (CBPeripheral*) peripheral;
            • called when a nod is connected after calling connectToPeripheral
          • (void) didFindNewDevice: (NSArray*) peripherals;
            • called when a device is found after calling scanForPeripherals
          • Four methods to recieve events from subscription
            -(ButtonEvent *)buttonEventFired: (ButtonEvent *) buttonEvent;
            -(PointerEvent *)pointerEventFired: (PointerEvent *) pointerEvent;
            -(RotationEvent *)rotationEventFired: (RotationEvent *) rotationEvent;
            -(GestureEvent *)gestureEventFired: (GestureEvent *) gestureEvent;
            

Sample workflow to subscribe to pointer events

  • Instantiate:
    • opSpcBluetooth = [OpenSpatialBluetooth sharedBluetoothServ];
  • Set Delegate (after creating the delegate):
    • opSpcBluetooth.delegate = your delegate
  • Scan:
    • [opSpcBluetooth scanForPeripherals];
  • Connect:
    • [opSpcBluetooth connectToPeripheral: peripheral found in scan];
  • Subscribe
    • [opSpcBluetooth subscribeToPointerEvents:peripheral found in scan.name];
  • Now your delegate’s pointerEventFired method should be called whenever there is new PointerData availible from Nod. Other event types follow the same workflow.

Thank You for using Nod!

For any questions regarding this iOS service or Nod in general please email: support@nod-labs.com

More information

If you want to know more, these are some good places to continue exploring:

  • Links to SDKs, developer focussed support, IRC.
  • Engage with the larger Nod development community on a variety of topics