added k60d100m project
[adk-bluetooth-test.git] / adk-stack / btL2CAP.h
blob2b9eeb302ccbb9320f3c16b44baf2e2ed14cabf1
1 /*
2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef _BT_L2CAP_H_
17 #define _BT_L2CAP_H_
19 #include <stdint.h>
21 #define L2CAP_FLAG_SUPPORT_CONNECTIONS 1
22 #define L2CAP_FLAG_SUPPORT_CONNECTIONLESS 2
24 #define L2CAP_CHAN_CONNECTIONLESS 2 //pass to capServiceTx as needed
27 #define L2CAP_PSM_SDP 0x0001
28 #define L2CAP_PSM_RFCOMM 0x0003
29 #define L2CAP_PSM_AVDTP 0x0019
32 #define L2CAP_MAX_PIECED_MESSAGES 4 //most broken messages we support *at once*
34 typedef struct{
36 uint8_t flags;
38 void* (*serviceInstanceAllocate)(uint16_t conn, uint16_t chan, uint16_t remChan);
39 void (*serviceInstanceFree)(void* service);
41 void (*serviceRx)(void* service, const uint8_t* data, uint16_t size);
43 }L2capService;
45 #ifdef ADK_INTERNAL
47 #include "sgBuf.h"
49 //API for services
50 void l2capServiceTx(uint16_t conn, uint16_t remChan, sg_buf* data);
51 void l2capServiceCloseConn(uint16_t conn, uint16_t chan);
53 //API for service management
54 char l2capServiceRegister(uint16_t PSM, const L2capService* svcData);
55 char l2capServiceUnregister(uint16_t PSM,char sendDiscPacket);
58 //API for ACL
59 void l2capAclLinkUp(uint16_t conn);
60 void l2capAclLinkDataRx(uint16_t conn, char first, const uint8_t* data, uint16_t size);
61 void l2capAclLinkDown(uint16_t conn);
64 #endif
65 #endif