Skip to content

cv47522/nodejs-express-rest-api-vibration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haptic Glove API


Base URL

  • Floating IP Address (related to local network): 10.100.xx.xx

Paths & Methods

  • /api/uptime: Get system/glove server uptime.
    • GET

  • /api/events: Get sent/unfinished vibration events.
    • GET

  • /api/events + Json format parameters (see examples): Create a vibration event/pattern.
    • POST

Parameters

  • mode: Which haptic pattern to run.
    • Type: int
      • 0: Real-time trigger (default)
      • 1: Heartbeat around whole hand/all motors
      • 2: Random raining/iteration around whole hand/all motors
      • 3: Spreading vibration on fingertips
      • 4: Spreading vibration on palmar area
      • 5: ON/OFF vibration on single point/motor at random intensity and duration


  • intensity: How strong is the vibration.
    • Type: int
      • 0 ~ 60: OFF mode
      • 250: max. ON mode

  • duration: How fast/many milliseconds will this haptic pattern run.
    • Type: int

  • round: How many rounds will this haptic pattern run.
    • Type: int

  • time: Works as a placeholder (not functioning).
    • Type: long


Examples

  • Check if the glove server is turned on by getting its uptime information:
      {  
          "uptime": "753"
      }

  • Create a call to turn ON/OFF a motor at pin number 27 with a specific intensity (e.g. level 150):
    • Request:

      # shell
      # turn ON
      http POST http://10.100.xx.xx/api/events time=999999 mode=0 gpio=27 intensity=150
      
      # turn OFF
      http POST http://10.100.xx.xx/api/events time=999999 mode=0 gpio=27 intensity=0
      {
          "time": "999999",
          "mode": "0",
          "gpio": "27",
          "intensity": "150" // turn ON
      }
    • Response (Json):

     { 
         "id": "0",
         "time": "999999",
         "mode": "0",
         "gpio": "27",
         "intensity": "150",
         "duration": "0",
         "round": "0"
     }

  • Check if there is any sent/unfinished vibration event:
      {
          "id": "0",
          "time": "999999",
          "mode": "0",
          "gpio": "27",
          "intensity": "150",
          "duration": "0",
          "round": "0"
      }

  • Create a call to run a preset haptic pattern with specific parameters:
    • Request:

      # shell
      # mode 1: run the heartbeat pattern through whole hand/all motors at the 120 ms duration/period for 10 rounds
      http POST http://10.100.xx.xx/api/events time=999999 mode=1 intensity=150 duration=120 round=10
      {
          "time": "999999",
          "mode": "1", // Heartbeat
          "intensity": "150",
          "duration": "120",
          "round": "10"
      }
    • Response (Json):

     {
         "id": "1",
         "time": "999999",
         "mode": "1",
         "gpio": "27", // from previous request call
         "intensity": "150",
         "duration": "120",
         "round": "10"
     }