Digi XBee(R) ANSI C Host Library
zcl_time.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2012 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
12 
25 #ifndef __XBEE_ZCL_TIME_H
26 #define __XBEE_ZCL_TIME_H
27 
28 #include <time.h>
29 #include "zigbee/zcl.h"
30 
31 // macros for backward compatibility with old API
32 #include "xbee/time.h"
33 #define zcl_gmtime( tm, timestamp) xbee_gmtime( tm, timestamp)
34 #define zcl_mktime( tm) xbee_mktime( tm)
35 
37 
38 extern const zcl_attribute_tree_t zcl_time_attribute_tree[];
39 
44 #define ZCL_TIME_ATTR_TIME 0x0000
45 #define ZCL_TIME_ATTR_TIME_STATUS 0x0001
47 #define ZCL_TIME_ATTR_TIME_ZONE 0x0002
49 #define ZCL_TIME_ATTR_DST_START 0x0003
51 #define ZCL_TIME_ATTR_DST_END 0x0004
53 #define ZCL_TIME_ATTR_DST_SHIFT 0x0005
55 #define ZCL_TIME_ATTR_STANDARD_TIME 0x0006
57 #define ZCL_TIME_ATTR_LOCAL_TIME 0x0007
59 
74 #define ZCL_TIME_STATUS_MASTER 0x01
78 
82 #define ZCL_TIME_STATUS_SYNCHRONIZED 0x02
83 
87 #define ZCL_TIME_STATUS_MASTERZONEDST 0x04
88 
90 // what time is it?
91 zcl_utctime_t zcl_time_now( void);
92 
93 // processes Read Attribute Responses
94 int zcl_time_client( const wpan_envelope_t FAR *envelope,
95  void FAR *context);
96 
97 // initiate discovery of time servers
98 int zcl_time_find_servers( wpan_dev_t *dev, uint16_t profile_id);
99 
102 #define ZCL_CLUST_ENTRY_TIME_BOTH \
103  { ZCL_CLUST_TIME, \
104  &zcl_time_client, \
105  zcl_time_attribute_tree, \
106  WPAN_CLUST_FLAG_INOUT | WPAN_CLUST_FLAG_ENCRYPT }
107 
110 #define ZCL_CLUST_ENTRY_TIME_SERVER \
111  { ZCL_CLUST_TIME, \
112  &zcl_general_command, \
113  zcl_time_attribute_tree, \
114  WPAN_CLUST_FLAG_SERVER | WPAN_CLUST_FLAG_ENCRYPT }
115 
118 #define ZCL_CLUST_ENTRY_TIME_CLIENT \
119  { ZCL_CLUST_TIME, \
120  &zcl_time_client, \
121  zcl_attributes_none, \
122  WPAN_CLUST_FLAG_CLIENT | WPAN_CLUST_FLAG_ENCRYPT }
123 
125 
126 #ifdef __DC__
127  #use "zcl_time.c"
128 #endif
129 
130 #endif // __XBEE_ZCL_TIME_H
131 
int zcl_time_find_servers(wpan_dev_t *dev, uint16_t profile_id)
Find Time Servers on the network, query them for the current time and then synchronize this device&#39;s ...
Definition: zcl_time.c:427
int zcl_time_client(const wpan_envelope_t FAR *envelope, void FAR *context)
Handle Read Attribute Responses to requests sent as part of the zcl_time_find_servers() process...
Definition: zcl_time.c:291
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
zcl_utctime_t zcl_time_now(void)
Returns the current date/time, using the ZCL epoch of January 1, 2000.
Definition: zcl_time.c:246
Header for implementation of ZigBee Cluster Library.
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
Definition: zcl.h:854
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
The "envelope" is used to gather all necessary information about a given frame on the network...
Definition: aps.h:40
Structure used by the WPAN/ZigBee layers.
Definition: aps.h:390