blob: 69c9695cc12c2abd54dc4beffa9f5e2bc1668ad6 [file] [log] [blame]
Andrei Litvin42727b12024-02-29 18:38:19 -05001/*
2 * Copyright (c) 2024 Project CHIP Authors
3 * All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#pragma once
18
19#include <cstddef>
20#include <cstdint>
21
22/*
23 * @brief Function that determines the length of a zigbee Cluster Library string
24 * (where the first byte is assumed to be the length).
25 */
26uint8_t emberAfStringLength(const uint8_t * buffer);
27/*
28 * @brief Function that determines the length of a zigbee Cluster Library long string.
29 * (where the first two bytes are assumed to be the length).
30 */
31uint16_t emberAfLongStringLength(const uint8_t * buffer);
32
33/*
34 * @brief Function that copies a ZCL string type into a buffer. The size
35 * parameter should indicate the maximum number of characters to copy to the
36 * destination buffer not including the length byte.
37 */
38void emberAfCopyString(uint8_t * dest, const uint8_t * src, size_t size);
39
40/*
41 * @brief Function that copies a ZCL long string into a buffer. The size
42 * parameter should indicate the maximum number of characters to copy to the
43 * destination buffer not including the length bytes.
44 */
45void emberAfCopyLongString(uint8_t * dest, const uint8_t * src, size_t size);