17:39
[skypekit:skypekit.git] / skypekit_2.0.0.190_29281_CB30 / interfaces / skype / cpp_embedded / documentation / html / tutorial__7_8cpp-example.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <title>SkypeKit C++ Wrapper: Main Page</title>
6 <link href="tabs.css" rel="stylesheet" type="text/css"/>
7 <link href="islander.css" rel="stylesheet" type="text/css"/>
8 </head>
9 <body>
10 <img src="..\skypekit.png" align="right">
11 <!-- Generated by Doxygen 1.6.2 -->
12 <script type="text/javascript">
13 <!--
14 function changeDisplayState (e){
15   var num=this.id.replace(/[^[0-9]/g,'');
16   var button=this.firstChild;
17   var sectionDiv=document.getElementById('dynsection'+num);
18   if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
19     sectionDiv.style.display='block';
20     button.src='open.gif';
21   }else{
22     sectionDiv.style.display='none';
23     button.src='closed.gif';
24   }
25 }
26 function initDynSections(){
27   var divs=document.getElementsByTagName('div');
28   var sectionCounter=1;
29   for(var i=0;i<divs.length-1;i++){
30     if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
31       var header=divs[i];
32       var section=divs[i+1];
33       var button=header.firstChild;
34       if (button!='IMG'){
35         divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
36         button=document.createElement('img');
37         divs[i].insertBefore(button,divs[i].firstChild);
38       }
39       header.style.cursor='pointer';
40       header.onclick=changeDisplayState;
41       header.id='dynheader'+sectionCounter;
42       button.src='closed.gif';
43       section.id='dynsection'+sectionCounter;
44       section.style.display='none';
45       section.style.marginLeft='14px';
46       sectionCounter++;
47     }
48   }
49 }
50 window.onload = initDynSections;
51 -->
52 </script>
53 <div class="navigation" id="top">
54   <div class="tabs">
55     <ul>
56       <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
57       <li><a href="annotated.html"><span>Classes</span></a></li>
58       <li><a href="files.html"><span>Files</span></a></li>
59       <li><a href="examples.html"><span>Examples</span></a></li>
60     </ul>
61   </div>
62 </div>
63 <div class="contents">
64 <h1>tutorial_7.cpp</h1><h2><a class="anchor" id="Step7">
65 C++ Tutorial Step 7: Initiating a conference call</a></h2>
66 <p>In the previous tutorial, we wrote a SkypeKit dialer that took a skypename from a command-line argument and initiated a voice call. In this step, we will have two call targets, and we'll form a conference call. Our program will:</p>
67 <ul>
68 <li>Create a new <a class="el" href="class_conversation.html" title="The Conversation class encapsulates all types of communication possible with Skype...">Conversation</a> object. </li>
69 <li>Create an <a class="el" href="class_s_e_string_list.html" title="SEStringList represents a list of strings (SEString objects).">SEStringList</a> and add the skypenames of our call targets to it </li>
70 <li>Assign the <a class="el" href="class_s_e_string_list.html" title="SEStringList represents a list of strings (SEString objects).">SEStringList</a> to our conference with <a class="el" href="class_conversation.html#a1e2f0f7e78a9a286690156286ad97ce4">Conversation::AddConsumers</a> </li>
71 <li>Get back a list of <a class="el" href="class_participant.html" title="Conversation participant class. Instances of this class represent contacts in context...">Participant</a> references </li>
72 <li>Loop through the list of participants and call <a class="el" href="class_participant.html#accfce5c1b089c0e5eb438595d2d336f2">Participant::Ring</a> on each one (except ourselves)</li>
73 </ul>
74 <h3><a class="anchor" id="Step7Walkthrough">
75 Code Walkthrough</a></h3>
76 <p>The last step requires a short delay between each Ring, while we wait until the P_VOICE_STATUS of the participant changes to RINGING.</p>
77 <p>Steps 1 to 3 look like this: </p>
78 <div class="fragment"><pre class="fragment">MyConversation::Ref C;
79 <a name="_a0"></a><a class="code" href="class_s_e_string_list.html" title="SEStringList represents a list of strings (SEString objects).">SEStringList</a> CallTargets;
80 <a name="_a1"></a><a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> PartIdentity;
81 skype-&gt;CreateConference(C);
82 CallTargets.<a name="a2"></a><a class="code" href="class_s_e_string_list.html#adfd5ca815c8569c0c3ee85486c2326e1">append</a>(MyCallTarget1);
83 CallTargets.<a class="code" href="class_s_e_string_list.html#adfd5ca815c8569c0c3ee85486c2326e1">append</a>(MyCallTarget2);
84 C-&gt;AddConsumers(CallTargets);
85 </pre></div><p>Step 4 - getting back the list of participants goes like this: </p>
86 <div class="fragment"><pre class="fragment"><a name="_a3"></a><a class="code" href="class_participant_refs.html" title="list of references to Participant class instances, equivalent to Participant::Refs...">ParticipantRefs</a> ConvParticipantList;
87 C-&gt;GetParticipants(ConvParticipantList, <a name="a4"></a><a class="code" href="class_conversation.html#a3b9a94385c62856673e211120ea2ca7babbec81b22649fa4b551ba7d7b3a6cf1e">Conversation::ALL</a>);
88 </pre></div><p>..and the loop where we call <a class="el" href="class_participant.html#accfce5c1b089c0e5eb438595d2d336f2">Participant::Ring</a> looks like this: </p>
89 <div class="fragment"><pre class="fragment"><span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> I = 0; I &lt; ConvParticipantList.<a name="a5"></a><a class="code" href="class_s_e_ref_list.html#a6abe33cebf6e934cb268c4e667d3e601">size</a>(); I++)
90 {
91     PartIdentity = ConvParticipantList[I]-&gt;GetProp(<a name="a6"></a><a class="code" href="class_participant.html#a0789ec8e8c2faea38a444800004be26dae6efd49f53150606b810cd7caf6ba9a4">Participant::P_IDENTITY</a>);
92     <span class="keywordflow">if</span> (PartIdentity != MyAccountName)
93     {
94         IsRinging = <span class="keyword">false</span>;
95         printf(<span class="stringliteral">&quot;Calling %s\n&quot;</span>, (<span class="keyword">const</span> <span class="keywordtype">char</span>*)PartIdentity);
96         ConvParticipantList[I]-&gt;Ring(PartIdentity, <span class="keyword">false</span>, 1, 40, <span class="keyword">false</span>);
97         <span class="keywordflow">while</span> (!IsRinging) {sleep(1);};
98     };
99 };
100 </pre></div><p>Note the last two lines of the loop. IsRinging is a global bool that gets set to true by <a class="el" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">Participant::OnChange</a> event.</p>
101 <div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> MyParticipant::OnChange(<span class="keywordtype">int</span> prop)
102 {
103     <span class="keywordflow">if</span> (prop == <a name="a7"></a><a class="code" href="class_participant.html#a0789ec8e8c2faea38a444800004be26da9c8100905a6a2b9e002ccd6309f453a0">Participant::P_VOICE_STATUS</a>)
104     {
105         <a class="code" href="class_participant.html#a95761f052295c59ea5f8821bfefbaace">Participant::VOICE_STATUS</a> VoiceStatus;
106         GetPropVoiceStatus(VoiceStatus);
107
108         <span class="keywordflow">if</span> (VoiceStatus == <a name="a8"></a><a class="code" href="class_participant.html#a95761f052295c59ea5f8821bfefbaaceaff17bc87166384c604f939b256e0f6b8">Participant::RINGING</a>)
109         {
110             IsRinging = <span class="keyword">true</span>;
111         };
112     };
113 };
114 </pre></div><p>This delay is necessary - otherwise the subsequent Rings will not take place.</p>
115 <h2><a class="anchor" id="Step7FullCode">
116 Full code of this example</a></h2>
117 <div class="fragment"><pre class="fragment"><span class="comment">/****************************************************************************</span>
118 <span class="comment"></span>
119 <span class="comment">Getting Started With SkypeKit. Tutorial Application, Step 7.</span>
120 <span class="comment"></span>
121 <span class="comment">In the previous tutorial, we wrote a SkypeKit dialer that took a skypename from a command-line argument and initiated </span>
122 <span class="comment">a voice call. In this step, we will have two call targets, and we&#39;ll form a conference call. Our program will:</span>
123 <span class="comment"> 1. Create a new Conversation object.</span>
124 <span class="comment"> 2. Create an SEStringList and add the skypenames of our call targets to it</span>
125 <span class="comment"> 3. Assign the SEStringList to our conference with Conversation::AddConsumers</span>
126 <span class="comment"> 4. Get back a list of Participant references</span>
127 <span class="comment"> 5. Loop through the list of participants and call Participant::Ring on each one (except ourselves)</span>
128 <span class="comment"></span>
129 <span class="comment">**/</span>
130
131 <span class="preprocessor">#ifdef _WIN32</span>
132 <span class="preprocessor"></span><span class="preprocessor">#include &quot;Windows.h&quot;</span>
133 <span class="preprocessor">#else</span>
134 <span class="preprocessor"></span><span class="preprocessor">#include &lt;unistd.h&gt;</span>
135 <span class="preprocessor">#endif</span>
136 <span class="preprocessor"></span>
137 <span class="preprocessor">#include &quot;<a class="code" href="skype-embedded__2_8h.html">skype-embedded_2.h</a>&quot;</span>
138 <span class="preprocessor">#include &quot;<a class="code" href="skype-tcp-transport_8h.html">skype-tcp-transport.h</a>&quot;</span>
139 <span class="preprocessor">#include &quot;app_token.h&quot;</span>
140
141 <span class="keyword">using namespace </span>Sid;
142
143 <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> inetAddr   = <span class="stringliteral">&quot;127.0.0.1&quot;</span>;
144 uint portNum        = 8963;
145
146 <span class="keywordtype">bool</span> LoggedIn       = <span class="keyword">false</span>;
147 <span class="keywordtype">bool</span> LoggedOut      = <span class="keyword">false</span>;
148 <span class="keywordtype">bool</span> CallFinished   = <span class="keyword">false</span>;
149 <span class="keywordtype">bool</span> IsRinging      = <span class="keyword">false</span>;
150
151 <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> MyAccountName;
152 <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> MyAccountPsw;
153
154 <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> MyCallTarget1;
155 <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> MyCallTarget2;
156
157 <a name="_a9"></a><a class="code" href="class_s_e_t_c_p_transport.html" title="TCP transport to skypekit.">SETCPTransport</a>* transport   = 0;
158
159
160 <a name="_a10"></a><a class="code" href="class_conversation_ref.html" title="Reference to an Conversation class instance, equivalent to Conversation::Ref.">Conversation::Ref</a> LiveConversation;
161
162 <span class="keywordtype">void</span> debugOut(<span class="keyword">const</span> <span class="keywordtype">char</span>* out)
163 {
164     <span class="comment">//printf(&quot;%s&quot;, out);</span>
165 };
166
167 <span class="keywordtype">void</span> Delay(<span class="keywordtype">int</span> Ms)
168 {
169 <span class="preprocessor">    #ifdef _WIN32</span>
170 <span class="preprocessor"></span>        Sleep(Ms);
171 <span class="preprocessor">    #else</span>
172 <span class="preprocessor"></span>        sleep(Ms);
173 <span class="preprocessor">    #endif</span>
174 <span class="preprocessor"></span>};
175
176
177 <span class="comment">//---------------------------------------------------------------------------------------</span>
178 <span class="comment">// Subclassing Participant</span>
179
180 <span class="keyword">class </span>MyParticipant : <span class="keyword">public</span> <a name="_a11"></a><a class="code" href="class_participant.html" title="Conversation participant class. Instances of this class represent contacts in context...">Participant</a>
181 {
182 <span class="keyword">public</span>:
183     <span class="keyword">typedef</span> <a name="_a12"></a><a class="code" href="struct_d_ref.html" title="Used for downcast the skypekit references to references to you own derived classes...">DRef&lt;MyParticipant, Participant&gt;</a> Ref;
184     MyParticipant(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oid, <a name="_a13"></a><a class="code" href="class_s_e_root_object.html" title="SERootObject is the root module and entry point for API.">SERootObject</a>* root);
185     ~MyParticipant() {};
186
187     <span class="keywordtype">void</span> <a name="a14"></a><a class="code" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">OnChange</a>(<span class="keywordtype">int</span> prop);
188 };
189
190 MyParticipant::MyParticipant(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oid, <a class="code" href="class_s_e_root_object.html" title="SERootObject is the root module and entry point for API.">SERootObject</a>* root) : <a class="code" href="class_participant.html" title="Conversation participant class. Instances of this class represent contacts in context...">Participant</a>(oid, root) {};
191
192 <span class="keywordtype">void</span> <a class="code" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">MyParticipant::OnChange</a>(<span class="keywordtype">int</span> prop)
193 {
194     <span class="keywordflow">if</span> (prop == <a class="code" href="class_participant.html#a0789ec8e8c2faea38a444800004be26da9c8100905a6a2b9e002ccd6309f453a0">Participant::P_VOICE_STATUS</a>)
195     {
196         <a class="code" href="class_participant.html#a95761f052295c59ea5f8821bfefbaace">Participant::VOICE_STATUS</a> VoiceStatus;
197         GetPropVoiceStatus(VoiceStatus);
198
199         <span class="keywordflow">if</span> (VoiceStatus == <a class="code" href="class_participant.html#a95761f052295c59ea5f8821bfefbaaceaff17bc87166384c604f939b256e0f6b8">Participant::RINGING</a>)
200         {
201             IsRinging = <span class="keyword">true</span>;
202         };
203
204         <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> Identity;
205         GetPropIdentity(Identity);
206         <a class="code" href="class_participant.html#a95761f052295c59ea5f8821bfefbaace">Participant::VOICE_STATUS</a> Voice;
207         GetPropVoiceStatus(Voice);
208
209         printf(<span class="stringliteral">&quot;Participant %s voice status = %d\n&quot;</span>, (<span class="keyword">const</span> <span class="keywordtype">char</span>*)Identity, Voice);
210     };
211 };
212
213 <span class="comment">//---------------------------------------------------------------------------------------</span>
214 <span class="comment">// Subclassing Conversation</span>
215
216 <span class="keyword">class </span>MyConversation : <span class="keyword">public</span> <a name="_a15"></a><a class="code" href="class_conversation.html" title="The Conversation class encapsulates all types of communication possible with Skype...">Conversation</a>
217 {
218 <span class="keyword">public</span>:
219     <span class="keyword">typedef</span> <a class="code" href="struct_d_ref.html" title="Used for downcast the skypekit references to references to you own derived classes...">DRef&lt;MyConversation, Conversation&gt;</a> Ref;
220     MyConversation(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oid, <a class="code" href="class_s_e_root_object.html" title="SERootObject is the root module and entry point for API.">SERootObject</a>* root);
221     ~MyConversation() {};
222
223     <span class="keywordtype">void</span> <a class="code" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">OnChange</a>(<span class="keywordtype">int</span> prop);
224 };
225
226 MyConversation::MyConversation(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oid, <a class="code" href="class_s_e_root_object.html" title="SERootObject is the root module and entry point for API.">SERootObject</a>* root) : <a class="code" href="class_conversation.html" title="The Conversation class encapsulates all types of communication possible with Skype...">Conversation</a>(oid, root) {};
227
228 <span class="keywordtype">void</span> <a class="code" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">MyConversation::OnChange</a>(<span class="keywordtype">int</span> prop)
229 {
230     <span class="keywordflow">if</span> (prop == <a name="a16"></a><a class="code" href="class_conversation.html#a1fccc07009257810420d23e2174cad77a874a491d61fbfbfca75a722a4127502e">Conversation::P_LOCAL_LIVESTATUS</a>)
231     {
232         <a class="code" href="class_conversation.html#a65f54d9d78c06e3164b73cbba8df0f8f">Conversation::LOCAL_LIVESTATUS</a> LiveStatus;
233         GetPropLocalLivestatus(LiveStatus);
234         <span class="keywordflow">if</span> (LiveStatus == <a name="a17"></a><a class="code" href="class_conversation.html#a65f54d9d78c06e3164b73cbba8df0f8facd6e7d0bed121f4a6e47aae2f9fcfb13">Conversation::RECENTLY_LIVE</a>)
235         {
236             printf(<span class="stringliteral">&quot;Call finished.\n&quot;</span>);
237             CallFinished = <span class="keyword">true</span>;
238         };
239     };
240 };
241
242
243 <span class="comment">//---------------------------------------------------------------------------------------</span>
244 <span class="comment">// Subclassing Account</span>
245
246 <span class="keyword">class </span>MyAccount : <span class="keyword">public</span> <a name="_a18"></a><a class="code" href="class_account.html" title="Represents a local account. Encapsulates methods for Skype account creation, login...">Account</a>
247 {
248 <span class="keyword">public</span>:
249     <span class="keyword">typedef</span> <a class="code" href="struct_d_ref.html" title="Used for downcast the skypekit references to references to you own derived classes...">DRef&lt;MyAccount, Account&gt;</a> Ref;
250     MyAccount(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oid, <a class="code" href="class_s_e_root_object.html" title="SERootObject is the root module and entry point for API.">SERootObject</a>* root);
251     ~MyAccount() {};
252
253     <span class="keywordtype">void</span> <a class="code" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">OnChange</a>(<span class="keywordtype">int</span> prop);
254 };
255
256 MyAccount::MyAccount(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oid, <a class="code" href="class_s_e_root_object.html" title="SERootObject is the root module and entry point for API.">SERootObject</a>* root) : <a class="code" href="class_account.html" title="Represents a local account. Encapsulates methods for Skype account creation, login...">Account</a>(oid, root) {};
257
258 <span class="keywordtype">void</span> <a class="code" href="class_s_e_object.html#a9bbdb15b8b15ac9c3471da3855f67227">MyAccount::OnChange</a>(<span class="keywordtype">int</span> prop)
259 {
260     <span class="keywordflow">if</span> (prop == <a name="a19"></a><a class="code" href="class_account.html#a0e7af48c2ba1d22690d83f5adbc071c5a61a8b512c81fd58cbcd6ea8f9e8d54af">Account::P_STATUS</a>)
261     {
262         <a class="code" href="class_account.html#ac2cd2fd3f85a302363a51db3ba97c90d">Account::STATUS</a> LoginStatus;
263         GetPropStatus(LoginStatus);
264         <span class="keywordflow">if</span> (LoginStatus == <a name="a20"></a><a class="code" href="class_account.html#ac2cd2fd3f85a302363a51db3ba97c90dac2c5c7998621e577285e6c4517a897bd">Account::LOGGED_IN</a>)      { LoggedIn  = <span class="keyword">true</span>; };
265         <span class="keywordflow">if</span> (LoginStatus == <a name="a21"></a><a class="code" href="class_account.html#ac2cd2fd3f85a302363a51db3ba97c90dac506fb36d2c2004e4f9abe5c64941c3d">Account::LOGGED_OUT</a>)     { LoggedOut = <span class="keyword">true</span>; };
266     };
267 };
268
269 <span class="comment">//---------------------------------------------------------------------------------------</span>
270 <span class="comment">// Subclassing Skype</span>
271
272 <span class="keyword">class </span>MySkype : <span class="keyword">public</span> <a name="_a22"></a><a class="code" href="class_skype.html" title="The main class that exposes Skype-related functionality to your application.">Skype</a>
273 {
274 <span class="keyword">public</span>:
275     MySkype(<a name="_a23"></a><a class="code" href="class_s_e_transport.html" title="Abstract interface for transport layer.">SETransport</a>* transport) : <a class="code" href="class_skype.html" title="The main class that exposes Skype-related functionality to your application.">Skype</a>(transport) {}
276     ~MySkype() {}
277     <a class="code" href="class_account.html" title="Represents a local account. Encapsulates methods for Skype account creation, login...">Account</a>* <a name="a24"></a><a class="code" href="class_skype.html#a3f609b824744b88ec82b47e460116b92">newAccount</a>(<span class="keywordtype">int</span> oid) {<span class="keywordflow">return</span> <span class="keyword">new</span> MyAccount(oid, <span class="keyword">this</span>);}
278     <a class="code" href="class_conversation.html" title="The Conversation class encapsulates all types of communication possible with Skype...">Conversation</a>* <a name="a25"></a><a class="code" href="class_skype.html#a26f7181b7baf5b98bb95a070daaa4448">newConversation</a>(<span class="keywordtype">int</span> oid) {<span class="keywordflow">return</span> <span class="keyword">new</span> MyConversation(oid, <span class="keyword">this</span>);}
279     <a class="code" href="class_participant.html" title="Conversation participant class. Instances of this class represent contacts in context...">Participant</a>* <a name="a26"></a><a class="code" href="class_skype.html#a60cbc623c29f1faf2326b804ea94a4d0">newParticipant</a>(<span class="keywordtype">int</span> oid) {<span class="keywordflow">return</span> <span class="keyword">new</span> MyParticipant(oid, <span class="keyword">this</span>);}
280     <span class="keywordtype">bool</span> SetupAudioDevices(uint MicNr, uint SpkNr);
281 };
282
283 <span class="keywordtype">bool</span> MySkype::SetupAudioDevices(uint MicNr, uint SpkNr)
284
285 {
286     <a class="code" href="class_s_e_string_list.html" title="SEStringList represents a list of strings (SEString objects).">SEStringList</a> SpkHandles, SpkNames, SpkProductIDs;
287     <a class="code" href="class_s_e_string_list.html" title="SEStringList represents a list of strings (SEString objects).">SEStringList</a> MicHandles, MicNames, MicProductIDs;
288
289     GetAvailableOutputDevices (SpkHandles, SpkNames,  SpkProductIDs);
290     GetAvailableRecordingDevices (MicHandles, MicNames, MicProductIDs);
291
292     <span class="keywordflow">if</span> (MicNr &gt; (MicHandles.<a name="a27"></a><a class="code" href="class_s_e_string_list.html#a0f86fa4676e6bea28f9923955a503360">size</a>() + 1)) 
293     { 
294         printf(<span class="stringliteral">&quot;Invalid mic device no. (%d) passed to MySkype::SetupAudioDevices\n&quot;</span>, MicNr); 
295         <span class="keywordflow">return</span> <span class="keyword">false</span>;
296     };
297
298     <span class="keywordflow">if</span> (SpkNr &gt; (SpkHandles.<a class="code" href="class_s_e_string_list.html#a0f86fa4676e6bea28f9923955a503360">size</a>() + 1))
299     {
300         printf(<span class="stringliteral">&quot;Invalid speaker device no. (%d) passed to MySkype::SetupAudioDevices\n&quot;</span>, SpkNr); 
301         <span class="keywordflow">return</span> <span class="keyword">false</span>;
302     };
303
304     printf(<span class="stringliteral">&quot;Setting mic to %s\n&quot;</span>, (<span class="keyword">const</span> <span class="keywordtype">char</span>*)MicNames[MicNr]);
305     printf(<span class="stringliteral">&quot;Setting speakers to %s\n&quot;</span>, (<span class="keyword">const</span> <span class="keywordtype">char</span>*)SpkNames[SpkNr]);
306
307     SelectSoundDevices(MicHandles[MicNr], SpkHandles[SpkNr], SpkHandles[SpkNr]);
308     SetSpeakerVolume(100);
309     <span class="keywordflow">return</span> <span class="keyword">true</span>;
310 };
311
312
313
314
315 <span class="comment">//---------------------------------------------------------------------------------------</span>
316 <span class="comment">// Main</span>
317
318 MySkype* skype = 0;
319
320 <span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> * argv[])
321 {
322     printf(<span class="stringliteral">&quot;*****************************************************************\n&quot;</span>);
323     printf(<span class="stringliteral">&quot; SkypeKit Tutorial, Step 7. - Initiating voice conference (1 on 2).\n&quot;</span>);
324     printf(<span class="stringliteral">&quot;*****************************************************************\n&quot;</span>);
325
326     <span class="keywordflow">if</span> (argc != 5)
327     {
328         printf(<span class="stringliteral">&quot;usage: tutorial_7 &lt;skypename&gt; &lt;password&gt; &lt;1st calltarget&gt; &lt;2nd calltarget&gt;\n&quot;</span>);
329         <span class="keywordflow">return</span> 0;
330     };
331
332     MyAccountName = argv[1];
333     MyAccountPsw = argv[2];
334     MyCallTarget1 = argv[3];
335     MyCallTarget2 = argv[4];
336
337     printf(<span class="stringliteral">&quot;Creating transport ..\n&quot;</span>);
338     transport = <span class="keyword">new</span> <a class="code" href="class_s_e_t_c_p_transport.html" title="TCP transport to skypekit.">SETCPTransport</a>(inetAddr, portNum);
339     printf(<span class="stringliteral">&quot;Creating skype ..\n&quot;</span>);
340     skype = <span class="keyword">new</span> MySkype(transport);
341     skype-&gt;log = &amp;(debugOut);
342
343     skype-&gt;init();
344     skype-&gt;start();
345
346     printf(<span class="stringliteral">&quot;Submitting application token..\n&quot;</span>);
347     skype-&gt;SetApplicationToken(AppToken);
348
349     printf(<span class="stringliteral">&quot;Retrieving account ..\n&quot;</span>);
350     MyAccount::Ref A;
351
352     <span class="keywordflow">if</span> (skype-&gt;GetAccount(MyAccountName, A))
353     {
354         printf(<span class="stringliteral">&quot;Logging in..\n&quot;</span>);
355         A-&gt;LoginWithPassword(MyAccountPsw, <span class="keyword">false</span>, <span class="keyword">true</span>);
356         <span class="keywordflow">while</span> (!LoggedIn) {Delay(1);};
357         printf(<span class="stringliteral">&quot;Loggin complete.\n&quot;</span>);
358
359         MyConversation::Ref C;
360         <a class="code" href="class_s_e_string_list.html" title="SEStringList represents a list of strings (SEString objects).">SEStringList</a> CallTargets;
361         <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> PartIdentity;
362
363         skype-&gt;CreateConference(C);
364         CallTargets.<a class="code" href="class_s_e_string_list.html#adfd5ca815c8569c0c3ee85486c2326e1">append</a>(MyCallTarget1);
365         CallTargets.<a class="code" href="class_s_e_string_list.html#adfd5ca815c8569c0c3ee85486c2326e1">append</a>(MyCallTarget2);
366
367         C-&gt;AddConsumers(CallTargets);
368
369         <a class="code" href="class_participant_refs.html" title="list of references to Participant class instances, equivalent to Participant::Refs...">ParticipantRefs</a> ConvParticipantList;
370         C-&gt;GetParticipants(ConvParticipantList, <a class="code" href="class_conversation.html#a3b9a94385c62856673e211120ea2ca7babbec81b22649fa4b551ba7d7b3a6cf1e">Conversation::ALL</a>);
371
372         <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> I = 0; I &lt; ConvParticipantList.<a class="code" href="class_s_e_ref_list.html#a6abe33cebf6e934cb268c4e667d3e601">size</a>(); I++)
373         {
374             PartIdentity = ConvParticipantList[I]-&gt;GetProp(<a class="code" href="class_participant.html#a0789ec8e8c2faea38a444800004be26dae6efd49f53150606b810cd7caf6ba9a4">Participant::P_IDENTITY</a>);
375
376             <span class="keywordflow">if</span> (PartIdentity != MyAccountName)
377             {
378                 IsRinging = <span class="keyword">false</span>;          
379                 printf(<span class="stringliteral">&quot;Calling %s\n&quot;</span>, (<span class="keyword">const</span> <span class="keywordtype">char</span>*)PartIdentity);
380                 ConvParticipantList[I]-&gt;Ring(PartIdentity, <span class="keyword">false</span>, 1, 40, <span class="keyword">false</span>);
381                 <span class="keywordflow">while</span> (!IsRinging) {Delay(1);};
382             };
383         };
384
385         <span class="keywordflow">while</span> (!CallFinished) {Delay(1);};
386
387         printf(<span class="stringliteral">&quot;Logging out..\n&quot;</span>);
388         A-&gt;Logout(<span class="keyword">false</span>);
389
390         <span class="keywordflow">while</span> (!LoggedOut) {Delay(1);};
391         printf(<span class="stringliteral">&quot;Logout complete.\n&quot;</span>);
392     }
393     <span class="keywordflow">else</span>
394     {
395         printf(<span class="stringliteral">&quot;Account does not exist\n&quot;</span>);
396     };
397
398     printf(<span class="stringliteral">&quot;Cleaning up.\n&quot;</span>);
399     skype-&gt;stop();
400     skype-&gt;cleanup();
401     <span class="keyword">delete</span> skype;
402     <span class="keyword">delete</span> transport;
403     printf(<span class="stringliteral">&quot;Done.\n&quot;</span>);
404     <span class="keywordflow">return</span> 0;
405 };
406 </pre></div> </div>
407
408 <hr/>   
409                 <p><b>(c) Skype Technologies S.A. Confidential/Proprietary</b></p>              
410                 <p>Last updated: 18 Jun 2010</p>                
411                 </BODY>
412 </HTML>