PHDC P2P Handling
[platform/core/connectivity/nfc-manager-neard.git] / daemon / net_nfc_server_process_phdc.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 #ifndef __NET_NFC_SERVER_PROCESS_PHDC_H__
17 #define __NET_NFC_SERVER_PROCESS_PHDC_H__
18
19 #include "net_nfc_gdbus.h"
20 #include "net_nfc_typedef_internal.h"
21
22 #define PHDC_SAP 0x16
23 #define PHDS_SAP 0x17
24 #define PHDC_SAN "urn:nfc:sn:phdc"
25 #define PHDS_SAN "urn:nfc:sn:phds"
26 #define PHDC_HEADER_LEN 2
27
28 typedef enum
29 {
30         NET_NFC_PHDC_OPERATION_FAILED = 0,
31         NET_NFC_PHDC_TARGET_CONNECTED ,
32         NET_NFC_PHDC_DATA_RECEIVED
33 }net_nfc_server_phdc_indication_type;
34
35
36 //callback for manager connection accept / agent connect
37 typedef void (*net_nfc_server_phdc_cb)(net_nfc_phdc_handle_h handle,
38                 net_nfc_error_e result, net_nfc_server_phdc_indication_type indication, data_s *data);
39
40 //callback for data send
41 typedef gboolean (*net_nfc_server_phdc_send_cb)(net_nfc_phdc_handle_h handle,
42                 net_nfc_error_e result, net_nfc_server_phdc_indication_type indication, gpointer *user_data);
43
44 typedef struct _net_nfc_server_phdc_context_t net_nfc_server_phdc_context_t;
45
46 struct _net_nfc_server_phdc_context_t
47 {
48         net_nfc_target_handle_s *handle;
49         net_nfc_error_e result;
50         net_nfc_llcp_socket_t socket;
51         uint32_t state;
52         data_s data;
53         net_nfc_server_phdc_cb cb;
54         void *user_param;
55         GQueue queue;
56 };
57
58 net_nfc_error_e net_nfc_server_phdc_manager_start(net_nfc_target_handle_s *handle,
59                 const char *san, sap_t sap, net_nfc_server_phdc_cb cb,  void *user_param);
60
61 net_nfc_error_e net_nfc_server_phdc_agent_start(net_nfc_target_handle_s *handle,
62                 const char *san, sap_t sap, net_nfc_server_phdc_cb cb, void *user_param);
63
64 net_nfc_error_e net_nfc_server_phdc_agent_request(net_nfc_phdc_handle_h handle,
65                 data_s *data, net_nfc_server_phdc_send_cb cb, void *user_param);
66
67
68 #endif//__NET_NFC_SERVER_PROCESS_PHDC_H__
69