Data Structures | Macros | Typedefs | Enumerations | Functions
ags.h File Reference

Alexa Gadgets Service API. More...

`#include "gr55xx_sys.h"`
`#include "custom_config.h"`
`#include <stdint.h>`
`#include <stdbool.h>`

Go to the source code of this file.

## Data Structures
struct | ags_header_base_t
| Alexa Gadget Service base part of data packet header. More...
struct | ags_header_first_t
| Alexa Gadget Service header in first packet. More...
struct | ags_header_first_ext_t
| Alexa Gadget Service extended version of header in first packet. More...
struct | ags_header_subs_t
| Alexa Gadget Service header in subsequent packets. More...
struct | ags_header_subs_ext_t
| Alexa Gadget Service extended version of header in subsequent packets. More...
struct | ags_ack_packet_t
| Alexa Gadget Service ACK packet. More...
struct | ags_stream_env_t
| Alexa Gadget Service gadget stream enviorenment variable. More...
struct | ags_evt_t
| Alexa Gadget Service event. More...
struct | ags_init_t
| Alexa Gadget Service init stucture. This contains all option and data needed for initialization of the service. More...

## Macros
#define | AGS_SERVICE_UUID
#define | AGS_HEADER_FIRST_RES 0x00
#define | AGS_HEADER_ACK_RES_1 0x00
#define | AGS_HEADER_ACK_PAYLOAD_LEN 0x02
#define | AGS_HEADER_ACK_RES_2 0x01
#define | AGS_TX_VAL_LEN_MAX 244
#define | AGS_RX_VAL_LEN_MAX 244
#define | AGS_PAIR_ADV_FLAG 0x01
#define | AGS_RECONNECT_ADV_FLAG 0x00
#define | AGS_CONNECTION_MAX
#define | AGS_CHAR_MANDATORY 0x003f
#define | AGS_CHAR_FULL 0x003f

## Typedefs
typedef void(* | ags_evt_handler_t) (ags_evt_t *p_evt)
| Alexa Gadget Service event handler type.
typedef bool(* | ags_stream_cb_t) (uint8_t conn_idx, const uint8_t *const p_data, uint16_t length, uint8_t still_receiving)
| Alexa Gadget Service stream callback.

## Enumerations
enum | ags_header_stream_id_t { AGS_CONTROL_STREAM_ID, AGS_ALEXA_STREAM_ID = 0x06, AGS_OTA_STREAM_ID = 0x02 }
| Alexa Gadget Service Stream ID. At any time, there is only one control stream, one Alexa stream, and one OTA stream. Each packet belongs to one of these streams, which is specified in the stream ID field of the packet's header. See Gadgets documentation for details: https://developer.amazon.com/en-US/docs/alexa/alexa-gadgets-toolkit/packet-ble.html#streams. More...
enum | ags_header_trxn_type_t { AGS_TRANSACTION_TYPE_FIRST, AGS_TRANSACTION_TYPE_CONT, AGS_TRANSACTION_TYPE_LAST, AGS_TRANSACTION_TYPE_CTRL }
| Alexa Gadget Service transaction type. It indicate where the packet is within the transaction. The transaction type and protocol of a single transaction are defined by the first packet of the transaction. More...
enum | ags_header_ack_flag_t { AGS_ACK_NACK, AGS_ACK_ACK }
| Alexa Gadget Service ACK Flag. More...
enum | ags_header_length_ext_t { AGS_LEN_EXT_NO_EXT, AGS_LEN_EXT_EXT }
| Alexa Gadget Service Length extender. More...
enum | ags_header_result_code_t { AGS_RES_CODE_SUCCESS, AGS_RES_CODE_UNKNOWN, AGS_RES_CODE_UNSUPPORTED = 0x03 }
| Alexa Gadget Service result code. More...
enum | ags_evt_type_t { AGS_EVT_INVALID, AGS_EVT_ECHO_RX_DATA_SENT, AGS_EVT_ECHO_TX_DATA_RECEIVED, AGS_EVT_ECHO_RX_NOTI_ENABLE, AGS_EVT_ECHO_RX_NOTI_DISABLE }
| Alexa Gadget Service event type. More...

## Functions
sdk_err_t | ags_service_init (ags_init_t *p_ags_init)
| Initialize a Alexa Gadget Service instance and add in the DB. More...
sdk_err_t | ags_stream_send (uint8_t conn_idx, uint8_t stream_id, void *p_data, uint16_t length)
| Send data to the Echo device in stream format. More...
sdk_err_t | ags_non_stream_send (uint8_t conn_idx, void *p_data, uint16_t length)
| Send data to the Echo device in non-stream format. More...

## Detailed Description

Alexa Gadgets Service API.

Attention

  ##### Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.