Eddystone Beacon only for TYBLE16
Please refer flowing link.
/users/kenjiArai/notebook/tyble16-module-will-become-a-mbed-family--mbedliza/
Eddystone/URLFrame.h@0:5087fec653b2, 2018-02-25 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Feb 25 02:26:02 2018 +0000
- Revision:
- 0:5087fec653b2
Eddystone Beacon only for TYBLE16
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:5087fec653b2 | 1 | /* mbed Microcontroller Library |
kenjiArai | 0:5087fec653b2 | 2 | * Copyright (c) 2006-2015 ARM Limited |
kenjiArai | 0:5087fec653b2 | 3 | * |
kenjiArai | 0:5087fec653b2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kenjiArai | 0:5087fec653b2 | 5 | * you may not use this file except in compliance with the License. |
kenjiArai | 0:5087fec653b2 | 6 | * You may obtain a copy of the License at |
kenjiArai | 0:5087fec653b2 | 7 | * |
kenjiArai | 0:5087fec653b2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kenjiArai | 0:5087fec653b2 | 9 | * |
kenjiArai | 0:5087fec653b2 | 10 | * Unless required by applicable law or agreed to in writing, software |
kenjiArai | 0:5087fec653b2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kenjiArai | 0:5087fec653b2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kenjiArai | 0:5087fec653b2 | 13 | * See the License for the specific language governing permissions and |
kenjiArai | 0:5087fec653b2 | 14 | * limitations under the License. |
kenjiArai | 0:5087fec653b2 | 15 | */ |
kenjiArai | 0:5087fec653b2 | 16 | |
kenjiArai | 0:5087fec653b2 | 17 | #ifndef __URLFRAME_H__ |
kenjiArai | 0:5087fec653b2 | 18 | #define __URLFRAME_H__ |
kenjiArai | 0:5087fec653b2 | 19 | |
kenjiArai | 0:5087fec653b2 | 20 | #include "EddystoneTypes.h" |
kenjiArai | 0:5087fec653b2 | 21 | #include <string.h> |
kenjiArai | 0:5087fec653b2 | 22 | |
kenjiArai | 0:5087fec653b2 | 23 | class URLFrame |
kenjiArai | 0:5087fec653b2 | 24 | { |
kenjiArai | 0:5087fec653b2 | 25 | public: |
kenjiArai | 0:5087fec653b2 | 26 | URLFrame(void); |
kenjiArai | 0:5087fec653b2 | 27 | |
kenjiArai | 0:5087fec653b2 | 28 | URLFrame(const char *urlDataIn); |
kenjiArai | 0:5087fec653b2 | 29 | |
kenjiArai | 0:5087fec653b2 | 30 | URLFrame(UrlData_t urlDataIn, uint8_t urlDataLength); |
kenjiArai | 0:5087fec653b2 | 31 | |
kenjiArai | 0:5087fec653b2 | 32 | void constructURLFrame(uint8_t* rawFrame, int8_t advPowerLevel); |
kenjiArai | 0:5087fec653b2 | 33 | |
kenjiArai | 0:5087fec653b2 | 34 | size_t getRawFrameSize(void) const; |
kenjiArai | 0:5087fec653b2 | 35 | |
kenjiArai | 0:5087fec653b2 | 36 | uint8_t* getEncodedURLData(void); |
kenjiArai | 0:5087fec653b2 | 37 | |
kenjiArai | 0:5087fec653b2 | 38 | uint8_t getEncodedURLDataLength(void) const; |
kenjiArai | 0:5087fec653b2 | 39 | |
kenjiArai | 0:5087fec653b2 | 40 | void setURLData(const char *urlDataIn); |
kenjiArai | 0:5087fec653b2 | 41 | |
kenjiArai | 0:5087fec653b2 | 42 | void setEncodedURLData(const uint8_t* urlEncodedDataIn, const uint8_t urlEncodedDataLengthIn); |
kenjiArai | 0:5087fec653b2 | 43 | |
kenjiArai | 0:5087fec653b2 | 44 | private: |
kenjiArai | 0:5087fec653b2 | 45 | void encodeURL(const char *urlDataIn); |
kenjiArai | 0:5087fec653b2 | 46 | |
kenjiArai | 0:5087fec653b2 | 47 | static const uint8_t FRAME_TYPE_URL = 0x10; |
kenjiArai | 0:5087fec653b2 | 48 | /* Even if the URL is 0 bytes we still need to include the type and txPower i.e. 2 bytes */ |
kenjiArai | 0:5087fec653b2 | 49 | static const uint8_t FRAME_MIN_SIZE_URL = 2; |
kenjiArai | 0:5087fec653b2 | 50 | |
kenjiArai | 0:5087fec653b2 | 51 | uint8_t urlDataLength; |
kenjiArai | 0:5087fec653b2 | 52 | UrlData_t urlData; |
kenjiArai | 0:5087fec653b2 | 53 | |
kenjiArai | 0:5087fec653b2 | 54 | }; |
kenjiArai | 0:5087fec653b2 | 55 | |
kenjiArai | 0:5087fec653b2 | 56 | #endif /* __URLFRAME_H__ */ |