|
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 "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: |
|
15 * System Includes |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include <stdio.h> |
|
22 #include <assert.h> |
|
23 |
|
24 |
|
25 /******************************************************************************* |
|
26 * |
|
27 * Local Includes |
|
28 * |
|
29 ******************************************************************************/ |
|
30 #include "MTInterfaces.h" |
|
31 #include "CDatalinkNull.h" |
|
32 |
|
33 |
|
34 /******************************************************************************* |
|
35 * |
|
36 * Constructor - init state vars |
|
37 * |
|
38 ******************************************************************************/ |
|
39 CDatalinkNull::CDatalinkNull( TPhoneData *aPhoneData, CLog *aLog ) |
|
40 { |
|
41 // check params |
|
42 assert( aPhoneData != NULL ); |
|
43 assert( aLog != NULL ); |
|
44 |
|
45 // initialise members |
|
46 iAirInterface = NULL; |
|
47 iTEChannel = NULL; |
|
48 iPhoneData = aPhoneData; |
|
49 iLog = aLog; |
|
50 } |
|
51 |
|
52 |
|
53 CDatalinkNull::~CDatalinkNull() |
|
54 { |
|
55 // assert( iAirInterface == NULL ); |
|
56 // assert( iTEChannel == NULL ); |
|
57 } |
|
58 |
|
59 |
|
60 /******************************************************************************* |
|
61 * |
|
62 * Access methods |
|
63 * |
|
64 ******************************************************************************/ |
|
65 void CDatalinkNull::SetAirInterface( IAirInterface *aAirInterface ) |
|
66 { |
|
67 iAirInterface = aAirInterface; |
|
68 } |
|
69 |
|
70 |
|
71 void CDatalinkNull::SetTEChannel( ITEChannel *aTEChannel ) |
|
72 { |
|
73 iTEChannel = aTEChannel; |
|
74 } |
|
75 |
|
76 |
|
77 /******************************************************************************* |
|
78 * |
|
79 * Process data from the TEChannel |
|
80 * |
|
81 ******************************************************************************/ |
|
82 TDataPathError CDatalinkNull::ProcessTEData( char *data, int len, int *aErrCode ) |
|
83 { |
|
84 TDataPathError err; |
|
85 |
|
86 // if no air-interface exists then return error |
|
87 if( iAirInterface == NULL ) { |
|
88 return DPE_NO_AIR_INTERFACE; |
|
89 } |
|
90 |
|
91 // otherwise forward the data |
|
92 err = iAirInterface->SendPacket( data, len, aErrCode ); |
|
93 return err; |
|
94 } |
|
95 |
|
96 |
|
97 TDataPathError CDatalinkNull::ProcessUUData( char *data, int len, int *aErrCode ) |
|
98 { |
|
99 TDataPathError err; |
|
100 |
|
101 // if no te-channel exists then return an error |
|
102 if( iTEChannel == NULL ) { |
|
103 return DPE_NO_TE_CHANNEL; |
|
104 } |
|
105 |
|
106 // otherwise forward the data |
|
107 err = iTEChannel->SendPacket( data, len, aErrCode ); |
|
108 return err; |
|
109 } |