Skip to content

Commit

Permalink
zboss: fix compile warnings
Browse files Browse the repository at this point in the history
Test PR to verify compile warning fixes.

Signed-off-by: Eduardo Montoya <[email protected]>
  • Loading branch information
edmont committed Mar 12, 2024
1 parent d6fee90 commit 58f8d25
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 182 deletions.
86 changes: 19 additions & 67 deletions zboss/production/include/zcl/zb_zcl_color_control.h
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
/*
* ZBOSS Zigbee 3.0
/* ZBOSS Zigbee software protocol stack
*
* Copyright (c) 2012-2024 DSR Corporation, Denver CO, USA.
* Copyright (c) 2012-2020 DSR Corporation, Denver CO, USA.
* www.dsr-zboss.com
* www.dsr-corporation.com
* All rights reserved.
*
* This is unpublished proprietary source code of DSR Corporation
* The copyright notice does not evidence any actual or intended
* publication of such source code.
*
* Use in source and binary forms, redistribution in binary form only, with
* or without modification, are permitted provided that the following conditions
* are met:
* ZBOSS is a registered trademark of Data Storage Research LLC d/b/a DSR
* Corporation
*
* 1. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 2. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 3. This software, with or without modification, must only be used with a Nordic
* Semiconductor ASA integrated circuit.
*
* 4. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Commercial Usage
* Licensees holding valid DSR Commercial licenses may use
* this file in accordance with the DSR Commercial License
* Agreement provided with the Software or, alternatively, in accordance
* with the terms contained in a written agreement between you and
* DSR.
*/
/* PURPOSE: Color control cluster definitions
*/
Expand Down Expand Up @@ -1322,9 +1303,8 @@ void zb_zcl_color_control_send_move_to_hue_req(zb_bufid_t buffer, const zb_addr_
(zb_zcl_color_control_move_to_hue_req_t*)zb_buf_begin(buffer) : NULL; \
if (move_to_hue_req_ptr != NULL) \
{ \
move_to_hue_req.hue = move_to_hue_req_ptr->hue; \
move_to_hue_req.direction = move_to_hue_req_ptr->direction; \
ZB_HTOLE16(&(move_to_hue_req).transition_time, &(move_to_hue_req_ptr->transition_time)); \
ZB_MEMCPY(&(move_to_hue_req), move_to_hue_req_ptr, ZB_ZCL_COLOR_CONTROL_MOVE_TO_HUE_REQ_PAYLOAD_LEN); \
ZB_HTOLE16_ONPLACE((move_to_hue_req).transition_time); \
(void)zb_buf_cut_left(buffer, ZB_ZCL_COLOR_CONTROL_MOVE_TO_HUE_REQ_PAYLOAD_LEN); \
status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
} \
Expand Down Expand Up @@ -3206,10 +3186,10 @@ void zb_zcl_color_control_send_move_color_temp_req(zb_bufid_t buffer, const zb_a
(zb_zcl_color_control_move_color_temp_req_t*)zb_buf_begin(buffer) : NULL; \
if (move_color_temp_req_ptr != NULL) \
{ \
move_color_temp_req.move_mode = move_color_temp_req_ptr->move_mode; \
ZB_HTOLE16(&(move_color_temp_req).rate, &(move_color_temp_req_ptr->rate)); \
ZB_HTOLE16(&(move_color_temp_req).color_temp_min, &(move_color_temp_req_ptr->color_temp_min)); \
ZB_HTOLE16(&(move_color_temp_req).color_temp_max, &(move_color_temp_req_ptr->color_temp_max)); \
ZB_MEMCPY(&(move_color_temp_req), move_color_temp_req_ptr, ZB_ZCL_COLOR_CONTROL_MOVE_COLOR_TEMP_REQ_PAYLOAD_LEN); \
ZB_HTOLE16_ONPLACE((move_color_temp_req).rate); \
ZB_HTOLE16_ONPLACE((move_color_temp_req).color_temp_min); \
ZB_HTOLE16_ONPLACE((move_color_temp_req).color_temp_max); \
(void)zb_buf_cut_left(buffer, ZB_ZCL_COLOR_CONTROL_MOVE_COLOR_TEMP_REQ_PAYLOAD_LEN); \
status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
} \
Expand Down Expand Up @@ -3319,34 +3299,6 @@ void zb_zcl_color_control_send_step_color_temp_req(zb_bufid_t buffer, const zb_a
dst_ep, ep, prfl_id, def_resp, cb, step_mode, step_size, transition_time, color_temp_min, color_temp_max); \
}

/** @brief Macro for getting Move color temperature command
* @attention Assumes that ZCL header already cut.
* @param buffer containing the packet (by pointer).
* @param move_color_temp_req - variable of type @ref
* zb_zcl_color_control_move_color_temp_req_s.
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
*/
#define ZB_ZCL_COLOR_CONTROL_GET_MOVE_COLOR_TEMP_REQ(buffer, move_color_temp_req, status) \
{ \
zb_zcl_color_control_move_color_temp_req_t *move_color_temp_req_ptr; \
(move_color_temp_req_ptr) = zb_buf_len(buffer) >= \
ZB_ZCL_COLOR_CONTROL_MOVE_COLOR_TEMP_REQ_PAYLOAD_LEN ? \
(zb_zcl_color_control_move_color_temp_req_t*)zb_buf_begin(buffer) : NULL; \
if (move_color_temp_req_ptr != NULL) \
{ \
move_color_temp_req.move_mode = move_color_temp_req_ptr->move_mode; \
ZB_HTOLE16(&(move_color_temp_req).rate, &(move_color_temp_req_ptr->rate)); \
ZB_HTOLE16(&(move_color_temp_req).color_temp_min, &(move_color_temp_req_ptr->color_temp_min)); \
ZB_HTOLE16(&(move_color_temp_req).color_temp_max, &(move_color_temp_req_ptr->color_temp_max)); \
(void)zb_buf_cut_left(buffer, ZB_ZCL_COLOR_CONTROL_MOVE_COLOR_TEMP_REQ_PAYLOAD_LEN); \
status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
} \
else \
{ \
status = ZB_ZCL_PARSE_STATUS_FAILURE; \
} \
}

/** @brief Macro for getting Move color temperature command
* @attention Assumes that ZCL header already cut.
* @param buffer containing the packet (by pointer).
Expand Down
74 changes: 29 additions & 45 deletions zboss/production/include/zcl/zb_zcl_wwah.h
Original file line number Diff line number Diff line change
@@ -1,51 +1,30 @@
/*
* ZBOSS Zigbee 3.0
/* ZBOSS Zigbee software protocol stack
*
* Copyright (c) 2012-2024 DSR Corporation, Denver CO, USA.
* Copyright (c) 2012-2020 DSR Corporation, Denver CO, USA.
* www.dsr-zboss.com
* www.dsr-corporation.com
* All rights reserved.
*
* This is unpublished proprietary source code of DSR Corporation
* The copyright notice does not evidence any actual or intended
* publication of such source code.
*
* Use in source and binary forms, redistribution in binary form only, with
* or without modification, are permitted provided that the following conditions
* are met:
* ZBOSS is a registered trademark of Data Storage Research LLC d/b/a DSR
* Corporation
*
* 1. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 2. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 3. This software, with or without modification, must only be used with a Nordic
* Semiconductor ASA integrated circuit.
*
* 4. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Commercial Usage
* Licensees holding valid DSR Commercial licenses may use
* this file in accordance with the DSR Commercial License
* Agreement provided with the Software or, alternatively, in accordance
* with the terms contained in a written agreement between you and
* DSR.
*/
/* PURPOSE: WWAH cluster definitions
*/

#ifndef ZB_ZCL_WWAH_H
#define ZB_ZCL_WWAH_H 1

#include <string.h>

#include "zcl/zb_zcl_common.h"
#include "zcl/zb_zcl_commands.h"

Expand Down Expand Up @@ -395,6 +374,8 @@ ZB_ASSERT_VALUE_ALIGNED_TO_4(ZB_ZCL_WWAH_APS_LINK_KEY_AUTHORIZATION_TABLE_SIZE *
#define ZB_ZCL_WWAH_USE_TRUST_CENTER_FOR_CLUSTER_TABLE_SIZE 4
ZB_ASSERT_VALUE_ALIGNED_TO_4(ZB_ZCL_WWAH_USE_TRUST_CENTER_FOR_CLUSTER_TABLE_SIZE * sizeof(zb_uint16_t));

#define ZB_ZCL_WWAH_CLUSTER_LIST_MAX_SIZE ZB_ZCL_WWAH_APS_ACK_EXEMPT_TABLE_SIZE

/** @brief WWAH Cluster arrays "record is free" flag */
#define ZB_ZCL_WWAH_CLUSTER_ID_FREE_RECORD 0xFFFF

Expand Down Expand Up @@ -643,12 +624,13 @@ typedef enum zb_zcl_wwah_behavior_e
(void*) data_ptr \
}

typedef ZB_PACKED_PRE struct zb_zcl_wwah_cluster_list_s
typedef struct zb_zcl_wwah_cluster_list_s
{
zb_uint8_t number_of_clusters; /**< Number of Clusters */
zb_uint16_t *cluster_id; /**< Cluster ID */
zb_uint8_t number_of_clusters; /**< Number of Clusters */
zb_uint8_t alignment[3]; /**< Alignment */
zb_uint16_t cluster_id[ZB_ZCL_WWAH_CLUSTER_LIST_MAX_SIZE]; /**< Cluster list */
}
ZB_PACKED_STRUCT zb_zcl_wwah_cluster_list_t;
zb_zcl_wwah_cluster_list_t;

/*!
@brief Parses various commands with cluster list variable length payload and fills data request structure.
Expand All @@ -660,19 +642,21 @@ ZB_PACKED_STRUCT zb_zcl_wwah_cluster_list_t;

#define ZB_ZCL_WWAH_GET_CLUSTER_LIST_CMD(data_buf, req, status) \
{ \
zb_zcl_wwah_cluster_list_t *src_ptr = (zb_zcl_wwah_cluster_list_t*)zb_buf_begin((data_buf)); \
zb_uint8_t *src_ptr = (zb_uint8_t*)zb_buf_begin((data_buf)); \
zb_uint8_t number_of_clusters = *src_ptr; \
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
if (zb_buf_len((data_buf)) >= sizeof(zb_uint8_t)) \
{ \
(req)->number_of_clusters = src_ptr->number_of_clusters; \
if (src_ptr->number_of_clusters) \
(req).number_of_clusters = number_of_clusters; \
if (number_of_clusters > 0) \
{ \
if (zb_buf_len((data_buf)) >= sizeof(zb_uint8_t) + \
src_ptr->number_of_clusters * sizeof(zb_uint16_t)) \
number_of_clusters * sizeof(zb_uint16_t)) \
{ \
zb_uint16_t cluster_id; \
memcpy(&cluster_id, &(src_ptr->cluster_id), sizeof(zb_uint16_t)); \
(req)->cluster_id = &cluster_id; \
ZB_MEMCPY( \
(zb_uint8_t*)((req).cluster_id), \
(src_ptr + 1), \
number_of_clusters * sizeof(zb_uint16_t)); \
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
} \
} \
Expand Down
Loading

0 comments on commit 58f8d25

Please sign in to comment.