|
1 |
|
2 // Copyright (c) 1997-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 // This file contains the functions to construct the Test Step and the |
|
16 // Exec_SendReceiveL() function that connects to the server and makes IPC calls. |
|
17 // |
|
18 // |
|
19 |
|
20 // Test Step header |
|
21 #include "EASShdOpCodeGetAlarmDetails1_CStep.h" |
|
22 |
|
23 // TO BE SAFE |
|
24 IMPORT_C TInt StartDialogThread(); |
|
25 |
|
26 /** |
|
27 Constructor called from the respective Suite.cpp from their "AddTestStep" function |
|
28 Each test step initialises it's own name |
|
29 */ |
|
30 CEASShdOpCodeGetAlarmDetails1Step::CEASShdOpCodeGetAlarmDetails1Step() |
|
31 { |
|
32 // The server name and IPC number is obtained and all messages are checked Sync |
|
33 iSrServerName = _L("!AlarmServer"); |
|
34 iSrMessageType = 2; |
|
35 iSrMessageId = 100; |
|
36 iSrMessageMask = 32768; |
|
37 iServerPanic = _L("ALARMSERVER"); |
|
38 |
|
39 // NOT expected to be rejected as this test step will test for the condition: |
|
40 // none capapbility and same SID, and so has to pass |
|
41 iExpectRejection = EFalse; |
|
42 |
|
43 iStepCap = 32768; |
|
44 |
|
45 // Get a unique thread name |
|
46 iSrChildThread.Format(_L("ChildThread_%S_%d"),&iSrServerName,iSrMessageId); |
|
47 } |
|
48 |
|
49 |
|
50 |
|
51 /** |
|
52 This function is called by the Child Thread |
|
53 1. Create a session with the server |
|
54 2. Test an SendReceive call |
|
55 3. Informs the main thread about the status of the call using |
|
56 a. iSessionCreated, if the a connection is established |
|
57 b. iResultServer, holds the return value for connection |
|
58 c. iResultSr, the return value of SendReceive call |
|
59 */ |
|
60 TInt CEASShdOpCodeGetAlarmDetails1Step::Exec_SendReceiveL() |
|
61 { |
|
62 iResultServer = CreateSession(iSrServerName,Version(),KAlarmServerAsynchronousSlotCount); |
|
63 |
|
64 if (iResultServer!=KErrNone) |
|
65 { |
|
66 iResultServer=StartServer(); |
|
67 if (iResultServer!=KErrNone) |
|
68 { |
|
69 return(iResultServer); |
|
70 } |
|
71 iResultServer = CreateSession(iSrServerName,Version(),KAlarmServerAsynchronousSlotCount); |
|
72 } |
|
73 if(iResultServer == 0) |
|
74 { |
|
75 iSessionCreated = ETrue; |
|
76 if(iSrMessageId >= 0) |
|
77 { |
|
78 // Get the alarm id |
|
79 TAlarmId alarmId; |
|
80 alarmId = CCapabilityTestStep::GetAlarmId(); |
|
81 |
|
82 if(alarmId >= 0) |
|
83 { |
|
84 // If valid alarm id, perform IPC call |
|
85 TASShdAlarm alarm; |
|
86 TPckg<TASShdAlarm> package(alarm); |
|
87 TIpcArgs args(alarmId,&package); |
|
88 iResultSr = SendReceive(iSrMessageId, args); |
|
89 } |
|
90 else |
|
91 { |
|
92 // else leave |
|
93 User::Leave(alarmId); |
|
94 } |
|
95 } |
|
96 } |
|
97 return iResultServer; |
|
98 } |