4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #ifndef __TCORE_HAL_H__
22 #define __TCORE_HAL_H__
26 typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data);
27 typedef enum tcore_hook_return (*TcoreHalSendHook)(TcoreHal *hal, unsigned int data_len, void *data, void *user_data);
29 enum tcore_hal_recv_data_type {
30 TCORE_HAL_RECV_INDICATION,
31 TCORE_HAL_RECV_RESPONSE,
32 TCORE_HAL_RECV_NOTIFICATION,
33 TCORE_HAL_RECV_UNKNOWN
37 TCORE_HAL_MODE_UNKNOWN,
39 TCORE_HAL_MODE_CUSTOM,
40 TCORE_HAL_MODE_TRANSPARENT
43 struct tcore_hal_operations {
44 TReturn (*power)(TcoreHal *hal, gboolean flag);
45 TReturn (*send)(TcoreHal *hal, unsigned int data_len, void *data);
48 TcoreHal* tcore_hal_new(TcorePlugin *plugin, const char *name,
49 struct tcore_hal_operations *hops,
50 enum tcore_hal_mode mode);
51 void tcore_hal_free(TcoreHal *hal);
53 TReturn tcore_hal_set_name(TcoreHal *hal, const char *name);
54 char* tcore_hal_get_name(TcoreHal *hal);
56 TcoreAT* tcore_hal_get_at(TcoreHal *hal);
57 enum tcore_hal_mode tcore_hal_get_mode(TcoreHal *hal);
58 TReturn tcore_hal_set_mode(TcoreHal *hal, enum tcore_hal_mode mode);
60 TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag);
62 TReturn tcore_hal_link_user_data(TcoreHal *hal, void *user_data);
63 void* tcore_hal_ref_user_data(TcoreHal *hal);
65 TReturn tcore_hal_send_data(TcoreHal *hal, unsigned int data_len, void *data);
66 TReturn tcore_hal_send_request(TcoreHal *hal, TcorePending *pending);
67 TReturn tcore_hal_send_force(TcoreHal *hal);
69 TReturn tcore_hal_dispatch_response_data(TcoreHal *hal, int id,
70 unsigned int data_len, const void *data);
72 TReturn tcore_hal_add_recv_callback(TcoreHal *hal,
73 TcoreHalReceiveCallback func, void *user_data);
74 TReturn tcore_hal_remove_recv_callback(TcoreHal *hal,
75 TcoreHalReceiveCallback func);
76 TReturn tcore_hal_emit_recv_callback(TcoreHal *hal,
77 unsigned int data_len, const void *data);
79 TReturn tcore_hal_add_send_hook(TcoreHal *hal, TcoreHalSendHook func,
81 TReturn tcore_hal_remove_send_hook(TcoreHal *hal, TcoreHalSendHook func);
83 TReturn tcore_hal_set_power_state(TcoreHal *hal, gboolean flag);
84 gboolean tcore_hal_get_power_state(TcoreHal *hal);
86 TcoreQueue* tcore_hal_ref_queue(TcoreHal *hal);
87 TcorePlugin* tcore_hal_ref_plugin(TcoreHal *hal);