|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Static factory class for instantiating a class |
|
15 * implementing abs_core_server_c interface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // ======== MEMBER FUNCTIONS ======== |
|
21 |
|
22 #include "core_server_factory.h" |
|
23 #include "core_server.h" |
|
24 #include "am_debug.h" |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 abs_core_server_c* core_server_factory_c::instance( |
|
30 abs_core_server_callback_c& callback, |
|
31 abs_core_driverif_c& drivers, |
|
32 core_device_settings_s& settings, |
|
33 core_mac_address_s& mac_address, |
|
34 u32_t features ) |
|
35 { |
|
36 DEBUG( "core_server_factory_c::instance() " ); |
|
37 |
|
38 core_server_c* server = new core_server_c( |
|
39 callback, drivers, settings, mac_address, features ); |
|
40 if ( !server ) |
|
41 { |
|
42 DEBUG( "core_server_factory_c::instance() - unable to create core_server_c" ); |
|
43 return NULL; |
|
44 } |
|
45 |
|
46 core_error_e ret = server->init(); |
|
47 if ( ret != core_error_ok ) |
|
48 { |
|
49 DEBUG1( "core_server_factory_c::instance() - init() failed with %u", |
|
50 ret ); |
|
51 delete server; |
|
52 server = NULL; |
|
53 |
|
54 return NULL; |
|
55 } |
|
56 |
|
57 return server; |
|
58 } |