1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <stdlib.h>
18 #include <string.h>
19 #include <llcp_api.h>
20 
21 #define DEFAULT_VALUE 0x02
22 #define SIZE 16
23 #define LENGTH 1
24 
25 extern tLLCP_STATUS llcp_util_parse_cc(uint8_t* p_bytes, uint16_t length,
26                                        uint16_t* p_miu, uint8_t* p_rw);
27 
main()28 int main() {
29   const int32_t offset = SIZE - LENGTH;
30   uint8_t* p_bytes = (uint8_t *)malloc(SIZE);
31   if (!p_bytes) {
32     return EXIT_FAILURE;
33   }
34   memset(p_bytes, DEFAULT_VALUE, SIZE);
35 
36   tLLCP_CONNECTION_PARAMS params;
37   llcp_util_parse_cc(&p_bytes[offset], LENGTH, &(params.miu), &(params.rw));
38 
39   free(p_bytes);
40   return EXIT_SUCCESS;
41 }
42