19fe70df8SMilanka Ringwald /* 29fe70df8SMilanka Ringwald * Copyright (C) 2018 BlueKitchen GmbH 39fe70df8SMilanka Ringwald * 49fe70df8SMilanka Ringwald * Redistribution and use in source and binary forms, with or without 59fe70df8SMilanka Ringwald * modification, are permitted provided that the following conditions 69fe70df8SMilanka Ringwald * are met: 79fe70df8SMilanka Ringwald * 89fe70df8SMilanka Ringwald * 1. Redistributions of source code must retain the above copyright 99fe70df8SMilanka Ringwald * notice, this list of conditions and the following disclaimer. 109fe70df8SMilanka Ringwald * 2. Redistributions in binary form must reproduce the above copyright 119fe70df8SMilanka Ringwald * notice, this list of conditions and the following disclaimer in the 129fe70df8SMilanka Ringwald * documentation and/or other materials provided with the distribution. 139fe70df8SMilanka Ringwald * 3. Neither the name of the copyright holders nor the names of 149fe70df8SMilanka Ringwald * contributors may be used to endorse or promote products derived 159fe70df8SMilanka Ringwald * from this software without specific prior written permission. 169fe70df8SMilanka Ringwald * 4. Any redistribution, use, or modification is done solely for 179fe70df8SMilanka Ringwald * personal benefit and not for any commercial purpose or for 189fe70df8SMilanka Ringwald * monetary gain. 199fe70df8SMilanka Ringwald * 209fe70df8SMilanka Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 219fe70df8SMilanka Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 229fe70df8SMilanka Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23*2fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24*2fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 259fe70df8SMilanka Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 269fe70df8SMilanka Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 279fe70df8SMilanka Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 289fe70df8SMilanka Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 299fe70df8SMilanka Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 309fe70df8SMilanka Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 319fe70df8SMilanka Ringwald * SUCH DAMAGE. 329fe70df8SMilanka Ringwald * 339fe70df8SMilanka Ringwald * Please inquire about commercial licensing options at 349fe70df8SMilanka Ringwald * [email protected] 359fe70df8SMilanka Ringwald * 369fe70df8SMilanka Ringwald */ 37fe5a6c4eSMilanka Ringwald 38fe5a6c4eSMilanka Ringwald /** 39fe5a6c4eSMilanka Ringwald * @title Cycling Speed and Cadence Service Server 40fe5a6c4eSMilanka Ringwald * 41fe5a6c4eSMilanka Ringwald */ 42fe5a6c4eSMilanka Ringwald 4380e33422SMatthias Ringwald #ifndef CYCLING_SPEED_AND_CADENCE_SERVICE_SERVER_H 4480e33422SMatthias Ringwald #define CYCLING_SPEED_AND_CADENCE_SERVICE_SERVER_H 459fe70df8SMilanka Ringwald 469fe70df8SMilanka Ringwald #include <stdint.h> 479fe70df8SMilanka Ringwald 489fe70df8SMilanka Ringwald #if defined __cplusplus 499fe70df8SMilanka Ringwald extern "C" { 509fe70df8SMilanka Ringwald #endif 519fe70df8SMilanka Ringwald 529fe70df8SMilanka Ringwald /** 531ea30d1bSMilanka Ringwald * @text The Cycling Speed and Cadence Service allows to query 541ea30d1bSMilanka Ringwald * device's speed- and cadence-related data for use in sports and 551ea30d1bSMilanka Ringwald * fitness applications. 569fe70df8SMilanka Ringwald * 571ea30d1bSMilanka Ringwald * To use with your application, add `#import <cycling_speed_and_cadence_service.gatt>` 581ea30d1bSMilanka Ringwald * to your .gatt file. 599fe70df8SMilanka Ringwald */ 609fe70df8SMilanka Ringwald 619fe70df8SMilanka Ringwald /* API_START */ 629fe70df8SMilanka Ringwald 639fe70df8SMilanka Ringwald typedef enum { 649fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_OTHER = 0, 659fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_TOP_OF_SHOE, 669fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_IN_SHOE, 679fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_HIP, 689fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_FRONT_WHEEL, 699fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_LEFT_CRANK, 709fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_RIGHT_CRANK, 719fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_LEFT_PEDAL, 729fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_RIGHT_PEDAL, 739fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_FRONT_HUB, 749fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_REAR_DROPOUT, 759fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_CHAINSTAY, 769fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_REAR_WHEEL, 779fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_REAR_HUB, 789fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_CHEST, 799fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_SPIDER, 809fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_CHAIN_RING, 819fe70df8SMilanka Ringwald CSC_SERVICE_SENSOR_LOCATION_RESERVED 829fe70df8SMilanka Ringwald } cycling_speed_and_cadence_sensor_location_t; 839fe70df8SMilanka Ringwald 849fe70df8SMilanka Ringwald typedef enum { 859fe70df8SMilanka Ringwald CSC_FLAG_WHEEL_REVOLUTION_DATA_SUPPORTED = 0, 869fe70df8SMilanka Ringwald CSC_FLAG_CRANK_REVOLUTION_DATA_SUPPORTED, 879fe70df8SMilanka Ringwald CSC_FLAG_MULTIPLE_SENSOR_LOCATIONS_SUPPORTED 889fe70df8SMilanka Ringwald } csc_feature_flag_bit_t; 899fe70df8SMilanka Ringwald 909fe70df8SMilanka Ringwald typedef enum { 919fe70df8SMilanka Ringwald CSC_OPCODE_IDLE = 0, 929fe70df8SMilanka Ringwald CSC_OPCODE_SET_CUMULATIVE_VALUE = 1, 939fe70df8SMilanka Ringwald CSC_OPCODE_START_SENSOR_CALIBRATION, 949fe70df8SMilanka Ringwald CSC_OPCODE_UPDATE_SENSOR_LOCATION, 959fe70df8SMilanka Ringwald CSC_OPCODE_REQUEST_SUPPORTED_SENSOR_LOCATIONS, 969fe70df8SMilanka Ringwald CSC_OPCODE_RESPONSE_CODE = 16 979fe70df8SMilanka Ringwald } csc_opcode_t; 989fe70df8SMilanka Ringwald 999fe70df8SMilanka Ringwald /** 1009fe70df8SMilanka Ringwald * @brief Init Server with ATT DB 1019fe70df8SMilanka Ringwald */ 1029fe70df8SMilanka Ringwald void cycling_speed_and_cadence_service_server_init(uint32_t supported_sensor_locations, 1039fe70df8SMilanka Ringwald uint8_t multiple_sensor_locations_supported, uint8_t wheel_revolution_data_supported, uint8_t crank_revolution_data_supported); 1049fe70df8SMilanka Ringwald 1059fe70df8SMilanka Ringwald /** 1069fe70df8SMilanka Ringwald * @brief Update heart rate (unit: beats per minute) 1079fe70df8SMilanka Ringwald * @note triggers notifications if subscribed 1089fe70df8SMilanka Ringwald */ 1099fe70df8SMilanka Ringwald void cycling_speed_and_cadence_service_server_update_values(int32_t wheel_revolutions, uint16_t last_wheel_event_time, uint16_t crank_revolutions, uint16_t last_crank_event_time); 1109fe70df8SMilanka Ringwald 1119fe70df8SMilanka Ringwald /* API_END */ 1129fe70df8SMilanka Ringwald 1139fe70df8SMilanka Ringwald #if defined __cplusplus 1149fe70df8SMilanka Ringwald } 1159fe70df8SMilanka Ringwald #endif 1169fe70df8SMilanka Ringwald 1179fe70df8SMilanka Ringwald #endif 1189fe70df8SMilanka Ringwald 119