|
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 * CTestService.h |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include <stdio.h> |
|
22 |
|
23 #include "CTestService.h" |
|
24 |
|
25 CService* Service() { return new CTestService(); } |
|
26 |
|
27 int CTestService::RunCommand( const CCall& aCall ) |
|
28 { |
|
29 int callID = -1; |
|
30 if( aCall.CallID( callID ) ) |
|
31 { |
|
32 switch( callID ) |
|
33 { |
|
34 case 1: |
|
35 { |
|
36 printf( "CallID One has been made\n" ); |
|
37 // Parse the parameters here and make the relevant call |
|
38 } |
|
39 break; |
|
40 case 2: |
|
41 { |
|
42 printf( "CallID Two has been made\n" ); |
|
43 // Parse the parameters here and make the relevant call |
|
44 } |
|
45 break; |
|
46 case 3: |
|
47 { |
|
48 printf( "CallID Three has been made\n" ); |
|
49 // Parse the parameters here and make the relevant call |
|
50 } |
|
51 break; |
|
52 default: |
|
53 { |
|
54 printf( "Unknown CallID\n" ); |
|
55 return ERR_INVALID_CALL; |
|
56 } |
|
57 } |
|
58 |
|
59 // *** Testing *** |
|
60 // Echo the number of parameters |
|
61 int numParams = 0; |
|
62 if( aCall.Params( numParams ) ) |
|
63 { |
|
64 printf( "Number of parameters: %d\n", numParams ); |
|
65 |
|
66 for( int index=0 ; index<numParams ; index++ ) |
|
67 { |
|
68 string name; |
|
69 if( aCall.Name(index, name) ) |
|
70 { |
|
71 // Echo the Parameter Name |
|
72 printf( "Parameter Name: %s\n", name.c_str() ); |
|
73 |
|
74 string value; |
|
75 if( aCall.Value(index, value) ) |
|
76 { |
|
77 // Echo the Parameter Value |
|
78 printf( "Parameter Value: %s\n", value.c_str() ); |
|
79 } |
|
80 } |
|
81 } |
|
82 printf("\n"); |
|
83 // *** Testing *** |
|
84 } |
|
85 } |
|
86 |
|
87 return 0; |
|
88 } |