============================= Alarm programming interface ============================= A description of the available programming interfaces used to interact with alarm components. .. _Alarm-Summary: Summary ~~~~~~~ ========================================== ========================================= ================ Chapter URL JSON HTTP Method ========================================== ========================================= ================ :ref:`Alarm/Count` /Alarm/Count.json GET :ref:`Alarm/Configuration/Get` /Alarm/Configuration.json GET :ref:`Alarm/Configuration/Post` /Alarm/Configuration.json POST :ref:`Alarm/Configuration/Put` /Alarm/Configuration.json PUT :ref:`Alarm/Preset/Info` /Alarm/Preset/Info.json GET ========================================== ========================================= ================ .. _Alarm/Count: Count ~~~~~ Get the available Alarm Number ------------------------------ ======================== ============================== Key Value JSon ======================== ============================== Resource URL /Alarm/Count.json HTTP Method GET Response format ``application/json`` ======================== ============================== Description ^^^^^^^^^^^ Returns the available alarm number. Parameters ^^^^^^^^^^ None. Request example ^^^^^^^^^^^^^^^ :: http://[x.x.x.x]:34000/Alarm/Count.json Expected response ^^^^^^^^^^^^^^^^^ +---------------+---------------------+----------------------+-------------------------------------+ | HTTP code | Status | Object type | Description | +===============+=====================+======================+=====================================+ | 200 | ``passed`` | Integer | The request succeeded. | +---------------+---------------------+----------------------+-------------------------------------+ Response example ^^^^^^^^^^^^^^^^ .. hidden-code-block:: json :linenos: :label: JSON Response Example (Open/Close) { "count": "1", "id": "/Alarm/Count.json", "status": "passed", "response_code": 200 } | | | .. _Alarm/Configuration/Get: Configuration ~~~~~~~~~~~~~ Get the Alarm Configuration --------------------------- ======================== ============================== Key Value JSon ======================== ============================== Resource URL /Alarm/Configuration.json HTTP Method GET Response format ``application/json`` ======================== ============================== Description ^^^^^^^^^^^ Returns the ``AlarmConfigContainer`` object. Parameters ^^^^^^^^^^ None. Request example ^^^^^^^^^^^^^^^ :: http://[x.x.x.x]:34000//Alarm/Configuration.json Expected response ^^^^^^^^^^^^^^^^^ +---------------+---------------------+----------------------------+-------------------------------------+ | HTTP code | Status | Object type | Description | +===============+=====================+============================+=====================================+ | 200 | ``passed`` | ``AlarmConfigContainer`` | The request succeeded. | +---------------+---------------------+----------------------------+-------------------------------------+ Response example ^^^^^^^^^^^^^^^^ .. hidden-code-block:: json :linenos: :label: JSON Response Example (Open/Close) { "alarms": [{ "id": 0, "state": "on", "source_type": "preset", "source": "1", "frequency": [1, 2, 4, 8, 16], "volume_mode": "specific", "volume": 50, "time": "06:45" }], "id": "/Alarm/Configuration.json", "status": "passed", "response_code": 200 } | | | .. _Alarm/Configuration/Post: Set an Alarm Configuration (POST) --------------------------------- ======================== ========================= Key Value JSon ======================== ========================= Resource URL /Alarm/Configuration.json HTTP Method POST Response format ``application/json`` ======================== ========================= Description ^^^^^^^^^^^ This method allow to change parameters of an alarm. Keys ^^^^ +-----+--------------------+-------------+-------------+-------------------+ | # | Name | Mandatory | Data type | Type of parameter | +=====+====================+=============+=============+===================+ | 1 | alarm_config | Yes | ``alarms`` | POST | +-----+--------------------+-------------+-------------+-------------------+ alarm_config: Alarm configuration parameters in json format Example request ^^^^^^^^^^^^^^^ :: http://[x.x.x.x]:34000/Alarm/Configuration.json alarm_config={"id":0,"volume":50,"source":1,"source_type":"default_tone","state":"on","volume_mode":"specific","time":"12:12","frequency":[1, 64]} .. hidden-code-block:: json :linenos: :label: JSON Response Example (Open/Close) { "id": "/Alarm/Configuration.json", "status": "passed", "response_code": 200 } | | | .. _Alarm/Configuration/Put: Set an Alarm Configuration (PUT) -------------------------------- ======================== ============================== Key Value JSon ======================== ============================== Resource URL /Alarm/Configuration.json HTTP Method PUT Response format ``application/json`` ======================== ============================== Description ^^^^^^^^^^^ This method allow to change parameters of an alarm. Parameters ^^^^^^^^^^ Parameters can be sent in the same time. The alarm id parameter is mandatory for each request. +-----+--------------------+-------------+-----------+-------------------+ | # | Name | Mandatory | Data type | Type of parameter | +=====+====================+=============+===========+===================+ | 1 | id | Yes | Integer | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 2 | state | No | String | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 3 | source_type | No | String | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 4 | source | No | String | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 5 | frequency | No | String | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 6 | volume_mode | No | String | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 7 | volume | No | Integer | PUT | +-----+--------------------+-------------+-----------+-------------------+ | 9 | time | No | String | PUT | +-----+--------------------+-------------+-----------+-------------------+ :id: Alarm id value starting at index '0' :state: Alarm state can be ''on'' or ''off'' :source_type: Alarm source_type can be ''default_tone'' or ''preset'' :source: Alarm source can be a preset number (starting at index 1) if source_type = preset :frequency: Alarm frequency list separated by ',' character. Can be ''0'' (once), ''1'' (monday), ''2'' (tuesday), ''4'' (wednesday), , ''8'' (thursday), ''16'' (friday), ''32'' (saturday), ''64'' (sunday) :volume_mode: Alarm volume_mode can be ''specific'' or ''incremental'' :volume: Alarm specific volume value or the maximum incremental volume value :time: Alarm time value in the form "HH:MM" Example request ^^^^^^^^^^^^^^^ :: http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&state=true http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&source_type=preset http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&source=1 http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&frequency=0 http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&volume_mode=spec http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&volume=30 http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&time=15:45 http://[x.x.x.x]:34000/Alarm/Configuration.json?id=0&state=true&source_type=preset&source=1&frequency=1,2,4&volume_mode=spec&volume=10&time=17:26 .. hidden-code-block:: json :linenos: :label: JSON Response Example (Open/Close) { "id": "/Alarm/Configuration.json", "status": "passed", "response_code": 200 } | | | .. _Alarm/Preset/Info: Preset ~~~~~~ Get the Alarm Preset -------------------- ======================== ============================== Key Value JSon ======================== ============================== Resource URL /Alarm/Preset/Info.json HTTP Method GET Response format ``application/json`` ======================== ============================== Description ^^^^^^^^^^^ Returns the ``AlarmPresetContainer`` object. Parameters ^^^^^^^^^^ None. Request example ^^^^^^^^^^^^^^^ :: http://[x.x.x.x]:34000//Alarm/Preset/Info.json Expected response ^^^^^^^^^^^^^^^^^ +---------------+---------------------+----------------------------+-------------------------------------+ | HTTP code | Status | Object type | Description | +===============+=====================+============================+=====================================+ | 200 | ``passed`` | ``AlarmPresetContainer`` | The request succeeded. | +---------------+---------------------+----------------------------+-------------------------------------+ Response example ^^^^^^^^^^^^^^^^ .. hidden-code-block:: json :linenos: :label: JSON Response Example (Open/Close) { "alarm_presets": [{ "id": 1, "title": "CHERIE FM 99.1 Live", "selected": false }, { "id": 2, "title": "Europe 1 104.2 FM Live", "selected": true }, { "id": 3, "title": "Jazz Radio 97.3 FM Live", "selected": false }, { "id": 4, "title": "MFM 102.7", "selected": false }, { "id": 5, "title": "RMC Info Live", "selected": false }], "id": "/Alarm/Preset/Info.json", "status": "passed", "response_code": 200 } | | |