2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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.
20 /* standard library header */
24 /* SLP library header */
27 #include "smartcard-types.h"
29 #include "SEServiceListener.h"
30 #include "SEServiceHelper.h"
31 #endif /* __cplusplus */
36 namespace smartcard_service_api
38 typedef void (*serviceConnected)(SEServiceHelper *service, void *context);
40 class SEService : public SEServiceHelper
45 serviceConnected handler;
46 SEServiceListener *listener;
50 void addReader(unsigned int handle, const char *name);
51 bool parseReaderInformation(unsigned int count, const ByteArray &data);
52 bool parseReaderInformation(GVariant *variant);
56 bool initialize(void *context, serviceConnected handler)
57 throw(ErrorIO &, ErrorIllegalParameter &);
58 bool initialize(void *context, SEServiceListener *listener)
59 throw(ErrorIO &, ErrorIllegalParameter &);
60 SEService *initializeSync(void *context, serviceConnected handler)
61 throw(ErrorIO &, ErrorIllegalParameter &);
63 static void reader_inserted(GObject *source_object,
64 guint reader_id, gchar *reader_name,
66 static void reader_removed(GObject *source_object,
67 guint reader_id, gchar *reader_name,
69 static void se_service_shutdown_cb(GObject *source_object,
70 GAsyncResult *res, gpointer user_data);
71 static void se_service_cb(GObject *source_object,
72 GAsyncResult *res, gpointer user_data);
75 SEService(void *user_data, serviceConnected handler)
76 throw(ErrorIO &, ErrorIllegalParameter &);
77 SEService(void *user_data, SEServiceListener *listener)
78 throw(ErrorIO &, ErrorIllegalParameter &);
81 static SEService *createInstance(void *user_data, SEServiceListener *listener)
82 throw(ErrorIO &, ErrorIllegalParameter &);
83 static SEService *createInstance(void *user_data, serviceConnected handler)
84 throw(ErrorIO &, ErrorIllegalParameter &);
89 } /* namespace smartcard_service_api */
90 #endif /* __cplusplus */
96 #endif /* __cplusplus */
98 se_service_h se_service_create_instance(void *user_data,
99 se_service_connected_cb callback);
100 se_service_h se_service_create_instance_with_event_callback(void *user_data,
101 se_service_connected_cb connected, se_service_event_cb event,
102 se_sesrvice_error_cb error);
103 int se_service_get_readers_count(se_service_h handle);
104 bool se_service_get_readers(se_service_h handle, reader_h *readers, int *count);
105 bool se_service_is_connected(se_service_h handle);
106 void se_service_shutdown(se_service_h handle);
107 void se_service_destroy_instance(se_service_h handle);
111 #endif /* __cplusplus */
113 #endif /* SESERVICE_H_ */