-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDevice.ewu
2189 lines (1678 loc) · 50.8 KB
/
Device.ewu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$version 12.00
$rect <320,140,490,180>
$output false
class Contact
{
$rect <480,140,680,180>
inherited method Init()
{
pure ID = Device::Device.GetNewID();
attachobserver notifyThis, ^MessagesList.NoOfItems;
}
$rect <0,60,200,100>
property string FirstName;
$rect <0,10,200,50>
var Device::Contact next;
$rect <0,100,200,140>
property string LastName;
$rect <470,30,670,70>
method void TraceContact()
{
trace FirstName + " " + LastName;
}
$rect <0,140,200,180>
property string PhoneNumber;
$rect <200,60,400,100>
onset FirstName
{
// The value doesn't change - nothing to do.
if ( pure FirstName == value )
return;
// Remember the property's new value.
pure FirstName = value;
notifyobservers this;
}
$rect <200,100,400,140>
onset LastName
{
// The value doesn't change - nothing to do.
if ( pure LastName == value )
return;
// Remember the property's new value.
pure LastName = value;
notifyobservers this;
}
$rect <200,140,400,180>
onset PhoneNumber
{
// The value doesn't change - nothing to do.
if ( pure PhoneNumber == value )
return;
// Remember the property's new value.
pure PhoneNumber = value;
notifyobservers this;
}
$rect <0,180,200,220>
property string NameInitials;
$rect <200,180,400,220>
onset NameInitials
{
// The value doesn't change - nothing to do.
if ( pure NameInitials == value )
return;
// Remember the property's new value.
pure NameInitials = value;
notifyobservers this;
}
$rect <0,260,200,300>
property int32 ID = 0;
$rect <200,260,400,300>
onset ID
{
// The value doesn't change - nothing to do.
if ( pure ID == value )
return;
// Remember the property's new value.
pure ID = value;
}
$rect <470,80,670,120>
method Device::Contact CopyDataTo( arg Device::Contact aContact )
{
aContact.ID = ID;
aContact.LastName = LastName;
aContact.FirstName = FirstName;
aContact.PhoneNumber = PhoneNumber;
aContact.NameInitials = NameInitials;
return aContact;
}
$rect <0,220,200,260>
property bool IsFavorite;
$rect <200,220,400,260>
onset IsFavorite
{
// The value doesn't change - nothing to do.
if ( pure IsFavorite == value )
return;
// Remember the property's new value.
pure IsFavorite = value;
notifyobservers this;
}
$rect <0,300,200,340>
property bool IsMyCard = false;
$rect <200,300,400,340>
onset IsMyCard
{
// The value doesn't change - nothing to do.
if ( pure IsMyCard == value )
return;
// Remember the property's new value.
pure IsMyCard = value;
notifyobservers this;
}
$rect <0,380,200,420>
object Device::MessagesList MessagesList;
$rect <0,340,200,380>
property int32 UnreadMessagesNr = 0;
$rect <200,340,400,380>
onset UnreadMessagesNr
{
// The value doesn't change - nothing to do.
if ( pure UnreadMessagesNr == value )
return;
// Remember the property's new value.
pure UnreadMessagesNr = value;
notifyobservers this;
}
$rect <480,190,680,230>
slot notifyThis
{
notifyobservers this;
}
}
// Contact
note group Note2
{
attr Bounds = <300,0,810,360>;
}
$rect <570,180,780,220>
$output false
enum Sorting
{
$rect <10,10,210,50>
item None;
$rect <220,10,420,50>
item Ascending;
$rect <430,10,630,50>
item Descending;
}
$rect <20,40,250,80>
$output false
class DeviceClass : Templates::DeviceClass
{
$rect <0,40,200,80>
inherited method Done()
{
// The following section is intended to perform de-initialization-related operations
// in the underlying device or middleware. Consequently, the section is taken in
// account only when generating code (not during prototyping).
$if !$prototyper
var object thisObject = this;
/*
TO DO:
The following native statement is intended to enclose code to communicate with
your device API. The variable 'thisObject' contains a pointer to the actually
de-initialized Device::DeviceClass object. Use the 'thisObject' pointer to
e.g. de-register the object from the middleware if you have registered it
beforehand.
*/
native ( thisObject )
{
/*
TO DO:
Depending on your application case you call functions of the underlying
middleware (or access the device directly) in order to perform the necessary
de-initialization steps. For example, you invoke some 'C' function:
YourDevice_DeInitialize();
IMPORTANT:
----------
The variable 'thisObject' represents the actually de-initialized instance of the
Device::DeviceClass. If you have stored this object at the initialization
time (in the 'Init' method) in some global C variable or registered it by the
middleware, it is important to perform now the opposite operation. Set the
global variable to NULL or de-register 'thisObject' object from the middleware.
*/
}
$endif
}
$rect <0,0,200,40>
inherited method Init()
{
// The following section is intended to perform initialization-related operations
// in the underlying device or middleware. Consequently, the section is taken in
// account only when generating code (not during prototyping).
$if !$prototyper
var object thisObject = this;
/*
TO DO:
The following native statement is intended to enclose code to communicate with
your device API. The variable 'thisObject' contains a pointer to the actually
initialized Device::DeviceClass object. Use the 'thisObject' pointer to
e.g. register the object by the middleware as receiver of events, etc.
*/
native ( thisObject )
{
/*
TO DO:
Depending on your application case you call functions of the underlying
middleware (or access the device directly) in order to perform the necessary
initialization steps. For example, you invoke some 'C' function:
YourDevice_Initialize();
The variable 'thisObject' represents the actually initialized instance of the
Device::DeviceClass. You can store this variable e.g. in the middleware
and use it whenever the middleware needs to notify the GUI application about
some state alternation or events. In this manner, the middleware will be able
to invoke methods of the interface device object.
For example, you can store 'thisObject' in some global C variable:
// Declaration of the global C variable
XObject theDeviceObject;
// Store the instance in the global variable
theDeviceObject = thisObject;
Later use the global variable e.g. to provide the GUI application with events:
ApplicationDeviceClass__TriggerSomeEvent( theDeviceObject );
IMPORTANT:
----------
If you store 'thisObject' for later use, don't forget to implement the opposite
operation in the method 'Done'. Concrete, 'Done' should set the global variable
again to the value NULL.
*/
}
$endif
}
$rect <200,90,400,130>
property bool Microphone;
$rect <600,90,800,130>
onget Microphone
{
// Per default return the value stored already in the property.
return pure Microphone;
/*
TO DO:
If the property should return the value stored in the underlying device
or in the middleware, remove the above 'return' statement and instead do
following:
Declare a local variable to receive the value from the underlying device.
The type of the variable has to correspond to the data type of the property.
For example in case of an 'int32' property:
var int32 result;
Implement a native statement to access the value and to store it in the
variable 'result'. Then return the value. For example:
$if !$prototyper
native ( result )
{
result = YourDevice_GetSomeValue();
}
$endif
return result;
*/
}
$rect <400,90,600,130>
onset Microphone
{
// The property doesn't change -> nothing to do.
if ( pure Microphone == value )
return;
// Remember the new value in the internal memory of the property.
pure Microphone = value;
// For target code generation you will use your specific device API
// to change the affected value.
$if !$prototyper
native ( value )
{
/*
TO DO:
You can call a function of your own device API or you simply
modify a variable existing in your middleware to reflect the
new value:
YourDevice_SetSomeValue( value );
or
YourDevice_SomeVariable = value;
*/
}
$endif
// Notify all associated property observers.
notifyobservers ^Microphone;
}
// This method is intended to be called by the device to notify the GUI application \
// about an alternation of its setting or state value.
$rect <0,90,200,130>
$output true
method void UpdateMicrophone( arg bool aNewValue )
{
// Only if the reported value does differ from the one stored currently in the property.
if ( aNewValue != pure Microphone )
{
// Remember the new value in the internal memory of the property.
pure Microphone = aNewValue;
// Notify all associated property observers.
notifyobservers ^Microphone;
}
}
$rect <200,130,400,170>
property bool Speaker;
$rect <600,130,800,170>
onget Speaker
{
// Per default return the value stored already in the property.
return pure Speaker;
/*
TO DO:
If the property should return the value stored in the underlying device
or in the middleware, remove the above 'return' statement and instead do
following:
Declare a local variable to receive the value from the underlying device.
The type of the variable has to correspond to the data type of the property.
For example in case of an 'int32' property:
var int32 result;
Implement a native statement to access the value and to store it in the
variable 'result'. Then return the value. For example:
$if !$prototyper
native ( result )
{
result = YourDevice_GetSomeValue();
}
$endif
return result;
*/
}
$rect <400,130,600,170>
onset Speaker
{
// The property doesn't change -> nothing to do.
if ( pure Speaker == value )
return;
// Remember the new value in the internal memory of the property.
pure Speaker = value;
// For target code generation you will use your specific device API
// to change the affected value.
$if !$prototyper
native ( value )
{
/*
TO DO:
You can call a function of your own device API or you simply
modify a variable existing in your middleware to reflect the
new value:
YourDevice_SetSomeValue( value );
or
YourDevice_SomeVariable = value;
*/
}
$endif
// Notify all associated property observers.
notifyobservers ^Speaker;
}
// This method is intended to be called by the device to notify the GUI application \
// about an alternation of its setting or state value.
$rect <0,130,200,170>
$output true
method void UpdateSpeaker( arg bool aNewValue )
{
// Only if the reported value does differ from the one stored currently in the property.
if ( aNewValue != pure Speaker )
{
// Remember the new value in the internal memory of the property.
pure Speaker = aNewValue;
// Notify all associated property observers.
notifyobservers ^Speaker;
}
}
$rect <0,490,200,530>
object Device::ContactsList Contacts;
$rect <0,570,200,610>
object Device::ContactsList History;
$rect <0,530,200,570>
object Device::ContactsList Favorites;
$rect <200,190,400,230>
method void SendCallFromContact( arg Device::Contact aContact )
{
var Device::HistoryContact historyContact = new Device::HistoryContact;
aContact.CopyDataTo( historyContact );
historyContact.TimeOfCall = (new Core::Time).CurrentTime;
historyContact.CallState = Device::CallState.Dialing;
historyContact.CallDirection = Device::CallDirection.Outgoing;
OngoingCalls.AddLast( historyContact );
// if call fails
if ( ! Device::PhoneServer.StartCall( historyContact.PhoneNumber ))
{
historyContact.CallState = Device::CallState.Missed;
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
}
$rect <0,210,200,250>
method void ReceiveCall( arg string aPhoneNumber )
{
var Device::Contact contact = Contacts.FindByPhoneNumber( aPhoneNumber );
var Device::HistoryContact historyContact = new Device::HistoryContact;
//contact not found in contact list, than save it by number
if ( contact == null )
{
historyContact.LastName = aPhoneNumber;
historyContact.PhoneNumber = aPhoneNumber;
}
else
{
contact.CopyDataTo( historyContact );
}
historyContact.TimeOfCall = (new Core::Time).CurrentTime;
historyContact.CallState = Device::CallState.Dialing;
historyContact.CallDirection = Device::CallDirection.Incoming;
OngoingCalls.AddLast( historyContact );
}
$rect <200,230,400,270>
method void SendCallFromNumber( arg string aPhoneNumber )
{
var Device::Contact contact = Contacts.FindByPhoneNumber( aPhoneNumber );
var Device::HistoryContact historyContact = new Device::HistoryContact;
if ( contact == null )
{
historyContact.LastName = aPhoneNumber;
historyContact.PhoneNumber = aPhoneNumber;
}
else
{
contact.CopyDataTo( historyContact );
}
historyContact.TimeOfCall = (new Core::Time).CurrentTime;
historyContact.CallState = Device::CallState.Dialing;
historyContact.CallDirection = Device::CallDirection.Outgoing;
OngoingCalls.AddLast( historyContact );
/// if call fails
if ( ! Device::PhoneServer.StartCall( historyContact.PhoneNumber ))
{
historyContact.CallState = Device::CallState.Missed;
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
}
$rect <200,570,400,610>
object Device::ContactsList OngoingCalls;
$rect <500,490,700,530>
method int32 GetNewID()
{
LastID +=1;
return LastID;
}
$rect <700,490,900,530>
var int32 LastID = 0;
$rect <200,350,400,390>
method void SendEndCall( arg string aPhoneNumber )
{
var Device::HistoryContact historyContact = (Device::HistoryContact)Device::Device.OngoingCalls.GetContactAtIndex( 0 );
if ( historyContact.PhoneNumber != aPhoneNumber )
return;
if ( historyContact.CallState == Device::CallState.Dialing )
{
historyContact.CallState = Device::CallState.Cancelled;
Device::PhoneServer.CancelledCall( historyContact.PhoneNumber );
}
else if ( historyContact.CallState == Device::CallState.Speaking )
{
historyContact.CallState = Device::CallState.EndCall;
historyContact.EndTime = (new Core::Time).CurrentTime;
Device::PhoneServer.EndCall( historyContact.PhoneNumber );
}
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
$rect <200,270,400,310>
method void SendCallAnswer( arg Device::HistoryContact aContact )
{
aContact.CallState = Device::CallState.Speaking;
aContact.StartTime = (new Core::Time).CurrentTime;
if( !Device::PhoneServer.AnswerCall( aContact.PhoneNumber ))
{
aContact.CallState = Device::CallState.Missed;
History.AddFirst( aContact );
OngoingCalls.Remove( aContact );
}
//esetleg ha megszakad a vonal akkor tegye be fail
}
$rect <0,270,200,310>
method void ReceiveCallAnswered( arg string aPhoneNumber )
{
var Device::HistoryContact historyContact = (Device::HistoryContact)Device::Device.OngoingCalls.GetContactAtIndex( 0 );
if ( historyContact.PhoneNumber != aPhoneNumber )
return;
historyContact.CallState = Device::CallState.Speaking;
historyContact.StartTime = (new Core::Time).CurrentTime;
}
$rect <0,310,200,350>
method void ReceiveCallRejected( arg string aPhoneNumber )
{
var Device::HistoryContact historyContact = (Device::HistoryContact)Device::Device.OngoingCalls.GetContactAtIndex( 0 );
if ( historyContact.PhoneNumber != aPhoneNumber )
return;
if ( historyContact.CallState == Device::CallState.Dialing )
{
historyContact.CallState = Device::CallState.Rejected;
}
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
$rect <200,310,400,350>
method void SendCallRejected( arg string aPhoneNumber )
{
var Device::HistoryContact historyContact = (Device::HistoryContact)Device::Device.OngoingCalls.GetContactAtIndex( 0 );
if ( historyContact.PhoneNumber != aPhoneNumber )
return;
if ( historyContact.CallState == Device::CallState.Dialing )
{
historyContact.CallState = Device::CallState.Rejected;
}
Device::PhoneServer.RejectCall( historyContact.PhoneNumber );
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
$rect <0,350,200,390>
method void ReceiveEndCall( arg string aPhoneNumber )
{
var Device::HistoryContact historyContact = (Device::HistoryContact)Device::Device.OngoingCalls.GetContactAtIndex( 0 );
if ( historyContact.PhoneNumber != aPhoneNumber )
return;
if ( historyContact.CallState == Device::CallState.Dialing )
{
historyContact.CallState = Device::CallState.Cancelled;
}
else if ( historyContact.CallState == Device::CallState.Speaking )
{
historyContact.CallState = Device::CallState.EndCall;
historyContact.EndTime = (new Core::Time).CurrentTime;
}
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
$rect <880,-10,1080,30>
var Device::PhoneServerClass server = Device::PhoneServer;
$rect <900,100,1100,140>
property Device::Contact MyContact = null;
$rect <900,140,1100,180>
onset MyContact
{
if ( pure MyContact == value )
return;
pure MyContact = value;
if ( pure MyContact != null )
{
signal Device::PhoneServer.PollServerData.StartTimer;
}
notifyobservers ^MyContact;
trace "MyCard: " + MyContact.FirstName + MyContact.LastName + MyContact.PhoneNumber;
}
$rect <480,190,680,230>
method void ReceiveMessage( arg string aSenderNumber, arg string aMessageContent )
{
//megnezem ha megkapom a contactot meglevo beszelgetesek kozott
var Device::Contact contactSender = MessageHistory.FindByPhoneNumber( aSenderNumber );
//ha nem akkor megkeresem a contactlistaba
if ( contactSender == null )
{
var Device::Contact contact = Contacts.FindByPhoneNumber( aSenderNumber );
if ( contact == null )
{
contact = new Device::Contact;
contact.FirstName = aSenderNumber;
contact.PhoneNumber = aSenderNumber;
contact.NameInitials = Contacts.GetInitials( aSenderNumber, "" );
}
contactSender = contact;
}
//ha igen akkor kiveszem a beszelgetesekbol
else
{
MessageHistory.Remove( contactSender );
}
//letre hozok egy uzenetet
var Device::Message message = new Device::Message;
message.Sender = contactSender;
message.Receiver = MyContact;
message.TimeSent = ( new Core::Time).CurrentTime;
message.MessageContent = aMessageContent;
message.IsSeen = false;
//hozza rendeleme az uzenetet a contacthoz
contactSender.MessagesList.Add( message );
contactSender.UnreadMessagesNr ++;
//hozza adom az uj/frissitett contactot a beszelgetesekhez
MessageHistory.AddFirst( contactSender );
MessageHistory.FindUnreadMessagesNr();
}
$rect <670,190,870,230>
method void SendMessage( arg Device::Contact aContact, arg string aMessageContent )
{
//letre hozom az uzenetet
var Device::Message message = new Device::Message;
message.Sender = MyContact;
message.Receiver = aContact;
message.TimeSent = ( new Core::Time).CurrentTime;
message.MessageContent = aMessageContent;
message.IsSeen = true;
//hozza rendelem a contachoz
aContact.MessagesList.Add( message );
//megnezem ha megkapom a contactot a meglevo beszelgetesek kozott
var Device::Contact contact = MessageHistory.FindMatchingIDContact( aContact );
//ha igen kitrolom
if ( contact != null )
{
MessageHistory.Remove( aContact );
}
//hozza adom az uj/frissitett contactot a beszelgetesekhez
MessageHistory.AddFirst( aContact );
trace "Device/SendMessage: " + aContact.PhoneNumber + " " + aMessageContent;
Device::PhoneServer.SendMessage( aContact.PhoneNumber, aMessageContent );
}
$rect <0,610,200,650>
object Device::HistoryMessagesList MessageHistory;
$rect <0,390,200,430>
method void ReceiveMissedCall( arg string aPhoneNumber )
{
var Device::HistoryContact historyContact = (Device::HistoryContact)Device::Device.OngoingCalls.GetContactAtIndex( 0 );
if ( historyContact.PhoneNumber != aPhoneNumber )
return;
if ( historyContact.CallState == Device::CallState.Dialing )
{
historyContact.CallState = Device::CallState.Missed;
historyContact.EndTime = (new Core::Time).CurrentTime;
}
History.AddFirst( historyContact );
OngoingCalls.Remove( historyContact );
}
$rect <200,490,380,530>
object Device::ContactsList FilteredContacts;
}
$rect <20,80,250,120>
autoobject Device::DeviceClass Device;
// Device
note group Note3
{
attr Bounds = <0,0,290,200>;
}
$rect <550,140,750,180>
$output false
enum CallState
{
$rect <10,10,210,50>
item None;
$rect <10,130,210,170>
item Missed;
$rect <10,170,210,210>
item Cancelled;
$rect <15,65,215,105>
item Dialing;
$rect <10,210,210,250>
item Rejected;
$rect <10,264,210,304>
item Speaking;
$rect <260,170,460,210>
item EndCall;
$rect <250,70,450,110>
item Fail;
}
$rect <20,130,250,170>
$variant $SimulateData
vclass DeviceSimulation : Device::DeviceClass
{
$rect <0,0,200,40>
inherited method Init()
{
postsignal CreateContactData;
}
$rect <0,90,200,130>
method void CreateContact( arg string aLastName, arg string aFirstName, arg string aPhoneNumber )
{
var Device::Contact contact = new Device::Contact;
contact.FirstName = aFirstName;
contact.LastName = aLastName;
contact.PhoneNumber = aPhoneNumber;
contact.NameInitials = Contacts.GetInitials( aLastName, aFirstName );
Contacts.AddLast( contact );
}
$rect <0,130,200,170>
method void CreateContactFav( arg string aLastName, arg string aFirstName, arg string aPhoneNumber )
{
var Device::Contact contact = new Device::Contact;
contact.FirstName = aFirstName;
contact.LastName = aLastName;
contact.PhoneNumber = aPhoneNumber;
contact.NameInitials = Favorites.GetInitials( aLastName, aFirstName );
Favorites.AddLast( contact );
}
$rect <0,170,200,210>
method void CreateContact2( arg string aLastName, arg string aFirstName, arg string aPhoneNumber )
{
var Device::HistoryContact contact = new Device::HistoryContact;
contact.FirstName = aFirstName;
contact.LastName = aLastName;
contact.PhoneNumber = aPhoneNumber;
contact.CallState = Device::CallState.Dialing;
History.AddFirst( contact );
}
$rect <0,50,200,90>
slot CreateContactData
{
CreateContact( "Smith", "Noah", "0723");
CreateContact( "Jones", "Oliver", "0745");
CreateContact( "Williams", "Amelia", "0759876234");
CreateContact( "Taylor", "Leo", "0713243546");
CreateContact( "Brown", "Nancy", "0754981234");
CreateContact( "Davies", "James", "0756788890");
CreateContact( "Addison", "Michaek", "0740987662");
CreateContact( "Kennedy", "Jane", "0755545654");
Contacts.insertionSort();
Contacts.CancelSearch();
//postsignal Message;
}
$rect <40,275,240,315>
slot Message
{
var Device::Message msg = new Device::Message;
var Device::Contact cont = new Device::Contact;
cont.FirstName = "smith";
cont.LastName = "noah";
cont.PhoneNumber = "12";
cont.NameInitials ="sn";
var Device::Contact cont1 = new Device::Contact;
cont1.FirstName = "amy";
cont1.LastName = "bruce";
cont1.PhoneNumber = "22";
cont1.NameInitials ="ab";
msg.Sender = cont;
msg.Receiver = cont1;
msg.MessageContent = "hello";
cont1.MessagesList.Add( msg );
Device::Device.MessageHistory.AddFirst( cont1 );
}
}
$rect <350,180,520,220>
$output false
class HistoryContact : Device::Contact
{
$rect <10,40,210,80>
property Device::CallState CallState = Device::CallState.None;
$rect <210,40,410,80>
onset CallState
{
// The value doesn't change - nothing to do.
if ( pure CallState == value )
return;
// Remember the property's new value.