1
0
Fork 0
OpenLCP/protocol/otp/otp.h

75 lines
3.5 KiB
C++

/*
otp.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include <cstdint>
namespace OTP {
static const uint8_t OTP_PACKET_IDENTIFIER[] = { 0x4f, 0x54, 0x50, 0x2d,
0x45, 0x31, 0x2e, 0x35,
0x39, 0x00, 0x00, 0x00 };
/// Appendix A: Defined Parameters
/// Table A-1: Vector Defines
/// Layer: OTP
static const uint16_t VECTOR_OTP_TRANSFORM_MESSAGE = 0x0001;
static const uint16_t VECTOR_OTP_ADVERTISEMENT_MESSAGE = 0x0002;
/// Layer: OTP Transform
static const uint16_t VECTOR_OTP_POINT = 0x0001;
/// Layer: OTP Point
static const uint16_t VECTOR_OTP_MODULE = 0x0001;
/// Layer: OTP Advertisement
static const uint16_t VECTOR_OTP_ADVERTISEMENT_MODULE = 0x0001;
static const uint16_t VECTOR_OTP_ADVERTISEMENT_NAME = 0x0002;
static const uint16_t VECTOR_OTP_ADVERTISEMENT_SYSTEM = 0x0003;
/// Layer: OTP Module Advertisement
static const uint16_t VECTOR_OTP_ADVERTISEMENT_MODULE_LIST = 0x0001;
/// Layer: OTP Name Advertisement
static const uint16_t VECTOR_OTP_ADVERTISEMENT_NAME_LIST = 0x0001;
/// Layer: OTP System Advertisement
static const uint16_t VECTOR_OTP_ADVERTISEMENT_SYSTEM_LIST = 0x0001;
/// Table A-2: Timing Defines
/// Message: OTP Transform
static const uint8_t OTP_TRANSFORM_TIMING_MIN = 1; //!< millisecond
static const uint8_t OTP_TRANSFORM_TIMING_MAX = 50; //!< millisecond
static const uint16_t OTP_TRANSFORM_FULL_POINT_SET_TIMING_MIN = 2800; //!< millisecond
static const uint16_t OTP_TRANSFORM_FULL_POINT_SET_TIMING_MAX = 3000; //!< millisecond
static const uint16_t OTP_TRANSFORM_DATA_LOSS_TIMEOUT = 7500; //!< millisecond
/// Message: OTP Module Advertisement
static const uint8_t OTP_ADVERTISEMENT_TIMING = 10; //!< seconds
static const uint8_t OTP_ADVERTISEMENT_STARTUP_WAIT = 12; //!< seconds
static const uint8_t OTP_ADVERTISEMENT_TIMEOUT = 30; //!< seconds
/// Message: OTP Name Advertisement
static const uint8_t OTP_NAME_ADVERTISEMENT_MAX_BACKOFF = 5; //!< seconds
/// Message: OTP System Advertisement
static const uint8_t OTP_SYSTEM_ADVERTISEMENT_MAX_BACKOFF = 5; //!< seconds
/// Table A-3: Additional Defines
static const uint16_t OTP_PORT = 5568;
static const uint16_t ESTA_MANUFACTURER_ID = 0x0000;
} // namespace OTP