0.0.2 • Published 8 years ago

ipso-ble-char v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

ipso-ble-char

Table of Contents

  1. Overview
  2. Installation
  3. Usage
  4. APIs
  5. Table of Characteristics
  6. License

1. Overview

ipso-ble-char is a set of BLE characteristic definition following IPSO Smart Object Guideline(). Each IPSO Smart Object is defined as a BLE characteristic in this document, and characteristic value is an object contains resources of IPSO Smart Object.

2. Installation

$ npm install ipso-ble-char --save

3. Usage

ipso-ble-char provides you two getters, i.e. getUuid() and getParams(), to get Characteristic UUID and Characteristic value format.

Here is a quick exemple:

var ipsoChar = require('ipso-ble-char'),
    charUuid,
    charParam;

// get characteristic UUID
charUuid = ipsoChar.getUuid('dIn');

// get characteristic parameters
charParam = ipsoChar.getParams(charUuid);

4. APIs


.getUuid(oid)

Get Characteristic UUID corresponding to IPSO Smart Object.

Arguments:

  • oid(String | Number): Smart Object ID. oid can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.

Returns:

  • (String): Characteristic UUID or undefined

Example:

ipsoChar.getUuid('dIn');    // '0xcc00'
ipsoChar.getUuid('3200');    // '0xcc00'
ipsoChar.getUuid(3200);        // '0xcc00'

ipsoChar.getUuid('1234');      // undefined
ipsoChar.getUuid('xxxx');    // undefined

.getParams(uuid)

Get Characteristic parameters definition.

Arguments:

  • uuid(String | Number): Characteristic UUID defined in this document.

Returns:

  • (Array): Characteristic parameters object.

Example

var charParams = ipsoChar.getParams(0xcc00);
    // charParams equal to 
    // [
    //     {name: flags, type: uint8},
    //     {name: dInState, type: bool},
    //     {name: counter, type: uint8},
    //     {name: dInPolarity, type: bool},
    //     {name: debouncePeriod, type: uint16},
    //     {name: edgeSelection, type: uint8},
    //     {name: counterReset, type: buffer},
    //     {name: appType, type: string},
    //     {name: sensorType, type: string}
    // ]

5. Table of Characteristics

Following table are cross-references between the IPSO Smart Object and Characteristic UUID defined by this document.Here is the description of each column in the table:

  • IPSO Object
    • Object name and object ID defined by IPSO Alliance
  • Characteristic UUID
    • Characteristic UUID corresponding to IPSO Object
  • Field Names
    • Characteristic value is an object formed from these properties
    • Field name followed by (M) indicates it is mandatory, otherwise, it is optional
  • Field Types
    • Indicate data type of each property in Field Names column
IPSO ObjectCharacteristic UUIDField NamesField Types
Digital Input (3200)0xcc00flags(M), dInState(M), counter, dInPolarity, debouncePeriod, edgeSelection, counterReset, appType, sensorTypeuint8, bool, uint8, bool, uint16, uint8, buffer, string, string
Digital Output (3201)0xcc01flags(M), dOutState(M), dOutPolarity, appTypeuint8, bool, bool, string
Analogue Input (3202)0xcc02flags(M), aInCurrValue(M), minMeaValue, maxMeaValue, minRangeValue, maxRangeValue, resetMinMaxMeaValues, appType, sensorTypeuint8, float, float, float, float, float, buffer, string, string
Analogue Output (3203)0xcc03flags(M), aOutCurrValue(M), minRangeValue, maxRangeValue, appTypeuint8, float, float, float, string
Generic Sensor (3300)0xcc04flags(M), sensorValue(M), units, minMeaValue, maxMeaValue, minRangeValue, maxRangeValue, resetMinMaxMeaValues, appType, sensorTypeuint8, float, string, float, float, float, float, buffer, string, string
Illuminance Sensor (3301)0xcc05flags(M), sensorValue(M), units, minMeaValue, maxMeaValue, minRangeValue, maxRangeValue, resetMinMaxMeaValuesuint8, float, string, float, float, float, float, buffer
Presence Sensor (3302)0xcc06flags(M), dInState(M), counter, counterReset, sensorType, busyToClearDelay, clearToBusyDelayuint8, bool, uint8, buffer, string, uint16, uint16
Temperature Sensor (3303)0xcc07flags(M), sensorValue(M), units, minMeaValue, maxMeaValue, minRangeValue, maxRangeValue, resetMinMaxMeaValuesuint8, float, string, float, float, float, float, buffer
Humidity Sensor (3304)0xcc08flags(M), sensorValue(M), units, minMeaValue, maxMeaValue, minRangeValue, maxRangeValue, resetMinMaxMeaValuesuint8, float, string, float, float, float, float, buffer
Power Measurement (3305)0xcc09flags(M), instActivePwr(M), minMeaActivePwr, maxMeaActivePwr, minRangeActivePwr, maxRangeActivePwr, cumulActivePwr, activePwrCal, instReactivePwr, minMeaReactivePwr, maxMeaReactivePwr, minRangeReactivePwr, maxRangeReactivePwr, resetMinMaxMeaValues, cumulReactivePwr, reactivePwrCal, pwrFactor, currCal, resetCumulEnergyuint32, float, float, float, float, float, float, float, float, float, float, float, float, buffer, float, float, float, float, buffer
Actuation (3306)0xcc0aflags(M), onOff(M), dimmer, onTime, mStateOut, appTypeuint8, bool, uint8, uint16, string, string
Set Point (3308)0xcc0bflags(M), setPointValue(M), colour, units, appTypeuint8, float, string, string, string
Load Control (3310)0xcc0cflags(M), eventId(M), startTime(M), durationInMin(M), criticalLevel, avgLoadAdjPct, dutyCycleuint8, string, uint32, uint16, uint8, uint8, uint8
Light Control (3311)0xcc0dflags(M), onOff(M), dimmer, colour, units, onTime, cumulActivePwr, pwrFactoruint8, bool, uint8, string, string, uint16, float, float
Power Control (3312)0xcc0eflags(M), onOff(M), dimmer, onTime, cumulActivePwr, pwrFactoruint8, bool, uint8, uint16, float, float
Accelerometer (3313)0xcc0fflags(M), xValue(M), yValue, zValue, units, minRangeValue, maxRangeValueuint8, float, float, float, string, float, float
Magnetometer (3314)0xcc10flags(M), xValue(M), yValue, zValue, units, compassDiruint8, float, float, float, string, float
Barometer (3315)0xcc11flags(M), sensorValue(M), units, minMeaValue, maxMeaValue, minRangeValue, maxRangeValue, resetMinMaxMeaValuesuint8, float, string, float, float, float, float, buffer

6. License

The MIT License (MIT)

Copyright (c) 2016 Hedy Wang hedywings@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |