📄 defaults.h
字号:
// ----------------------------------------------------------------------------// Copyright 2006-2007, Martin D. Flynn// All rights reserved// ----------------------------------------------------------------------------//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// // http://www.apache.org/licenses/LICENSE-2.0// // Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.//// ----------------------------------------------------------------------------// This OpenDMTP reference implementation is aware of the following targets:// TARGET_LINUX - Generic Linux platform// TARGET_GUMSTIX - Gumstix platform// TARGET_CYGWIN - Windows Cygwin platform// TARGET_WINCE - Windows CE// TARGET_WINCE_PHONE - Windows CE/Mobile phones (eg. HP hw6945)// ----------------------------------------------------------------------------// Change History:// 2006/03/26 Martin D. Flynn// -Changed default accountId/deviceId to "opendmtp"/"mobile".// 2007/01/28 Martin D. Flynn// -Include many changes facilitating port to WindowsCE// -Define RELEASE_VERSION, PROTOCOL_VERSION// 2007/02/08 Martin D. Flynn// -Included DMTP_EXPERIMENTAL compile time var to allow supporting experimental// DMTP implementations.// ----------------------------------------------------------------------------#ifndef _DEFAULTS_H#define _DEFAULTS_H#ifdef __cplusplusextern "C" {#endif// ----------------------------------------------------------------------------// if a WINCE sub-target is defined, make sure TARGET_WINCE is also defined#if defined(TARGET_WINCE_PHONE) && !defined(TARGET_WINCE)# define TARGET_WINCE#endif// ----------------------------------------------------------------------------// this value should mirror the release version of the reference implementation#define BUILD_VERSION ""#define RELEASE_VERSION "1.2.3" BUILD_VERSION// This value should reflect the latest supported version of the protocol document#define PROTOCOL_VERSION "0,2,2" // must have comma separators!// Copyright (Must be <= 31 bytes) |----+----1----+----2----+----3-|#define COPYRIGHT "Copyright 2007, Martin D. Flynn"// Application name/description#if !defined(APPLICATION_NAME)# define APPLICATION_NAME "OpenDMTP"#endif#if !defined(APPLICATION_DESCRIPTION)# define APPLICATION_DESCRIPTION "OpenDMTP protocol reference implementation."#endif#if !defined(SYSLOG_NAME)# define SYSLOG_NAME "dmtpd"#endif// ----------------------------------------------------------------------------// Uncomment when compiling for debug testing purposed only//#define DEBUG_COMPILE// ----------------------------------------------------------------------------// 'ENABLE' directives.// Uncomment the following '#define's to enable these features://#define ENABLE_SET_TIME // setting the current processor clock time//#define ENABLE_REBOOT // device rebooting//#define ENABLE_UPLOAD // uploading files from server to device//#define ENABLE_GEOZONE // geofence checking//#define ENABLE_GUI // user interface (requires support)// ------------------------------------// WindowsCE directives// All WindowsCE platforms#if defined(TARGET_WINCE)# define PROTOCOL_THREAD# define GPS_THREAD#endif// WindowsCE phone platform only#if defined(TARGET_WINCE_PHONE)# define TRANSPORT_MEDIA_SOCKET# define ENABLE_GUI#endif// ------------------------------------// Gumstix directives#if defined(TARGET_GUMSTIX)# define ENABLE_GEOZONE# define ENABLE_REBOOT# define ENABLE_UPLOAD# define ENABLE_SET_TIME#endif// ------------------------------------// Windows Cygwin#if defined(TARGET_CYGWIN)# define ENABLE_GEOZONE#endif// ------------------------------------// Generic Linux Directives#if defined(TARGET_LINUX)# define ENABLE_GEOZONE#endif// ----------------------------------------------------------------------------// Identification constants/* file transport IDs */#if defined(TRANSPORT_MEDIA_FILE)# define ACCOUNT_ID ""# define DEVICE_ID ""#endif/* serial/bluetooth transport IDs */#if defined(TRANSPORT_MEDIA_SERIAL)# define ACCOUNT_ID ""# define DEVICE_ID ""#endif/* default IDs */#if !defined(UNIQUE_ID)# define UNIQUE_ID { 0x00 } // (invalid ID) length must be >= 4 to be valid#endif#if !defined(ACCOUNT_ID)# define ACCOUNT_ID "opendmtp"#endif#if !defined(DEVICE_ID)# define DEVICE_ID "mobile"#endif// ----------------------------------------------------------------------------// 1, and only 1 of the following must be defined:// - TRANSPORT_MEDIA_SOCKET // - When communicating over a socket// - May use other additional means to establish a socket connection// - TRANSPORT_MEDIA_FILE// - When writing to a file// - "Simplex" type comunication only// - No connection accounting is used// - TRANSPORT_MEDIA_SERIAL// - When communicating over a Serial port (incl Bluetooth)// - "Duplex" type comunication only// - No connection accounting is used// - TRANSPORT_MEDIA_GPRS// - When communicating over a GPRS modem (AT-command based)// - Requires that the GPRS modem supports TCP/UDP socket connection commands.#if defined(TRANSPORT_MEDIA_SOCKET)#elif defined(TRANSPORT_MEDIA_FILE)#elif defined(TRANSPORT_MEDIA_SERIAL)#elif defined(TRANSPORT_MEDIA_GPRS)#else// uncomment the appropriate transport (or define elsewhere)//#define TRANSPORT_MEDIA_SOCKET//#define TRANSPORT_MEDIA_FILE//#define TRANSPORT_MEDIA_SERIAL//#define TRANSPORT_MEDIA_GPRS#endif// If desired, the transport media can instead be defined in the Makefile by including// the string -DTRANSPORT_MEDIA_SOCKET (for example) as a compile-time flag.// On the GumStix platform, to store the file on the SD flash, change to filename// directory reference the location of the SD flash.// For instance "/mnt/mmc/sample.gps"//#if defined(TRANSPORT_MEDIA_FILE)//# if defined(TARGET_GUMSTIX)//# define TRANSPORT_MEDIA_FILE_NAME ("/mnt/mmc/" TRANSPORT_MEDIA_FILE)//# else//# define TRANSPORT_MEDIA_FILE_NAME ("./" TRANSPORT_MEDIA_FILE)//# endif//#endif// ----------------------------------------------------------------------------// Check to see that TRANSPORT_MEDIA_xxxxxx has been properly defined#if defined(TRANSPORT_MEDIA_NONE)# define XP_NONE_ 1#endif#if defined(TRANSPORT_MEDIA_SOCKET)# define XP_SOCK_ 1#endif#if defined(TRANSPORT_MEDIA_FILE)# define XP_FILE_ 1#endif#if defined(TRANSPORT_MEDIA_SERIAL)# define XP_SER_ 1#endif#if defined(TRANSPORT_MEDIA_GPRS)# define XP_GPRS_ 1#endif#if !defined(SKIP_TRANSPORT_MEDIA_CHECK)// at least 1 TRANSPORT_MEDIA_xxxxx must be defined# if ((XP_NONE_ + XP_SOCK_ + XP_FILE_ + XP_SER_ + XP_GPRS_ + XP_GS_ + XP_LIB_) == 0)# error TRANSPORT_MEDIA_xxxxxx is not defined!# endif// at most 1 TRANSPORT_MEDIA_xxxxx must be defined# if ((XP_NONE_ + XP_SOCK_ + XP_FILE_ + XP_SER_ + XP_GPRS_ + XP_GS_ + XP_LIB_) > 1)# error TRANSPORT_MEDIA_xxxxxx is defined more than once (only one transport media type is allowed)!# endif#endif// ----------------------------------------------------------------------------// Packet/PacketQueue configuration/* set Packet payload configuration */// set to maximum number of separate fields used in packets (should be at least 10)#define PACKET_MAX_FIELD_COUNT 16// set to maximum size of largest possible payload (must be at least 32, but no larger than 255)#define PACKET_MAX_PAYLOAD_LENGTH 255 // (binary packet size)/* maximum size of cached events */#if !defined(EVENT_QUEUE_SIZE) && defined(TARGET_WINCE_PHONE)# define EVENT_QUEUE_SIZE 100 // limit memory use on phone#endif#if !defined(EVENT_QUEUE_SIZE) && defined(TRANSPORT_MEDIA_SERIAL)# define EVENT_QUEUE_SIZE 5000 // serial transport (probably can be larger)#endif#if !defined(EVENT_QUEUE_SIZE)# define EVENT_QUEUE_SIZE 5000 // default max cached events#endif#define EVENT_QUEUE_OVERWRITE utTrue // overwrite unsent events when queue is full?/* protocol volatile & pending queue sizes */// there's probably never more that 5 or so volatile packets#define PRIMARY_VOLATILE_QUEUE_SIZE 15 // max volatile packets (primary)#define PRIMARY_PENDING_QUEUE_SIZE 20 // max pending packets (primary)#define SECONDARY_VOLATILE_QUEUE_SIZE 10 // max volatile packets (secondary)#define SECONDARY_PENDING_QUEUE_SIZE 10 // max pending packets (secondary)#define SECONDARY_EVENT_QUEUE_SIZE 10 // max event packets (secondary)// ----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -