Added datetime module to demo applications.
This commit is contained in:
@@ -277,10 +277,10 @@ bool bacapp_copy(BACNET_APPLICATION_DATA_VALUE * dest_value,
|
|||||||
dest_value->type.Enumerated = src_value->type.Enumerated;
|
dest_value->type.Enumerated = src_value->type.Enumerated;
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_DATE:
|
case BACNET_APPLICATION_TAG_DATE:
|
||||||
bacapp_copy_date(&dest_value->type.Date, &src_value->type.Date);
|
datetime_copy_date(&dest_value->type.Date, &src_value->type.Date);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_TIME:
|
case BACNET_APPLICATION_TAG_TIME:
|
||||||
bacapp_copy_time(&dest_value->type.Time, &src_value->type.Time);
|
datetime_copy_time(&dest_value->type.Time, &src_value->type.Time);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||||
dest_value->type.Object_Id.type =
|
dest_value->type.Object_Id.type =
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "bacdef.h"
|
#include "bacdef.h"
|
||||||
#include "bacstr.h"
|
#include "bacstr.h"
|
||||||
|
#include "datetime.h"
|
||||||
|
|
||||||
typedef struct BACnet_Application_Data_Value {
|
typedef struct BACnet_Application_Data_Value {
|
||||||
uint8_t tag; /* application or context-specific number */
|
uint8_t tag; /* application or context-specific number */
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "bacdef.h"
|
#include "bacdef.h"
|
||||||
|
#include "datetime.h"
|
||||||
#include "bacstr.h"
|
#include "bacstr.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ void testBACnetDateTime(Test * pTest)
|
|||||||
ct_test(pTest, diff == 0);
|
ct_test(pTest, diff == 0);
|
||||||
|
|
||||||
/* midpoint */
|
/* midpoint */
|
||||||
|
/* if datetime1 is before datetime2, returns negative */
|
||||||
datetime_set_values(&bdatetime1, 2000,7,15,12,30,30,50);
|
datetime_set_values(&bdatetime1, 2000,7,15,12,30,30,50);
|
||||||
datetime_set_values(&bdatetime2, 2000,7,15,12,30,30,51);
|
datetime_set_values(&bdatetime2, 2000,7,15,12,30,30,51);
|
||||||
diff = datetime_compare(&bdatetime1, &bdatetime2);
|
diff = datetime_compare(&bdatetime1, &bdatetime2);
|
||||||
|
|||||||
+11
-10
@@ -63,14 +63,14 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/* utility initialization functions */
|
/* utility initialization functions */
|
||||||
void bacapp_set_date(BACNET_DATE * bdate,
|
void datetime_set_date(BACNET_DATE * bdate,
|
||||||
uint16_t year, uint8_t month, uint8_t day);
|
uint16_t year, uint8_t month, uint8_t day);
|
||||||
void bacapp_set_time(BACNET_TIME * btime,
|
void datetime_set_time(BACNET_TIME * btime,
|
||||||
uint8_t hour, uint8_t minute, uint8_t seconds, uint8_t hundredths);
|
uint8_t hour, uint8_t minute, uint8_t seconds, uint8_t hundredths);
|
||||||
void bacapp_set_datetime(BACNET_DATE_TIME * bdatetime,
|
void datetime_set_datetime(BACNET_DATE_TIME * bdatetime,
|
||||||
BACNET_DATE * bdate,
|
BACNET_DATE * bdate,
|
||||||
BACNET_TIME * btime);
|
BACNET_TIME * btime);
|
||||||
void bacapp_set_datetime_values(BACNET_DATE_TIME * bdatetime,
|
void datetime_set_datetime_values(BACNET_DATE_TIME * bdatetime,
|
||||||
uint16_t year, uint8_t month, uint8_t day,
|
uint16_t year, uint8_t month, uint8_t day,
|
||||||
uint8_t hour, uint8_t minute, uint8_t seconds, uint8_t hundredths);
|
uint8_t hour, uint8_t minute, uint8_t seconds, uint8_t hundredths);
|
||||||
|
|
||||||
@@ -78,16 +78,16 @@ extern "C" {
|
|||||||
if the date/times are the same, return is 0
|
if the date/times are the same, return is 0
|
||||||
if date1 is before date2, returns negative
|
if date1 is before date2, returns negative
|
||||||
if date1 is after date2, returns positive */
|
if date1 is after date2, returns positive */
|
||||||
int bacapp_date_compare(BACNET_DATE * date1, BACNET_DATE * date2);
|
int datetime_date_compare(BACNET_DATE * date1, BACNET_DATE * date2);
|
||||||
int bacapp_time_compare(BACNET_TIME * time1, BACNET_TIME * time2);
|
int datetime_time_compare(BACNET_TIME * time1, BACNET_TIME * time2);
|
||||||
int bacapp_datetime_compare(
|
int datetime_datetime_compare(
|
||||||
BACNET_DATE_TIME * datetime1,
|
BACNET_DATE_TIME * datetime1,
|
||||||
BACNET_DATE_TIME * datetime2);
|
BACNET_DATE_TIME * datetime2);
|
||||||
|
|
||||||
/* utility copy functions */
|
/* utility copy functions */
|
||||||
void bacapp_copy_date(BACNET_DATE * date1, BACNET_DATE * date2);
|
void datetime_copy_date(BACNET_DATE * date1, BACNET_DATE * date2);
|
||||||
void bacapp_copy_time(BACNET_TIME * time1, BACNET_TIME * time2);
|
void datetime_copy_time(BACNET_TIME * time1, BACNET_TIME * time2);
|
||||||
void bacapp_copy_datetime(
|
void datetime_copy_datetime(
|
||||||
BACNET_DATE_TIME * datetime1,
|
BACNET_DATE_TIME * datetime1,
|
||||||
BACNET_DATE_TIME * datetime2);
|
BACNET_DATE_TIME * datetime2);
|
||||||
|
|
||||||
@@ -96,3 +96,4 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* DATETIME_H */
|
#endif /* DATETIME_H */
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ SRCS = main.c \
|
|||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
..\..\whois.c \
|
..\..\whois.c \
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
$(BACNET_ROOT)/iam.c \
|
$(BACNET_ROOT)/iam.c \
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ SRCS = main.c \
|
|||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\filename.c \
|
..\..\filename.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
..\..\whois.c \
|
..\..\whois.c \
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ SRCS = readprop.c \
|
|||||||
$(BACNET_ROOT)/bacdcode.c \
|
$(BACNET_ROOT)/bacdcode.c \
|
||||||
$(BACNET_ROOT)/bacapp.c \
|
$(BACNET_ROOT)/bacapp.c \
|
||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ SRCS = readprop.c \
|
|||||||
..\..\bacdcode.c \
|
..\..\bacdcode.c \
|
||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ SRCS = main.c \
|
|||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
..\..\whois.c \
|
..\..\whois.c \
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ SRCS = main.c \
|
|||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
..\..\whois.c \
|
..\..\whois.c \
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ SRCS = main.c \
|
|||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
..\..\whois.c \
|
..\..\whois.c \
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
$(BACNET_ROOT)/iam.c \
|
$(BACNET_ROOT)/iam.c \
|
||||||
$(BACNET_ROOT)/whohas.c \
|
$(BACNET_ROOT)/whohas.c \
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ SRCS = main.c \
|
|||||||
$(BACNET_ROOT)\bacstr.c \
|
$(BACNET_ROOT)\bacstr.c \
|
||||||
$(BACNET_ROOT)\bactext.c \
|
$(BACNET_ROOT)\bactext.c \
|
||||||
$(BACNET_ROOT)\indtext.c \
|
$(BACNET_ROOT)\indtext.c \
|
||||||
$(BACNET_ROOT)\bigend.c \
|
$(BACNET_ROOT)\datetime.c \
|
||||||
$(BACNET_ROOT)\whois.c \
|
$(BACNET_ROOT)\whois.c \
|
||||||
$(BACNET_ROOT)\iam.c \
|
$(BACNET_ROOT)\iam.c \
|
||||||
$(BACNET_ROOT)\whohas.c \
|
$(BACNET_ROOT)\whohas.c \
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ SRCS = writefile.c \
|
|||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/filename.c \
|
$(BACNET_ROOT)/filename.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ SRCS = writefile.c \
|
|||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\filename.c \
|
..\..\filename.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ SRCS = writeprop.c \
|
|||||||
$(BACNET_ROOT)/bacprop.c \
|
$(BACNET_ROOT)/bacprop.c \
|
||||||
$(BACNET_ROOT)/bacstr.c \
|
$(BACNET_ROOT)/bacstr.c \
|
||||||
$(BACNET_ROOT)/bactext.c \
|
$(BACNET_ROOT)/bactext.c \
|
||||||
|
$(BACNET_ROOT)/datetime.c \
|
||||||
$(BACNET_ROOT)/indtext.c \
|
$(BACNET_ROOT)/indtext.c \
|
||||||
$(BACNET_ROOT)/bigend.c \
|
$(BACNET_ROOT)/bigend.c \
|
||||||
$(BACNET_ROOT)/whois.c \
|
$(BACNET_ROOT)/whois.c \
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ SRCS = writeprop.c \
|
|||||||
..\..\bacapp.c \
|
..\..\bacapp.c \
|
||||||
..\..\bacstr.c \
|
..\..\bacstr.c \
|
||||||
..\..\bactext.c \
|
..\..\bactext.c \
|
||||||
|
..\..\datetime.c \
|
||||||
..\..\indtext.c \
|
..\..\indtext.c \
|
||||||
..\..\bigend.c \
|
..\..\bigend.c \
|
||||||
..\..\whois.c \
|
..\..\whois.c \
|
||||||
|
|||||||
Reference in New Issue
Block a user