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

Current Time Service Client API. More...

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

Go to the source code of this file.

## Data Structures
struct | cts_c_handles_t
| Handles on the connected peer device needed to interact with it. More...
struct | cts_c_exact_time_256_t
| Exact Time 256. More...
struct | cts_c_cur_time_t
| Current Time value. More...
struct | cts_c_loc_time_info_t
| Local Time Information. More...
struct | cts_c_ref_time_info_t
| Reference Time Information. More...
struct | cts_c_evt_t
| Current Time Service Client event. More...

## Macros
#define | CTS_C_CONNECTION_MAX
#define | CTS_C_CUR_TIME_VAL_LEN 10
#define | CTS_C_LOC_TIME_INFO_VAL_LEN 2
#define | CTS_C_TIME_Y_M_D_UNKNOWN 0
#define | CTS_C_TIME_YEAR_VALID_VAL_MIN 1582
#define | CTS_C_TIME_YEAR_VALID_VAL_MAX 9999
#define | CTS_C_TIME_ZONE_OFFSET_MIN -48
#define | CTS_C_TIME_ZONE_OFFSET_MAX 56
#define | CTS_C_TIME_ACCURACY_OUT_RANGE 254
#define | CTS_C_TIME_ACCURACT_UNKNOWN 255
#define | CTS_C_ERROR_FIELDS_IGNORED 0x80
#define | CTS_C_AR_NO_CHANGE (0x00 << 0)
#define | CTS_C_AR_MAUAL_TIME_UPDATE (0x01 << 0)
#define | CTS_C_AR_EXT_REF_TIME_UPDATE (0x01 << 1)
#define | CTS_C_AR_TIME_ZONE_CHANGE (0x01 << 2)
#define | CTS_C_AR_DST_CHANGE (0x01 << 3)

## Typedefs
typedef void(* | cts_c_evt_handler_t) (cts_c_evt_t *p_evt)
| Current Time Service Client event handler type.

## Enumerations
enum | cts_c_week_day_t { CTS_C_WEEK_UNKNOWN_DAY, CTS_C_WEEK_MONDAY, CTS_C_WEEK_TUSEDAY, CTS_C_WEEK_WEDNESDAY, CTS_C_WEEK_THURSDAT, CTS_C_WEEK_FRIDAY, CTS_C_WEEK_SATURDAY, CTS_C_WEEK_SUNDAY }
| Current Time Day of week. More...
enum | cts_c_dst_offset_t { CTS_C_DST_OFFSET_STANDAR_TIME = 0x00, CTS_C_DST_OFFSET_HALF_HOUR = 0x02, CTS_C_DST_OFFSET_DAYLIGHT_TIME = 0x04, CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME = 0x08 }
| Local time information:Daylight Saving Time Offset. More...
enum | cts_c_ref_time_source_t { CTS_C_REF_TIME_SRC_UNKNOWN, CTS_C_REF_TIME_SRC_NET_TIME_PROTOCOL, CTS_C_REF_TIME_SRC_GPS, CTS_C_REF_TIME_SRC_RADIO_TIME_SIGNAL, CTS_C_REF_TIME_SRC_MANUAL, CTS_C_REF_TIME_SRC_ATOMIC_CLOCK, CTS_C_REF_TIME_SRC_CELLUAR_NET }
| Reference time information:Time Source. More...
enum | cts_c_evt_type_t { CTS_C_EVT_INVALID, CTS_C_EVT_DISCOVERY_COMPLETE, CTS_C_EVT_DISCOVERY_FAIL, CTS_C_EVT_CUR_TIME_NTF_SET_SUCCESS, CTS_C_EVT_VALID_CUR_TIME_REC, CTS_C_EVT_INVALID_CUR_TIME_REC, CTS_C_EVT_VALID_LOC_TIME_INFO_REC, CTS_C_EVT_INVALID_LOC_TIME_INFO_REC, CTS_C_EVT_VALID_REF_TIME_INFO_REC, CTS_C_EVT_INVALID_REF_TIME_INFO_REC, CTS_C_EVT_CUR_TIME_SET_SUCCESS, CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS, CTS_C_EVT_WRITE_OP_ERR }
| Current Time Service Client event type. More...

## Functions
sdk_err_t | cts_client_init (cts_c_evt_handler_t evt_handler)
| Register CTS Client event handler. More...
sdk_err_t | cts_c_disc_srvc_start (uint8_t conn_idx)
| Discovery Current Time Service on peer. More...
sdk_err_t | cts_c_cur_time_notify_set (uint8_t conn_idx, bool is_enable)
| Enable or disable peer Current Time characteristic notify. More...
sdk_err_t | cts_c_cur_time_read (uint8_t conn_idx)
| Read Current Time characteristic value. More...
sdk_err_t | cts_c_loc_time_info_read (uint8_t conn_idx)
| Read Local Time Information characteristic value. More...
sdk_err_t | cts_c_ref_time_info_read (uint8_t conn_idx)
| Read Reference Time Information characteristic value. More...
sdk_err_t | cts_c_cur_time_set (uint8_t conn_idx, cts_c_cur_time_t *p_cur_time)
| Set Current Time characteristic value. More...
sdk_err_t | cts_c_loc_time_info_set (uint8_t conn_idx, cts_c_loc_time_info_t *p_loc_time_info)
| Set Local Time Information characteristic value. More...

## Detailed Description

Current Time Service Client 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.