Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:54:50 2016 +0000
Revision:
1:d96dbedaebdb
Parent:
0:6c56fb4bc5f0
Removed extra directories for other platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 /* mbed Microcontroller Library
nexpaq 0:6c56fb4bc5f0 2 * Copyright (c) 2006-2013 ARM Limited
nexpaq 0:6c56fb4bc5f0 3 *
nexpaq 0:6c56fb4bc5f0 4 * Licensed under the Apache License, Version 2.0 (the "License");
nexpaq 0:6c56fb4bc5f0 5 * you may not use this file except in compliance with the License.
nexpaq 0:6c56fb4bc5f0 6 * You may obtain a copy of the License at
nexpaq 0:6c56fb4bc5f0 7 *
nexpaq 0:6c56fb4bc5f0 8 * http://www.apache.org/licenses/LICENSE-2.0
nexpaq 0:6c56fb4bc5f0 9 *
nexpaq 0:6c56fb4bc5f0 10 * Unless required by applicable law or agreed to in writing, software
nexpaq 0:6c56fb4bc5f0 11 * distributed under the License is distributed on an "AS IS" BASIS,
nexpaq 0:6c56fb4bc5f0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nexpaq 0:6c56fb4bc5f0 13 * See the License for the specific language governing permissions and
nexpaq 0:6c56fb4bc5f0 14 * limitations under the License.
nexpaq 0:6c56fb4bc5f0 15 */
nexpaq 0:6c56fb4bc5f0 16
nexpaq 0:6c56fb4bc5f0 17 #ifndef __DISCOVERED_SERVICE_H__
nexpaq 0:6c56fb4bc5f0 18 #define __DISCOVERED_SERVICE_H__
nexpaq 0:6c56fb4bc5f0 19
nexpaq 0:6c56fb4bc5f0 20 #include "UUID.h"
nexpaq 0:6c56fb4bc5f0 21 #include "GattAttribute.h"
nexpaq 0:6c56fb4bc5f0 22
nexpaq 0:6c56fb4bc5f0 23 /**@brief Type for holding information about the service and the characteristics found during
nexpaq 0:6c56fb4bc5f0 24 * the discovery process.
nexpaq 0:6c56fb4bc5f0 25 */
nexpaq 0:6c56fb4bc5f0 26 class DiscoveredService {
nexpaq 0:6c56fb4bc5f0 27 public:
nexpaq 0:6c56fb4bc5f0 28 /**
nexpaq 0:6c56fb4bc5f0 29 * Set information about the discovered service.
nexpaq 0:6c56fb4bc5f0 30 *
nexpaq 0:6c56fb4bc5f0 31 * @param[in] uuidIn
nexpaq 0:6c56fb4bc5f0 32 * The UUID of the discovered service.
nexpaq 0:6c56fb4bc5f0 33 * @param[in] startHandleIn
nexpaq 0:6c56fb4bc5f0 34 * The start handle of the discovered service in the peer's
nexpaq 0:6c56fb4bc5f0 35 * ATT table.
nexpaq 0:6c56fb4bc5f0 36 * @param[in] endHandleIn
nexpaq 0:6c56fb4bc5f0 37 * The end handle of the discovered service in the peer's
nexpaq 0:6c56fb4bc5f0 38 * ATT table.
nexpaq 0:6c56fb4bc5f0 39 */
nexpaq 0:6c56fb4bc5f0 40 void setup(UUID uuidIn, GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) {
nexpaq 0:6c56fb4bc5f0 41 uuid = uuidIn;
nexpaq 0:6c56fb4bc5f0 42 startHandle = startHandleIn;
nexpaq 0:6c56fb4bc5f0 43 endHandle = endHandleIn;
nexpaq 0:6c56fb4bc5f0 44 }
nexpaq 0:6c56fb4bc5f0 45
nexpaq 0:6c56fb4bc5f0 46 /**
nexpaq 0:6c56fb4bc5f0 47 * Set the start and end handle of the discovered service.
nexpaq 0:6c56fb4bc5f0 48 * @param[in] startHandleIn
nexpaq 0:6c56fb4bc5f0 49 * The start handle of the discovered service in the peer's
nexpaq 0:6c56fb4bc5f0 50 * ATT table.
nexpaq 0:6c56fb4bc5f0 51 * @param[in] endHandleIn
nexpaq 0:6c56fb4bc5f0 52 * The end handle of the discovered service in the peer's
nexpaq 0:6c56fb4bc5f0 53 * ATT table.
nexpaq 0:6c56fb4bc5f0 54 */
nexpaq 0:6c56fb4bc5f0 55 void setup(GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) {
nexpaq 0:6c56fb4bc5f0 56 startHandle = startHandleIn;
nexpaq 0:6c56fb4bc5f0 57 endHandle = endHandleIn;
nexpaq 0:6c56fb4bc5f0 58 }
nexpaq 0:6c56fb4bc5f0 59
nexpaq 0:6c56fb4bc5f0 60 /**
nexpaq 0:6c56fb4bc5f0 61 * Set the long UUID of the discovered service.
nexpaq 0:6c56fb4bc5f0 62 *
nexpaq 0:6c56fb4bc5f0 63 * @param[in] longUUID
nexpaq 0:6c56fb4bc5f0 64 * The long UUID of the discovered service.
nexpaq 0:6c56fb4bc5f0 65 * @param[in] order
nexpaq 0:6c56fb4bc5f0 66 * The byte ordering of @p longUUID.
nexpaq 0:6c56fb4bc5f0 67 */
nexpaq 0:6c56fb4bc5f0 68 void setupLongUUID(UUID::LongUUIDBytes_t longUUID, UUID::ByteOrder_t order = UUID::MSB) {
nexpaq 0:6c56fb4bc5f0 69 uuid.setupLong(longUUID, order);
nexpaq 0:6c56fb4bc5f0 70 }
nexpaq 0:6c56fb4bc5f0 71
nexpaq 0:6c56fb4bc5f0 72 public:
nexpaq 0:6c56fb4bc5f0 73 /**
nexpaq 0:6c56fb4bc5f0 74 * Get the UUID of the discovered service.
nexpaq 0:6c56fb4bc5f0 75 *
nexpaq 0:6c56fb4bc5f0 76 * @return A reference to the UUID of the discovered service.
nexpaq 0:6c56fb4bc5f0 77 */
nexpaq 0:6c56fb4bc5f0 78 const UUID &getUUID(void) const {
nexpaq 0:6c56fb4bc5f0 79 return uuid;
nexpaq 0:6c56fb4bc5f0 80 }
nexpaq 0:6c56fb4bc5f0 81
nexpaq 0:6c56fb4bc5f0 82 /**
nexpaq 0:6c56fb4bc5f0 83 * Get the start handle of the discovered service in the peer's ATT table.
nexpaq 0:6c56fb4bc5f0 84 *
nexpaq 0:6c56fb4bc5f0 85 * @return A reference to the start handle.
nexpaq 0:6c56fb4bc5f0 86 */
nexpaq 0:6c56fb4bc5f0 87 const GattAttribute::Handle_t& getStartHandle(void) const {
nexpaq 0:6c56fb4bc5f0 88 return startHandle;
nexpaq 0:6c56fb4bc5f0 89 }
nexpaq 0:6c56fb4bc5f0 90
nexpaq 0:6c56fb4bc5f0 91 /**
nexpaq 0:6c56fb4bc5f0 92 * Get the end handle of the discovered service in the peer's ATT table.
nexpaq 0:6c56fb4bc5f0 93 *
nexpaq 0:6c56fb4bc5f0 94 * @return A reference to the end handle.
nexpaq 0:6c56fb4bc5f0 95 */
nexpaq 0:6c56fb4bc5f0 96 const GattAttribute::Handle_t& getEndHandle(void) const {
nexpaq 0:6c56fb4bc5f0 97 return endHandle;
nexpaq 0:6c56fb4bc5f0 98 }
nexpaq 0:6c56fb4bc5f0 99
nexpaq 0:6c56fb4bc5f0 100 public:
nexpaq 0:6c56fb4bc5f0 101 /**
nexpaq 0:6c56fb4bc5f0 102 * Construct a DiscoveredService instance.
nexpaq 0:6c56fb4bc5f0 103 */
nexpaq 0:6c56fb4bc5f0 104 DiscoveredService() : uuid(UUID::ShortUUIDBytes_t(0)),
nexpaq 0:6c56fb4bc5f0 105 startHandle(GattAttribute::INVALID_HANDLE),
nexpaq 0:6c56fb4bc5f0 106 endHandle(GattAttribute::INVALID_HANDLE) {
nexpaq 0:6c56fb4bc5f0 107 /* empty */
nexpaq 0:6c56fb4bc5f0 108 }
nexpaq 0:6c56fb4bc5f0 109
nexpaq 0:6c56fb4bc5f0 110 private:
nexpaq 0:6c56fb4bc5f0 111 DiscoveredService(const DiscoveredService &);
nexpaq 0:6c56fb4bc5f0 112
nexpaq 0:6c56fb4bc5f0 113 private:
nexpaq 0:6c56fb4bc5f0 114 UUID uuid; /**< UUID of the service. */
nexpaq 0:6c56fb4bc5f0 115 GattAttribute::Handle_t startHandle; /**< Service Handle Range. */
nexpaq 0:6c56fb4bc5f0 116 GattAttribute::Handle_t endHandle; /**< Service Handle Range. */
nexpaq 0:6c56fb4bc5f0 117 };
nexpaq 0:6c56fb4bc5f0 118
nexpaq 0:6c56fb4bc5f0 119 #endif /*__DISCOVERED_SERVICE_H__*/