Issue 2 move folders and use deep path include file names to prevent collisions (#4)

* moving folders and files and adjust server demo build

* Fix Makefile for apps/server on Linux

* fix unit test source file folders

* fix datetime convert UTC functions. Add Code::Blocks project for datetime testing

* added some ignore extensions

* disable parallel make option

* fix build for abort, dcc, and epics apps

* fix build for dcc, epics, error, and getevent apps.

* Fixed building of all apps

* fix the ipv4 to ipv6 router app build

* Change indent style from Google to Webkit

* make pretty to re-format style

* removed common Makefile since we already had one and two was too many

* remove scripts from root folder that are no longer maintained or used

* remove mercurial EOL and ignore files for git repo

* remove .vscodeconfig files from repo

* tweak clang-format style

* clang-format src and apps with tweaked style

* added clang-tidy to fix readability if braces in src

* result of make tidy for src and apps

* fix clang-tidy mangling

* Added code::blocks project for BACnet server simulation

* added code::blocks linux project for WhoIs app

* update text files for EOL

* fix EOL in some files

* fixed make win32 apps for older gcc

* Removed Borland C++ Makefile in apps. Unable to maintain support for Borland C++ compiler.

* created codeblocks project for apps/epics for Windows

* fixing ports/xplained to work with new data structure.

* fix ports/xplained example for Atmel Studio compile

* fix ports/stm32f10x example for gcc Makefile compile

* fix ports/stm32f10x example for IAR EWARM compile

* fix ports/xplained timer callback

* fix ports/bdk_atxx_mspt build with subdirs

* fix ports/bdk_atxx_mspt build with subdirs

* updated git ignore for IAR build artifacts

* updated gitignore for non-tracked files and folders

* fixed bdk-atxx4-mstp port for Rowley Crossworks project file

* fixed bdk-atxx4-mstp port for GCC AVR Makefile

* fixed atmega168 port for IAR AVR and GCC AVR Makefile

* fixed at91sam7s port for IAR ARM and GCC ARM Makefile

* removed unmaintainable DOS, RTOS32, and atmega8 ports.  Updated rx62n (untested).

* changed arm7 to uip port
This commit is contained in:
Steve Karg
2019-12-13 15:19:10 -06:00
committed by GitHub
parent 8a38dbe2cf
commit d50c190957
912 changed files with 36206 additions and 52502 deletions
+274
View File
@@ -0,0 +1,274 @@
/**************************************************************************
*
* Copyright (C) 2012 Steve Karg <skarg@users.sourceforge.net>
*
* 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.
*********************************************************************/
#ifndef DATE_TIME_H
#define DATE_TIME_H
#include <stdint.h>
#include <stdbool.h>
typedef enum BACnet_Weekday {
BACNET_WEEKDAY_MONDAY = 1,
BACNET_WEEKDAY_TUESDAY = 2,
BACNET_WEEKDAY_WEDNESDAY = 3,
BACNET_WEEKDAY_THURSDAY = 4,
BACNET_WEEKDAY_FRIDAY = 5,
BACNET_WEEKDAY_SATURDAY = 6,
BACNET_WEEKDAY_SUNDAY = 7
} BACNET_WEEKDAY;
/* date */
typedef struct BACnet_Date {
uint16_t year; /* AD */
uint8_t month; /* 1=Jan */
uint8_t day; /* 1..31 */
uint8_t wday; /* 1=Monday-7=Sunday */
} BACNET_DATE;
/* time */
typedef struct BACnet_Time {
uint8_t hour;
uint8_t min;
uint8_t sec;
uint8_t hundredths;
} BACNET_TIME;
typedef struct BACnet_DateTime {
BACNET_DATE date;
BACNET_TIME time;
} BACNET_DATE_TIME;
/* range of dates */
typedef struct BACnet_Date_Range {
BACNET_DATE startdate;
BACNET_DATE enddate;
} BACNET_DATE_RANGE;
/* week and days */
typedef struct BACnet_Weeknday {
uint8_t month; /* 1=Jan 13=odd 14=even FF=any */
uint8_t weekofmonth; /* 1=days 1-7, 2=days 8-14, 3=days 15-21, 4=days 22-28, 5=days 29-31, 6=last 7 days, FF=any week */
uint8_t dayofweek; /* 1=Monday-7=Sunday, FF=any */
} BACNET_WEEKNDAY;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* utility initialization functions */
void datetime_set_date(
BACNET_DATE * bdate,
uint16_t year,
uint8_t month,
uint8_t day);
void datetime_set_time(
BACNET_TIME * btime,
uint8_t hour,
uint8_t minute,
uint8_t seconds,
uint8_t hundredths);
void datetime_set(
BACNET_DATE_TIME * bdatetime,
BACNET_DATE * bdate,
BACNET_TIME * btime);
void datetime_set_values(
BACNET_DATE_TIME * bdatetime,
uint16_t year,
uint8_t month,
uint8_t day,
uint8_t hour,
uint8_t minute,
uint8_t seconds,
uint8_t hundredths);
/* utility test for validity */
bool datetime_is_valid(
BACNET_DATE * bdate,
BACNET_TIME * btime);
bool datetime_time_is_valid(
BACNET_TIME * btime);
bool datetime_date_is_valid(
BACNET_DATE * bdate);
/* date and time calculations and summaries */
uint32_t datetime_days_since_epoch(
BACNET_DATE * bdate);
void datetime_days_since_epoch_into_date(
uint32_t days,
BACNET_DATE * bdate);
uint32_t datetime_day_of_year(
BACNET_DATE *bdate);
void datetime_day_of_year_into_date(
uint32_t days,
uint16_t year,
BACNET_DATE *bdate);
bool datetime_is_leap_year(
uint16_t year);
uint8_t datetime_month_days(
uint16_t year,
uint8_t month);
uint8_t datetime_day_of_week(
uint16_t year,
uint8_t month,
uint8_t day);
bool datetime_ymd_is_valid(
uint16_t year,
uint8_t month,
uint8_t day);
uint32_t datetime_seconds_since_midnight(
BACNET_TIME * btime);
uint16_t datetime_minutes_since_midnight(
BACNET_TIME * btime);
/* utility comparison functions:
if the date/times are the same, return is 0
if date1 is before date2, returns negative
if date1 is after date2, returns positive */
int datetime_compare_date(
BACNET_DATE * date1,
BACNET_DATE * date2);
int datetime_compare_time(
BACNET_TIME * time1,
BACNET_TIME * time2);
int datetime_compare(
BACNET_DATE_TIME * datetime1,
BACNET_DATE_TIME * datetime2);
/* full comparison functions:
* taking into account FF fields in date and time structures,
* do a full comparison of two values */
int datetime_wildcard_compare_date(
BACNET_DATE * date1,
BACNET_DATE * date2);
int datetime_wildcard_compare_time(
BACNET_TIME * time1,
BACNET_TIME * time2);
int datetime_wildcard_compare(
BACNET_DATE_TIME * datetime1,
BACNET_DATE_TIME * datetime2);
/* utility copy functions */
void datetime_copy_date(
BACNET_DATE * dest,
BACNET_DATE * src);
void datetime_copy_time(
BACNET_TIME * dest,
BACNET_TIME * src);
void datetime_copy(
BACNET_DATE_TIME * dest,
BACNET_DATE_TIME * src);
/* utility add or subtract minutes function */
void datetime_add_minutes(
BACNET_DATE_TIME * bdatetime,
int32_t minutes);
/* date and time wildcards */
bool datetime_wildcard_year(
BACNET_DATE *bdate);
void datetime_wildcard_year_set(
BACNET_DATE *bdate);
bool datetime_wildcard_month(
BACNET_DATE *bdate);
void datetime_wildcard_month_set(
BACNET_DATE *bdate);
bool datetime_wildcard_day(
BACNET_DATE *bdate);
void datetime_wildcard_day_set(
BACNET_DATE *bdate);
bool datetime_wildcard_weekday(
BACNET_DATE *bdate);
void datetime_wildcard_weekday_set(
BACNET_DATE *bdate);
bool datetime_wildcard_hour(
BACNET_TIME *btime);
void datetime_wildcard_hour_set(
BACNET_TIME *btime);
bool datetime_wildcard_minute(
BACNET_TIME *btime);
void datetime_wildcard_minute_set(
BACNET_TIME *btime);
bool datetime_wildcard_second(
BACNET_TIME *btime);
void datetime_wildcard_second_set(
BACNET_TIME *btime);
bool datetime_wildcard_hundredths(
BACNET_TIME *btime);
void datetime_wildcard_hundredths_set(
BACNET_TIME *btime);
bool datetime_wildcard(
BACNET_DATE_TIME * bdatetime);
bool datetime_wildcard_present(
BACNET_DATE_TIME * bdatetime);
void datetime_wildcard_set(
BACNET_DATE_TIME * bdatetime);
void datetime_date_wildcard_set(
BACNET_DATE * bdate);
void datetime_time_wildcard_set(
BACNET_TIME * btime);
bool datetime_local_to_utc(
BACNET_DATE_TIME * utc_time,
BACNET_DATE_TIME * local_time,
int16_t utc_offset_minutes,
int8_t dst_adjust_minutes);
bool datetime_utc_to_local(
BACNET_DATE_TIME * local_time,
BACNET_DATE_TIME * utc_time,
int16_t utc_offset_minutes,
int8_t dst_adjust_minutes);
int bacapp_encode_datetime(
uint8_t * apdu,
BACNET_DATE_TIME * value);
int bacapp_encode_context_datetime(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE_TIME * value);
int bacapp_decode_datetime(
uint8_t * apdu,
BACNET_DATE_TIME * value);
int bacapp_decode_context_datetime(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE_TIME * value);
/* implementation agnostic functions - create your own! */
bool datetime_local(
BACNET_DATE * bdate,
BACNET_TIME * btime,
int16_t * utc_offset_minutes,
bool * dst_active);
void datetime_init(void);
#ifdef TEST
#include "ctest.h"
void testDateTime(
Test * pTest);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* DATE_TIME_H */