Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote-tracking branch 'origin/master' into ThreeTwoClipRect

  • Loading branch information...
commit 56570d2f9f0b90bae8bf0309f7f279bb1ff173c9 2 parents 9fa1cd1 + acd3c93
authored September 13, 2012

Showing 52 changed files with 1,360 additions and 242 deletions. Show diff stats Hide diff stats

  1. 4  .gitignore
  2. 1  intlibs/hashmap/hashmap.cpp
  3. 8  intlibs/stabs/stabs_builtins.cpp
  4. 4  intlibs/stabs/stabs_type.h
  5. 2  libs/MAUtil/mauuid.h
  6. 4  rules/mosync_exe.rb
  7. 2  runtimes/cpp/base/AudioChannel.h
  8. 74  runtimes/cpp/core/Core.cpp
  9. 2  runtimes/cpp/core/sld.cpp
  10. 2  runtimes/cpp/platforms/sdl/netImpl.cpp
  11. 7  runtimes/cpp/platforms/symbian/inc/AppUi.h
  12. 14  runtimes/cpp/platforms/symbian/inc/AppView.h
  13. 16  runtimes/cpp/platforms/symbian/inc/Platform.h
  14. 5  runtimes/cpp/platforms/symbian/inc/SyscallImpl.h
  15. 5  runtimes/cpp/platforms/symbian/inc/config_platform.h.example
  16. 1  runtimes/cpp/platforms/symbian/inc/config_platform.h.guido.example
  17. 35  runtimes/cpp/platforms/symbian/inc/netImpl.h
  18. 2  runtimes/cpp/platforms/symbian/inc/symbian_errors.h
  19. 216  runtimes/cpp/platforms/symbian/server/Autostart.cpp
  20. 13  runtimes/cpp/platforms/symbian/server/ClientServer.h
  21. 76  runtimes/cpp/platforms/symbian/server/MoSyncServer.cpp
  22. 34  runtimes/cpp/platforms/symbian/server/MoSyncServer.h
  23. 10  runtimes/cpp/platforms/symbian/server/MoSyncServer.mmp
  24. 10  runtimes/cpp/platforms/symbian/server/MoSyncServer.pkg
  25. BIN  runtimes/cpp/platforms/symbian/server/MoSyncServer_Express_Signed.sis
  26. 7  runtimes/cpp/platforms/symbian/server/MoSyncServer_startup.rss
  27. 108  runtimes/cpp/platforms/symbian/server/NetworkInfo.h
  28. 4  runtimes/cpp/platforms/symbian/sis-ed3/MoSync-guido.pkg
  29. 8  runtimes/cpp/platforms/symbian/sis-ed3/MoSync-server.pkg
  30. 8  runtimes/cpp/platforms/symbian/sis-ed3/MoSync-template.pkg
  31. 4  runtimes/cpp/platforms/symbian/sis-ed3/MoSync.pkg
  32. 4  runtimes/cpp/platforms/symbian/sis-ed5/MoSync-template.pkg
  33. 4  runtimes/cpp/platforms/symbian/sis-ed5/MoSync.pkg
  34. 60  runtimes/cpp/platforms/symbian/src/AppUi.cpp
  35. 10  runtimes/cpp/platforms/symbian/src/AppView.cpp
  36. 47  runtimes/cpp/platforms/symbian/src/Client.cpp
  37. 35  runtimes/cpp/platforms/symbian/src/SyscallImpl.cpp
  38. 278  runtimes/cpp/platforms/symbian/src/netImpl.cpp
  39. 160  testPrograms/iap/main.cpp
  40. 66  testPrograms/keyCapture/main.cpp
  41. 54  testPrograms/networkStatus/main.cpp
  42. 2  tools/ProfileConverter/conv.rb
  43. 1  tools/RuntimeBuilder/BuildS60.rb
  44. 4  tools/debugger/cmd_data.cpp
  45. 8  tools/debugger/cmd_stack.cpp
  46. 8  tools/debugger/cmd_var.cpp
  47. 30  tools/debugger/debugger.cpp
  48. 1  tools/debugger/expression_tree.h
  49. 6  tools/debugger/opHandler.h
  50. 132  tools/idl2/maapi.idl
  51. 1  tools/package/android.cpp
  52. 5  tools/rcomp/inc/rcscan.h
4  .gitignore
@@ -68,6 +68,7 @@ wormhole.js
68 68
 
69 69
 /tools/ReleasePackageBuild/run.bat
70 70
 /tools/ReleasePackageBuild/setcurrev.bat
  71
+/tools/ReleasePackageBuild/build_package_tools/mosync_bin/version.dat
71 72
 
72 73
 /tools/DocbookIndexer/src/*.c
73 74
 /tools/DocbookIndexer/src/*.s
@@ -102,6 +103,7 @@ wormhole.js
102 103
 /libs/newlib/libc/sys/mosync/maapi_defs.h
103 104
 
104 105
 /libs/Wormhole/jslib/html5
  106
+/libs/Wormhole/jslib/mosync-constants.js
105 107
 
106 108
 /testPrograms/_masterdump.s
107 109
 /testPrograms/temp.s
@@ -238,4 +240,4 @@ wormhole.js
238 240
 /runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Advertising.Mobile
239 241
 /runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Advertising.Mobile.UI
240 242
 /runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Phone.Controls
241  
-/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Phone.Controls.Maps
  243
+/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Phone.Controls.Maps
1  intlibs/hashmap/hashmap.cpp
@@ -92,6 +92,7 @@ void HashMapBase::close() {
92 92
 	}
93 93
 	free(m.base);
94 94
 	m.base = NULL;
  95
+	memset(&m, 0, sizeof(m));
95 96
 	//DebugMarkEnd();
96 97
 	LOG_HASH("HashMapBase::close() complete.\n\n");
97 98
 }
8  intlibs/stabs/stabs_builtins.cpp
@@ -72,14 +72,14 @@ void Int::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) con
72 72
 }
73 73
 
74 74
 void Char::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
75  
-	
  75
+
76 76
 	if(fmt==eNatural) {
77 77
 		printPrimitiveByFormat<char>(pf, data, "%i", eDecimal, eDecimal);
78 78
 		char c = *(char*)data;
79 79
 		if(c>=0 && c<=32) pf(" \'\\\\%o\'", c);
80 80
 		else pf(" \'%c\'", c);
81 81
 	} else {
82  
-		printPrimitiveByFormat<char>(pf, data, "%i", fmt, fmt);	
  82
+		printPrimitiveByFormat<char>(pf, data, "%i", fmt, fmt);
83 83
 	}
84 84
 }
85 85
 
@@ -96,11 +96,11 @@ void LongUnsignedInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFor
96 96
 }
97 97
 
98 98
 void LongLongInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
99  
-	printPrimitiveByFormat<s64>(pf, data, "%"INT64PREFIX"i", fmt, TypeBase::eDecimal);
  99
+	printPrimitiveByFormat<s64>(pf, data, "%" INT64PREFIX "i", fmt, TypeBase::eDecimal);
100 100
 }
101 101
 
102 102
 void LongLongUnsignedInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
103  
-	printPrimitiveByFormat<u64>(pf, data, "%"INT64PREFIX"u", fmt, TypeBase::eDecimal);
  103
+	printPrimitiveByFormat<u64>(pf, data, "%" INT64PREFIX "u", fmt, TypeBase::eDecimal);
104 104
 }
105 105
 
106 106
 void ShortInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
4  intlibs/stabs/stabs_type.h
@@ -119,9 +119,9 @@ void printPrimitiveByFormat(printfPtr pf, const void* data, const char* decimalF
119 119
 	} else if(fmt == TypeBase::eDecimal) {
120 120
 		pf(decimalFmt, t);
121 121
 	} else if(fmt == TypeBase::eOctal) {
122  
-		pf("%"PFZT_PREFIX"o", (size_t)t);
  122
+		pf("%" PFZT_PREFIX "o", (size_t)t);
123 123
 	} else if(fmt == TypeBase::eHexadecimal) {
124  
-		pf("0x%"PFZT_PREFIX"x", (size_t)t);
  124
+		pf("0x%" PFZT_PREFIX "x", (size_t)t);
125 125
 	} else if(fmt == TypeBase::eBinary) {
126 126
 		u64 tt = (u64)(size_t)t;
127 127
 		int numBits = (int)(sizeof(T)<<3)-1;
2  libs/MAUtil/mauuid.h
@@ -26,7 +26,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 26
 * Defines a MAUUID that follows the Bluetooth standard of UUIDs.
27 27
 * The lower 96 bits are constant.
28 28
 */
29  
-#define DEFINE_BTMAUUID(name, uuid16) static const MAUUID name = {{ uuid16, 0x00001000, 0x80000080, 0x5F9B34FB }}
  29
+#define DEFINE_BTMAUUID(name, uuid16) static const MAUUID name = {{ uuid16, 0x00001000, (int)0x80000080, 0x5F9B34FB }}
30 30
 
31 31
 DEFINE_BTMAUUID(Bluetooth_Base_MAUUID, 0);
32 32
 
4  rules/mosync_exe.rb
@@ -168,9 +168,9 @@ def setup3(all_objects, have_cppfiles)
168 168
 			@prerequisites << @resourceTask
169 169
 		end
170 170
 		if(USE_NEWLIB)
171  
-			default(:DEFAULT_LIBS, ["newlib","rescompiler"])
  171
+			default(:DEFAULT_LIBS, ['newlib'])
172 172
 		else
173  
-			default(:DEFAULT_LIBS, ["mastd","rescompiler"])
  173
+			default(:DEFAULT_LIBS, ['mastd'])
174 174
 		end
175 175
 
176 176
 		# libs
2  runtimes/cpp/base/AudioChannel.h
@@ -49,6 +49,8 @@ class AudioChannel
49 49
      */
50 50
     AudioChannel ( int s, AudioSource* audioSource = NULL );
51 51
 
  52
+		virtual ~AudioChannel() {}
  53
+
52 54
     /**
53 55
      * Set the channel audio source
54 56
      *
74  runtimes/cpp/core/Core.cpp
@@ -124,7 +124,7 @@ class VMCoreInt : public VMCore {
124 124
 	int csRegs[128];
125 125
 	int *csMem;
126 126
 
127  
-	struct StateChange { 
  127
+	struct StateChange {
128 128
 		int type; // 0 = reg state change, 1 = mem state change
129 129
 		int ip, instCount;
130 130
 		struct regdata
@@ -136,7 +136,7 @@ class VMCoreInt : public VMCore {
136 136
 			int address;
137 137
 			unsigned char before, after;
138 138
 		};
139  
-	
  139
+
140 140
 		regdata regdata;
141 141
 		memdata memdata;
142 142
 	};
@@ -144,7 +144,7 @@ class VMCoreInt : public VMCore {
144 144
 #define STATE_BUFFER_SIZE 1024
145 145
 	StateChange stateChanges[STATE_BUFFER_SIZE];
146 146
 	int curStateChange;
147  
-	
  147
+
148 148
 	void initStateChange() {
149 149
 		csMem = 0;
150 150
 		curStateChange = 0;
@@ -215,7 +215,7 @@ class VMCoreInt : public VMCore {
215 215
 
216 216
 	void logStateChange(int ip) {
217 217
 		//LOG("logStateChange(0x%x)\n", ip);
218  
-		
  218
+
219 219
 		if(!csMem) {
220 220
 			curStateChange = 0;
221 221
 #if 0
@@ -273,7 +273,7 @@ class VMCoreInt : public VMCore {
273 273
 		while(i--) {
274 274
 			if(csRegs[i] != regs[i]) {
275 275
 				//LOG("R%d: 0x%x != %d\n", i, csRegs[i], gCore->regs[i]);
276  
-				
  276
+
277 277
 				stateChanges[curStateChange].type = 0;
278 278
 				stateChanges[curStateChange].ip = ip;
279 279
 				stateChanges[curStateChange].instCount = stateChangeInstCount;
@@ -318,7 +318,7 @@ class VMCoreInt : public VMCore {
318 318
 	byte* rIP;
319 319
 
320 320
 	int VM_Yield;
321  
-	
  321
+
322 322
 	void* customEventPointer;
323 323
 
324 324
 #ifdef USE_ARM_RECOMPILER
@@ -617,7 +617,7 @@ class VMCoreInt : public VMCore {
617 617
 	void GenConstTable() {
618 618
 		int n, p;
619 619
 		int mask;
620  
-		
  620
+
621 621
 		for(p=0; p<32; p++) {
622 622
 			regs[p] = 0;
623 623
 		}
@@ -658,7 +658,7 @@ class VMCoreInt : public VMCore {
658 658
 		FileStream mod(modfile);
659 659
 		if(!LoadVM(mod))
660 660
 			return false;
661  
-			
  661
+
662 662
 		FileStream res(resfile);
663 663
 		if(!mSyscall.loadResources(res, resfile))
664 664
 			return false;
@@ -751,12 +751,12 @@ class VMCoreInt : public VMCore {
751 751
 		LOG("Recompiler Closed!\n");
752 752
 #endif
753 753
 	}
754  
-	
  754
+
755 755
 	//****************************************
756 756
 	//Loader
757 757
 	//****************************************
758 758
 	int LoadVM(Stream& file) {
759  
-	
  759
+
760 760
 		LOG("LoadVM\n");
761 761
 
762 762
 		TEST(file.isOpen());
@@ -817,37 +817,37 @@ class VMCoreInt : public VMCore {
817 817
 		DUMPHEX(Head.DataSize);
818 818
 		if(Head.DataLen > 0) {
819 819
 			DATA_SEGMENT_SIZE = nextPowerOf2(16, Head.DataSize);
820  
-			
  820
+
821 821
 #ifdef _android
822 822
 			/*
823 823
 			jclass cls = mJniEnv->GetObjectClass(mJThis);
824 824
 			jmethodID methodID = mJniEnv->GetMethodID(cls, "generateDataSection", "(I)Ljava/nio/ByteBuffer;");
825 825
 			if (methodID == 0) return -1;
826 826
 			jobject jo = mJniEnv->CallObjectMethod(mJThis, methodID, (DATA_SEGMENT_SIZE));
827  
-			
  827
+
828 828
 			// if the java object jo is NULL at this point there was not enought memory to allocate the data section
829  
-			if(jo == NULL) 
  829
+			if(jo == NULL)
830 830
 			{
831 831
 				__android_log_write(ANDROID_LOG_INFO, "MoSync Syscall", "Deta section was allocated, not enough memory!");
832 832
 				return 0;
833 833
 			}
834  
-			
  834
+
835 835
 			mem_ds = (int*)mJniEnv->GetDirectBufferAddress(jo);
836 836
 			mJniEnv->DeleteLocalRef(cls);
837 837
 			*/
838 838
 
839 839
 			char* buffer = (char*)malloc(DATA_SEGMENT_SIZE);
840 840
 			if(buffer == NULL) return 0;
841  
-			
  841
+
842 842
 			jobject byteBuffer = mJniEnv->NewDirectByteBuffer((void*)buffer, DATA_SEGMENT_SIZE);
843 843
 			if(byteBuffer == NULL) return 0;
844  
-			
  844
+
845 845
 			jclass cls = mJniEnv->GetObjectClass(mJThis);
846 846
 			jmethodID methodID = mJniEnv->GetMethodID(cls, "generateDataSection", "(Ljava/nio/ByteBuffer;)Z");
847 847
 			if (methodID == 0) return 0;
848  
-			
  848
+
849 849
 			jboolean ret = mJniEnv->CallBooleanMethod(mJThis, methodID, byteBuffer);
850  
-			if(false == ret) 
  850
+			if(false == ret)
851 851
 			{
852 852
 				__android_log_write(ANDROID_LOG_INFO, "MoSync Syscall", "Deta section was allocated, not enough memory!");
853 853
 				return 0;
@@ -857,10 +857,10 @@ class VMCoreInt : public VMCore {
857 857
 
858 858
 			mJniEnv->DeleteLocalRef(cls);
859 859
 			mJniEnv->DeleteLocalRef(byteBuffer);
860  
-		
  860
+
861 861
 #else
862 862
 			mem_ds = new int[DATA_SEGMENT_SIZE / sizeof(int)];
863  
-#endif		
  863
+#endif
864 864
 
865 865
 			if(!mem_ds) BIG_PHAT_ERROR(ERR_OOM);
866 866
 			TEST(file.read(mem_ds, Head.DataLen));
@@ -893,7 +893,7 @@ class VMCoreInt : public VMCore {
893 893
 #endif
894 894
 
895 895
 		customEventPointer = ((char*)mem_ds) + (Head.DataSize - maxCustomEventSize);
896  
-		
  896
+
897 897
 #ifdef USE_ARM_RECOMPILER
898 898
 		//initRecompilerVariables();
899 899
 #ifndef _android
@@ -1017,7 +1017,7 @@ void WRITE_REG(int reg, int value) {
1017 1017
 
1018 1018
 	void checkProtection(uint address, uint size) const {
1019 1019
 		if(protectionEnabled) {
1020  
-		for(uint i = address; i < address+size; i++) 
  1020
+		for(uint i = address; i < address+size; i++)
1021 1021
 			if(GET_PROTECTION(i)) {
1022 1022
 				BIG_PHAT_ERROR(ERR_MEMORY_PROTECTED);
1023 1023
 			}
@@ -1040,7 +1040,7 @@ void WRITE_REG(int reg, int value) {
1040 1040
 			((address & (sizeof(T) - 1)) != 0) || //alignment check
1041 1041
 			(address < 4))	//NULL pointer check
1042 1042
 		{
1043  
-			LOG("Memory reference validation failed. Size %"PFZT", address 0x%x\n",
  1043
+			LOG("Memory reference validation failed. Size %" PFZT ", address 0x%x\n",
1044 1044
 				sizeof(T), address);
1045 1045
 			if((address & (sizeof(T) - 1)) != 0) {
1046 1046
 				BIG_PHAT_ERROR(ERR_MEMORY_ALIGNMENT);
@@ -1051,7 +1051,7 @@ void WRITE_REG(int reg, int value) {
1051 1051
 			}
1052 1052
 		}
1053 1053
 
1054  
-#ifdef MEMORY_PROTECTION	
  1054
+#ifdef MEMORY_PROTECTION
1055 1055
 		checkProtection(address, sizeof(T));
1056 1056
 #endif
1057 1057
 
@@ -1066,19 +1066,19 @@ void WRITE_REG(int reg, int value) {
1066 1066
 	//****************************************
1067 1067
 #define PTR2ADDRESS(ptr) ((unsigned)((char*)ptr - (char*)mem_ds))
1068 1068
 	void ValidateMemStringAddress(unsigned address) const {
1069  
-#ifdef MEMORY_PROTECTION	
  1069
+#ifdef MEMORY_PROTECTION
1070 1070
 		int initialAddr = address;
1071 1071
 #endif
1072 1072
 		do {
1073 1073
 			if(address >= DATA_SEGMENT_SIZE)
1074 1074
 				BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1075 1075
 		} while(RAW_MEMREF(char, address++) != 0);
1076  
-#ifdef MEMORY_PROTECTION	
  1076
+#ifdef MEMORY_PROTECTION
1077 1077
 		checkProtection(initialAddr, address-initialAddr);
1078 1078
 #endif
1079 1079
 	}
1080 1080
 	void ValidateMemWStringAddress(unsigned address) const {
1081  
-#ifdef MEMORY_PROTECTION	
  1081
+#ifdef MEMORY_PROTECTION
1082 1082
 		int initialAddr = address;
1083 1083
 #endif
1084 1084
 		address -= 2;
@@ -1087,7 +1087,7 @@ void WRITE_REG(int reg, int value) {
1087 1087
 			if(address >= DATA_SEGMENT_SIZE)
1088 1088
 				BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1089 1089
 		} while(RAW_MEMREF(short, address) != 0);
1090  
-#ifdef MEMORY_PROTECTION	
  1090
+#ifdef MEMORY_PROTECTION
1091 1091
 		checkProtection(initialAddr, address-initialAddr);
1092 1092
 #endif
1093 1093
 	}
@@ -1098,7 +1098,7 @@ void WRITE_REG(int reg, int value) {
1098 1098
 				BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1099 1099
 		} while(RAW_MEMREF(char, address++) != 0);
1100 1100
 
1101  
-#ifdef MEMORY_PROTECTION	
  1101
+#ifdef MEMORY_PROTECTION
1102 1102
 		checkProtection(PTR2ADDRESS(ptr), address-PTR2ADDRESS(ptr));
1103 1103
 #endif
1104 1104
 		return address - PTR2ADDRESS(ptr) - 1;
@@ -1108,7 +1108,7 @@ void WRITE_REG(int reg, int value) {
1108 1108
 		if(address >= DATA_SEGMENT_SIZE || (address+size) >= DATA_SEGMENT_SIZE ||
1109 1109
 			size > DATA_SEGMENT_SIZE)
1110 1110
 			BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1111  
-#ifdef MEMORY_PROTECTION	
  1111
+#ifdef MEMORY_PROTECTION
1112 1112
 		checkProtection(address, size);
1113 1113
 #endif
1114 1114
 	}
@@ -1117,7 +1117,7 @@ void WRITE_REG(int reg, int value) {
1117 1117
 		if(uint(address) >= DATA_SEGMENT_SIZE || uint(address+size) >= DATA_SEGMENT_SIZE ||
1118 1118
 			uint(size) > DATA_SEGMENT_SIZE)
1119 1119
 			BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1120  
-#ifdef MEMORY_PROTECTION	
  1120
+#ifdef MEMORY_PROTECTION
1121 1121
 		checkProtection(address, size);
1122 1122
 #endif
1123 1123
 		return ((char*)mem_ds) + address;
@@ -1144,7 +1144,7 @@ void WRITE_REG(int reg, int value) {
1144 1144
 			if(address >= DATA_SEGMENT_SIZE)
1145 1145
 				BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1146 1146
 		} while(RAW_MEMREF(char, address++) != 0);
1147  
-#ifdef MEMORY_PROTECTION	
  1147
+#ifdef MEMORY_PROTECTION
1148 1148
 		checkProtection(a, address-a);
1149 1149
 #endif
1150 1150
 		return ((char*)mem_ds) + a;
@@ -1158,7 +1158,7 @@ void WRITE_REG(int reg, int value) {
1158 1158
 			if(address >= DATA_SEGMENT_SIZE)
1159 1159
 				BIG_PHAT_ERROR(ERR_MEMORY_OOB);
1160 1160
 		} while(RAW_MEMREF(wchar, address) != 0);
1161  
-#ifdef MEMORY_PROTECTION	
  1161
+#ifdef MEMORY_PROTECTION
1162 1162
 		checkProtection(a, address-a);
1163 1163
 #endif
1164 1164
 		return (wchar*)(((char*)mem_ds) + a);
@@ -1315,7 +1315,7 @@ void WRITE_REG(int reg, int value) {
1315 1315
 		initStateChange();
1316 1316
 #endif
1317 1317
 	}
1318  
-	
  1318
+
1319 1319
 	virtual ~VMCoreInt() {
1320 1320
 #ifdef GDB_DEBUG
1321 1321
 		if(mGdbOn)
@@ -1375,7 +1375,7 @@ void WRITE_REG(int reg, int value) {
1375 1375
 #endif
1376 1376
 
1377 1377
 	}
1378  
-	
  1378
+
1379 1379
 private:
1380 1380
 	Syscall& mSyscall;
1381 1381
 };
@@ -1460,7 +1460,7 @@ void RunFrom(VMCore* core, int ip) {
1460 1460
 
1461 1461
 // ***************************************
1462 1462
 // Debugger
1463  
-// ***************************************	
  1463
+// ***************************************
1464 1464
 /*
1465 1465
 #ifdef ENABLE_DEBUGGER
1466 1466
 bool initDebugger(VMCore* core, int port) {
@@ -1472,7 +1472,7 @@ void closeDebugger() {
1472 1472
 }
1473 1473
 #endif
1474 1474
 */
1475  
-// ***************************************	
  1475
+// ***************************************
1476 1476
 
1477 1477
 void Run2(VMCore* core) {
1478 1478
 	CORE->Run2();
2  runtimes/cpp/core/sld.cpp
@@ -265,7 +265,7 @@ bool loadSLD(const char* filename) {
265 265
 	while(1) {
266 266
 		TEST(readLine(buffer, BUFSIZE, file));
267 267
 		LineMapping m;
268  
-		if(sscanf(buffer, "%x:%i:%"PFZT"i", &m.ip, &m.line, &m.file) != 3)
  268
+		if(sscanf(buffer, "%x:%i:%" PFZT "i", &m.ip, &m.line, &m.file) != 3)
269 269
 			break;
270 270
 		std::pair<std::set<LineMapping>::iterator, bool> res = sLineSet.insert(m);
271 271
 		TEST(res.second);
2  runtimes/cpp/platforms/sdl/netImpl.cpp
@@ -63,7 +63,7 @@ static void dumpSslErrors() {
63 63
 }
64 64
 
65 65
 #define TSSL_CUSTOM(func, test, action) { ssize_t _res = (size_t)(func); if(_res test) { IN_FILE_ON_LINE;\
66  
-	LOG("OpenSSL error %"PFSZT"\n", _res); dumpSslErrors(); action; } }
  66
+	LOG("OpenSSL error %" PFSZT "\n", _res); dumpSslErrors(); action; } }
67 67
 
68 68
 #define TSSL(func, test) TSSL_CUSTOM(func, test, return CONNERR_SSL)
69 69
 #define TSSLZ(func) TSSL(func, == 0)
7  runtimes/cpp/platforms/symbian/inc/AppUi.h
@@ -68,13 +68,20 @@ class CAppUi : public CAknAppUi
68 68
 	CAppView* iAppView;
69 69
 	TBool iExiting;
70 70
 	HBufC8* iBuf;
  71
+
71 72
 #ifdef __SERIES60_3X__
  73
+	RWsSession& iWsSession;
  74
+	CApaWindowGroupName* iGn;
  75
+	bool iHomeScreenShown;
  76
+
72 77
 	CRemConInterfaceSelector* iInterfaceSelector;
73 78
 	CRemConCoreApiTarget* iCoreTarget;
74 79
 
75 80
 	void MrccatoCommand(TRemConCoreApiOperationId aOperationId,
76 81
 		TRemConCoreApiButtonAction aButtonAct);
77 82
 #endif
  83
+
  84
+	void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
78 85
 };
79 86
 
80 87
 #endif // __CAPPUI_H__
14  runtimes/cpp/platforms/symbian/inc/AppView.h
@@ -60,6 +60,12 @@ class CAppView : public CCoeControl {
60 60
 	int TextBox(const TDesC& title, const TDesC& inText, TDes& outText, int constraints);
61 61
 	void SetIdleDelay(int ms);
62 62
 
  63
+#ifdef __SERIES60_3X__
  64
+	int WindowGroupId() const { return Window().WindowGroupId(); }
  65
+#endif
  66
+	void HomeScreenEventsOn();
  67
+	void HomeScreenEventsOff();
  68
+
63 69
 	//CCoeControl
64 70
 public:
65 71
 	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
@@ -76,7 +82,7 @@ class CAppView : public CCoeControl {
76 82
 	static TInt RunIdle(TAny*);
77 83
 	TInt RunL();
78 84
 	static TInt StartStuff(TAny*);
79  
-	
  85
+
80 86
 	void CreateCoreL();
81 87
 	void LoadProgramL();
82 88
 #ifndef MOSYNC_COMMERCIAL
@@ -117,12 +123,12 @@ class CAppView : public CCoeControl {
117 123
 		CAppView& mAppView;
118 124
 	};	//DO NOT INSTANTIATE C-TYPE CLASSES AS MEMBERS! THEY WILL FUCK YOU UP! :)
119 125
 	CWaitTimer* iWaitTimer;
120  
-	
  126
+
121 127
 	class CCloseTimer : public CMyBaseTimer {
122 128
 		void RunL();
123 129
 	};
124 130
 	CCloseTimer* iCloseTimer;
125  
-	
  131
+
126 132
 	class CDelayTimer : public CMyBaseTimer {
127 133
 	public:
128 134
 		CDelayTimer(CAppView& appView);
@@ -133,7 +139,7 @@ class CAppView : public CCoeControl {
133 139
 	CDelayTimer* iDelayTimer;
134 140
 	int iIdleLoopDelay;	// milliseconds
135 141
 	friend class CDelayTimer;
136  
-	
  142
+
137 143
 	CAppUi& iAppUi;
138 144
 };
139 145
 
16  runtimes/cpp/platforms/symbian/inc/Platform.h
@@ -155,7 +155,7 @@ class CConnection : public CBase {
155 155
 	virtual bool Write(const TDesC8& aDesc, CPublicActive& op) = 0;
156 156
 
157 157
 	virtual void CancelAll() = 0;
158  
-	
  158
+
159 159
 	virtual void GetAddr(MAConnAddr* addr) = 0;
160 160
 
161 161
 	virtual CHttpConnection* http() { return NULL; }
@@ -170,20 +170,28 @@ class CConnection : public CBase {
170 170
 #ifdef SUPPORT_MOSYNC_SERVER
171 171
 class RMoSyncServerSession : public RSessionBase {
172 172
 public:
173  
-	RMoSyncServerSession() : mPositionPckg(mPosition) {}
  173
+	RMoSyncServerSession() : mPositionPckg(mPosition), mConnected(false) {}
174 174
 
175 175
 	int Connect();
176 176
 	TVersion Version(void) const;
177 177
 
178 178
 	int GetNetworkInfo(TDes8& aPckg);
179  
-	
  179
+
180 180
 	void LocationGet(TRequestStatus& aStatus);
181 181
 	int LocationStop();
182  
-	
  182
+
183 183
 	const TPosition& Position() const { return mPosition; }
  184
+
  185
+	int AutostartOn();
  186
+	int AutostartOff();
  187
+
  188
+	int GetNetworkStatus(CTelephony::TNetworkRegistrationV1&);
  189
+	void GetNetworkStatusChange(CTelephony::TNetworkRegistrationV1Pckg&, TRequestStatus&);
  190
+	void CancelNetworkStatusChange();
184 191
 private:
185 192
 	TPosition mPosition;
186 193
 	TPckg<TPosition> mPositionPckg;
  194
+	bool mConnected;
187 195
 };
188 196
 #endif	//SUPPORT_MOSYNC_SERVER
189 197
 
5  runtimes/cpp/platforms/symbian/inc/SyscallImpl.h
@@ -137,7 +137,7 @@ public MCameraObserver
137 137
 #endif	//CALL
138 138
 
139 139
 	//Location API
140  
-#if defined(SUPPORT_MOSYNC_SERVER) && !defined(__S60_50__)
  140
+#if defined(SUPPORT_MOSYNC_SERVER)
141 141
 	RMoSyncServerSession gServer;
142 142
 #endif
143 143
 
@@ -156,6 +156,9 @@ public MCameraObserver
156 156
 	void AddLocationEvent(const TPosition&);
157 157
 #endif
158 158
 
  159
+	int maAutostartOn();
  160
+	int maAutostartOff();
  161
+
159 162
 	bool gStreamWantsToPause;
160 163
 
161 164
 	int maStreamVideoStart(const char* url);
5  runtimes/cpp/platforms/symbian/inc/config_platform.h.example
@@ -12,17 +12,16 @@
12 12
 #define MOSYNC_COMMERCIAL	//controls nag text
13 13
 #define PUBLIC_DEBUG
14 14
 
15  
-//#define MA_PROF_SUPPORT_FRAMEBUFFER_32BIT 
  15
+//#define MA_PROF_SUPPORT_FRAMEBUFFER_32BIT
16 16
 
17 17
 
18 18
 //#define GUIDO
19 19
 //#define BABILE2
20 20
 
21 21
 #define WLAN
22  
-//#define SAVE_IAP
23 22
 //#define CELLID
24 23
 #define CALL
25  
-//#define SUPPORT_MOSYNC_SERVER
  24
+#define SUPPORT_MOSYNC_SERVER
26 25
 //#define SUPPORT_AUDIOBUFFER
27 26
 
28 27
 //#define USE_ARM_RECOMPILER
1  runtimes/cpp/platforms/symbian/inc/config_platform.h.guido.example
@@ -19,7 +19,6 @@
19 19
 #define BABILE2
20 20
 
21 21
 #define WLAN
22  
-#define SAVE_IAP
23 22
 //#define CELLID
24 23
 #define CALL
25 24
 //#define SUPPORT_MOSYNC_SERVER
35  runtimes/cpp/platforms/symbian/inc/netImpl.h
@@ -241,6 +241,22 @@ void FinishNetworkingStartL();
241 241
 
242 242
 void maAccept(MAHandle conn);
243 243
 
  244
+bool getSavedIap(TUint& iap);
  245
+
  246
+int maIapSave();
  247
+int maIapReset();
  248
+int maIapShutdown();
  249
+
  250
+#ifdef __SERIES60_3X__
  251
+#ifdef SUPPORT_MOSYNC_SERVER
  252
+int maNetworkStatus();
  253
+void NetworkStatusChangeHandlerL(TInt result);
  254
+#endif
  255
+
  256
+int maIapSetMethod(int method);
  257
+int maIapSetFilter(int filter);
  258
+#endif	//__SERIES60_3X__
  259
+
244 260
 //******************************************************************************
245 261
 //Variables
246 262
 //******************************************************************************
@@ -251,6 +267,18 @@ HashMap<CConnection> gConnections;
251 267
 TDblQue<ConnOp> gConnOps;
252 268
 CActiveEnder* gConnCleanupQue;
253 269
 RStringPool gHttpStringPool;
  270
+#ifdef __SERIES60_3X__
  271
+#ifdef SUPPORT_MOSYNC_SERVER
  272
+CTelephony::TNetworkRegistrationV1 gNetworkRegistration;
  273
+CTelephony::TNetworkRegistrationV1Pckg gNetworkRegistrationPckg;
  274
+CClassSynchronizer<Syscall>* gNetworkStatusSync;
  275
+#endif
  276
+int gIapMethod;
  277
+int gIapFilter;
  278
+#endif
  279
+TUint gIapId;
  280
+TBuf16<KMaxPath> gIapPath16;
  281
+TBuf8<KMaxPath> gIapPath8;
254 282
 
255 283
 //TDblQue<ConnOp> gConnOpsWaitingForNetworkingStart;	//error; can't be in two Ques at once.
256 284
 //just a little inefficient, but since this is used only once,
@@ -260,10 +288,3 @@ RPointerArray<ConnOp> gConnOpsWaitingForNetworkingStart;
260 288
 enum NetworkingState {
261 289
 	EIdle, EStarting, EStarted
262 290
 } gNetworkingState;
263  
-
264  
-//temp, for testing
265  
-#if SYNCTEST
266  
-TNameEntry tNameEntry;
267  
-CCBSynchronizer* tSync;
268  
-friend void tSyncFunc(TAny* arg, TInt res);
269  
-#endif
2  runtimes/cpp/platforms/symbian/inc/symbian_errors.h
@@ -22,5 +22,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 22
 	m(200004, SYMERR_VIBRATION_DURATION_NEGATIVE, "Negative vibration duration")\
23 23
 	m(200005, SYMERR_NO_MATCHING_DECODER, "No matching decoder found")\
24 24
 	m(200006, SYMERR_SOUND_DECODING_ERROR, "Error while decoding sound"/* Can happen when MIME type and sound file don't match. */ )\
  25
+	m(200007, SYMERR_IAP_METHOD, "Invalid IAP method")\
  26
+	m(200008, SYMERR_IAP_FILTER, "Invalid IAP filter")\
25 27
 
26 28
 DECLARE_ERROR_ENUM(SYMBIAN)
216  runtimes/cpp/platforms/symbian/server/Autostart.cpp
... ...
@@ -0,0 +1,216 @@
  1
+/* Copyright (C) 2010 MoSync AB
  2
+
  3
+This program is free software; you can redistribute it and/or modify it under
  4
+the terms of the GNU General Public License, version 2, as published by
  5
+the Free Software Foundation.
  6
+
  7
+This program is distributed in the hope that it will be useful,
  8
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  9
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  10
+for more details.
  11
+
  12
+You should have received a copy of the GNU General Public License
  13
+along with this program; see the file COPYING.  If not, write to the Free
  14
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  15
+02111-1307, USA.
  16
+*/
  17
+
  18
+#include "MoSyncServer.h"
  19
+#include "ActiveEnder.h"
  20
+#include "Log.h"
  21
+#include <e32base.h>
  22
+#include <e32std.h>
  23
+#include <w32std.h>
  24
+#include <APACMDLN.H>
  25
+#include <APGCLI.H>
  26
+#include <APGTASK.H>
  27
+
  28
+_LIT(KDatabaseFileName, "autostart.dat");
  29
+
  30
+#define PIE(func) { int _res = (func); if(_res < 0) { LOG("Error in %s on %i: %i\n", __FILE__, __LINE__, _res); User::Leave(_res); } }
  31
+
  32
+static void autostartProgramL(int uid, CApaCommandLine* cmdLine, RApaLsSession& ls, RWsSession& wss);
  33
+
  34
+//***************************************************************************
  35
+// File system server connection management
  36
+//***************************************************************************
  37
+
  38
+class MyRFs {
  39
+public:
  40
+	MyRFs() {}
  41
+	void Connect() {
  42
+		int res = rfs.Connect();
  43
+		if(res < 0)
  44
+			User::Leave(res);
  45
+	}
  46
+	~MyRFs() {
  47
+		rfs.Close();
  48
+	}
  49
+	RFs& operator()() { return rfs; }
  50
+private:
  51
+	RFs rfs;
  52
+};
  53
+#define FSS (myrfs())
  54
+
  55
+//***************************************************************************
  56
+// Server functions
  57
+//***************************************************************************
  58
+
  59
+void CMoSyncServer::writeAutostartDbL() {
  60
+	MyRFs myrfs;
  61
+	myrfs.Connect();
  62
+	RFile file;
  63
+	TFileName path;
  64
+	PIE(FSS.CreatePrivatePath(EDriveC));
  65
+	PIE(FSS.PrivatePath(path));
  66
+	path.Append(KDatabaseFileName);
  67
+	PIE(file.Replace(FSS, path, EFileStream | EFileShareExclusive | EFileWrite));
  68
+	CArrayFixFlat<TInt>& as(*mAutostart);
  69
+	for(int i=0; i<as.Count(); i++) {
  70
+		TPtrC8 ptr((const TUint8 *)&as[i], 4);
  71
+		PIE(file.Write(ptr));
  72
+	}
  73
+	PIE(file.Flush());
  74
+	file.Close();
  75
+}
  76
+
  77
+void CMoSyncServer::doAutostartL() {
  78
+	LOG("doAutostartL\n");
  79
+	if(mAutostart != NULL) {
  80
+		LOG("mAutostart != NULL\n");
  81
+		PanicServer(EInternal);
  82
+	}
  83
+	//LOG("doAutostartL 1\n");
  84
+	mAutostart = new (ELeave) CArrayFixFlat<TInt>(4);
  85
+	CArrayFixFlat<TInt>& as(*mAutostart);
  86
+	//LOG("doAutostartL 2\n");
  87
+
  88
+	// read database file, if it exists.
  89
+	MyRFs myrfs;
  90
+	myrfs.Connect();
  91
+	RFile file;
  92
+	int res = file.Open(FSS, KDatabaseFileName, EFileStream | EFileShareExclusive | EFileRead);
  93
+	if(res == KErrNotFound || res == KErrPathNotFound) {
  94
+		// no database. no need to read anything.
  95
+		LOG("Autostart database not found.\n");
  96
+		return;
  97
+	}
  98
+	//LOG("doAutostartL 3\n");
  99
+	PIE(res);
  100
+	int size;
  101
+	PIE(file.Size(size));
  102
+	//LOG("doAutostartL 4\n");
  103
+	if((size % 4) != 0) {
  104
+		LOG("Autostart database corrupted! Size: %i Not loading it.\n", size);
  105
+		return;
  106
+	}
  107
+	int count = size / 4;
  108
+	as.ResizeL(count);
  109
+	if(count == 0) {
  110
+		LOG("Database empty.\n");
  111
+		return;
  112
+	}
  113
+	//LOG("doAutostartL 5\n");
  114
+	TPtr8 ptr((TUint8 *)&as[0], size);
  115
+	//LOG("doAutostartL 6\n");
  116
+	PIE(file.Read(ptr));
  117
+	if(ptr.Length() != size) {
  118
+		LOG("Autostart database couldn't be completely read! Length: %i\n", ptr.Length());
  119
+		as.Reset();
  120
+		return;
  121
+	}
  122
+	//LOG("doAutostartL 7\n");
  123
+
  124
+	LOG("Autostart database read successfully. Launching %i programs...\n", as.Count());
  125
+
  126
+	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
  127
+	RApaLsSession ls;
  128
+	PIE(ls.Connect());
  129
+	RWsSession wss;
  130
+	PIE(wss.Connect());
  131
+	for(int i=0; i<as.Count(); i++) {
  132
+		autostartProgramL(as[i], cmdLine, ls, wss);
  133
+	}
  134
+	wss.Close();
  135
+	ls.Close();
  136
+	CleanupStack::PopAndDestroy(cmdLine);
  137
+
  138
+	LOG("Autostart complete.\n");
  139
+}
  140
+
  141
+static void autostartProgramL(int uid, CApaCommandLine* cmdLine, RApaLsSession& ls, RWsSession& wss) {
  142
+	LOG("autostart: 0x%08X\n", uid);
  143
+	TUid tuid(TUid::Uid(uid));
  144
+
  145
+	// check if the app is already running.
  146
+	TApaTaskList apataskList(wss);
  147
+	TApaTask apatask = apataskList.FindApp(tuid);
  148
+	bool isRunning = apatask.Exists();
  149
+	if(isRunning) {
  150
+		LOG("Already running.\n");
  151
+		return;
  152
+	}
  153
+
  154
+	TApaAppInfo appInfo;
  155
+	int res = ls.GetAppInfo(appInfo, tuid);
  156
+	if(res < 0) {
  157
+		// If the program doesn't exist anymore (maybe it got uninstalled)
  158
+		// we don't want to cause a fuss, so just fail silently with logging.
  159
+		LOG("GetAppInfo failed: %i\n", res);
  160
+		return;
  161
+	}
  162
+	cmdLine->SetExecutableNameL(appInfo.iFullName);
  163
+	cmdLine->SetCommandL(EApaCommandBackground);
  164
+	res = ls.StartApp(*cmdLine);
  165
+	if(res < 0) {
  166
+		// The program may already be running.
  167
+		LOG("StartApp failed: %i\n", res);
  168
+	}
  169
+}
  170
+
  171
+//***************************************************************************
  172
+// Session functions
  173
+//***************************************************************************
  174
+
  175
+void CMoSyncSession::AutostartOnL(const RMessage2& aMessage) {
  176
+	// get the uid of the calling client.
  177
+	int uid = aMessage.SecureId().iId;
  178
+	LOG("AutostartOnL(0x%08X)\n", uid);
  179
+
  180
+	CMoSyncServer* server = (CMoSyncServer*)Server();
  181
+	CArrayFixFlat<TInt>& as(*server->mAutostart);
  182
+	// search for the uid.
  183
+	for(int i=0; i<as.Count(); i++) {
  184
+		if(as[i] == uid) {
  185
+			aMessage.Complete(0);
  186
+			return;
  187
+		}
  188
+	}
  189
+
  190
+	// not found, so add it.
  191
+	as.AppendL(uid);
  192
+	server->writeAutostartDbL();
  193
+
  194
+	aMessage.Complete(1);
  195
+}
  196
+
  197
+void CMoSyncSession::AutostartOffL(const RMessage2& aMessage) {
  198
+	// get the uid of the calling client.
  199
+	int uid = aMessage.SecureId().iId;
  200
+	LOG("AutostartOffL(0x%08X)\n", uid);
  201
+
  202
+	CMoSyncServer* server = (CMoSyncServer*)Server();
  203
+	CArrayFixFlat<TInt>& as(*server->mAutostart);
  204
+	// search for the uid.
  205
+	for(int i=0; i<as.Count(); i++) {
  206
+		if(as[i] == uid) {	// gotcha.
  207
+			as.Delete(i);
  208
+			server->writeAutostartDbL();
  209
+			aMessage.Complete(1);
  210
+			return;
  211
+		}
  212
+	}
  213
+
  214
+	// not found, so we can't remove it.
  215
+	aMessage.Complete(0);
  216
+}
13  runtimes/cpp/platforms/symbian/server/ClientServer.h
@@ -21,11 +21,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 21
 #include <e32base.h>
22 22
 
23 23
 // server name
24  
-_LIT(KMoSyncServer, "MoSync Server");
  24
+_LIT(KMoSyncServer, "MoSync Server 2");
25 25
 
26 26
 // A version must be specified when creating a session with the server
27 27
 const TUint KMoSyncMajorVersionNumber=1;
28  
-const TUint KMoSyncMinorVersionNumber=2;
  28
+const TUint KMoSyncMinorVersionNumber=5;
29 29
 const TUint KMoSyncBuildVersionNumber=0;
30 30
 
31 31
 // Function codes (opcodes) used in message passing between client and server
@@ -35,6 +35,12 @@ enum TMoSyncServRqst
35 35
 	EMoSyncGetSubscriberId,	//CTelephony::GetSubscriberId
36 36
 	EMoSyncLocationGet,
37 37
 	EMoSyncLocationStop,
  38
+	EMoSyncAutostartOn,
  39
+	EMoSyncAutostartOff,
  40
+	EMoSyncAutostartTimer,
  41
+	EMoSyncGetNetworkStatus,
  42
+	EMoSyncGetNetworkStatusChange,
  43
+	EMoSyncCancelNetworkStatusChange,
38 44
 };
39 45
 
40 46
 // reasons for server panic
@@ -45,7 +51,8 @@ enum TMoSyncPanic
45 51
 	EMainSchedulerError,
46 52
 	ESvrCreateServer,
47 53
 	ESvrStartServer,
48  
-	ECreateTrapCleanup
  54
+	ECreateTrapCleanup,
  55
+	EInternal,
49 56
 	//ENotImplementedYet,
50 57
 };
51 58
 
76  runtimes/cpp/platforms/symbian/server/MoSyncServer.cpp
@@ -28,13 +28,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 28
 #include "ClientServer.h"
29 29
 #include "ActiveEnder.h"
30 30
 #include "Log.h"
  31
+#include "NetworkInfo.h"
31 32
 
32 33
 //**********************************
33 34
 //CMoSyncServer - implementations
34 35
 //**********************************
35 36
 
36 37
 /**
37  
-Constructor takes the server priority value. 
  38
+Constructor takes the server priority value.
38 39
 
39 40
 The server is an active object, and the priority value is the priority
40 41
 of this active object.
@@ -44,10 +45,13 @@ By default, the session is not sharable, which is what we want here
44 45
 so no second parameter is passed to the CServer2 constructor.
45 46
 */
46 47
 CMoSyncServer::CMoSyncServer(CActive::TPriority aActiveObjectPriority)
47  
-: CServer2(aActiveObjectPriority)
  48
+: CServer2(aActiveObjectPriority), mAutostart(NULL)
48 49
 {
49 50
 }
50 51
 
  52
+CMoSyncServer::~CMoSyncServer() {
  53
+	delete mAutostart;
  54
+}
51 55
 
52 56
 /**
53 57
 Creates a new session with the server.
@@ -59,12 +63,12 @@ CSession2* CMoSyncServer::NewSessionL(const TVersion& aVersion,
59 63
 	TVersion v(KMoSyncMajorVersionNumber, KMoSyncMinorVersionNumber,
60 64
 		KMoSyncBuildVersionNumber);
61 65
 	if (!User::QueryVersionSupported(v,aVersion))
62  
-		User::Leave(KErrNotSupported);	
63  
-	
  66
+		User::Leave(KErrNotSupported);
  67
+
64 68
 	// CAN USE THE aMessage argument to check client's security and identity
65 69
 	// can make use of this later but for now ignore. AH 4/5/05
66  
-	// the connect message is delivered via the RMessage2 object passed. 
67  
-	
  70
+	// the connect message is delivered via the RMessage2 object passed.
  71
+
68 72
 	// Create the session.
69 73
 	CMoSyncSession* s = new (ELeave) CMoSyncSession;
70 74
 	CleanupStack::PushL(s);
@@ -89,20 +93,33 @@ void CMoSyncServer::PanicServer(TMoSyncPanic aPanic)
89 93
 //***********************************
90 94
 
91 95
 CMoSyncSession::CMoSyncSession()
92  
-: mEnder(NULL), mTelephony(NULL), mPn(NULL), mPositionerOpen(false)
  96
+: mEnder(NULL), mTelephony(NULL),
  97
+mNetworkInfo(NULL),
  98
+mNetworkStatus(NULL),
  99
+mNetworkStatusChange(NULL),
  100
+mPn(NULL), mPositionerOpen(false)
93 101
 {
94 102
 }
95 103
 
96 104
 CMoSyncSession::~CMoSyncSession() {
97 105
 	LOG("~CMoSyncSession 1\n");
98 106
 	LocationStop();
99  
-	LOG("~CMoSyncSession 2\n");
  107
+	LOG("~mTelephony\n");
100 108
 	if(mTelephony != NULL)
101 109
 		delete mTelephony;
102  
-	LOG("~CMoSyncSession 3\n");
  110
+	LOG("~mNetworkInfo\n");
  111
+	if(mNetworkInfo != NULL)
  112
+		delete mNetworkInfo;
  113
+	LOG("~mNetworkStatus\n");
  114
+	if(mNetworkStatus != NULL)
  115
+		delete mNetworkStatus;
  116
+	LOG("~mNetworkStatusChange\n");
  117
+	if(mNetworkStatusChange != NULL)
  118
+		delete mNetworkStatusChange;
  119
+	LOG("~mEnder\n");
103 120
 	if(mEnder != NULL)
104 121
 		delete mEnder;
105  
-	LOG("~CMoSyncSession 4\n");
  122
+	LOG("~CMoSyncSession ends\n");
106 123
 }
107 124
 
108 125
 void CMoSyncSession::ConstructL() {
@@ -130,7 +147,7 @@ void CMoSyncSession::DispatchMessageL(const RMessage2& aMessage)
130 147
 	switch (aMessage.Function())
131 148
 	{
132 149
 	case EMoSyncGetNetworkInfo:
133  
-		GetNetworkInfoL(aMessage);
  150
+		GetTelephonyInfoL(aMessage, mNetworkInfo);
134 151
 		return;
135 152
 	case EMoSyncLocationGet:
136 153
 		LocationGetL(aMessage);
@@ -138,9 +155,24 @@ void CMoSyncSession::DispatchMessageL(const RMessage2& aMessage)
138 155
 	case EMoSyncLocationStop:
139 156
 		LocationStopL(aMessage);
140 157
 		return;
141  
-		
  158
+	case EMoSyncAutostartOn:
  159
+		AutostartOnL(aMessage);
  160
+		return;
  161
+	case EMoSyncAutostartOff:
  162
+		AutostartOffL(aMessage);
  163
+		return;
  164
+	case EMoSyncGetNetworkStatus:
  165
+		GetTelephonyInfoL(aMessage, mNetworkStatus);
  166
+		return;
  167
+	case EMoSyncGetNetworkStatusChange:
  168
+		GetTelephonyInfoL(aMessage, mNetworkStatusChange);
  169
+		return;
  170
+	case EMoSyncCancelNetworkStatusChange:
  171
+		CancelNetworkStatusChange(aMessage);
  172
+		return;
  173
+
142 174
 	 //  Requests that we don't understand at all are a different matter.
143  
-	 //  This is considered a client programming error, so we panic the 
  175
+	 //  This is considered a client programming error, so we panic the
144 176
 	 //  client - this also completes the message.
145 177
 	default:
146 178
 		LOG("Bad request: %i\n", aMessage.Function());
@@ -149,6 +181,16 @@ void CMoSyncSession::DispatchMessageL(const RMessage2& aMessage)
149 181
 	}
150 182
 }
151 183
 
  184
+void CMoSyncSession::CancelNetworkStatusChange(const RMessage2& aMessage) {
  185
+	LOG("CancelNetworkStatusChange\n");
  186
+	if(mNetworkStatusChange) {
  187
+		if(mNetworkStatusChange->IsActive()) {
  188
+			mNetworkStatusChange->Cancel();
  189
+		}
  190
+	}
  191
+	aMessage.Complete(KErrNone);
  192
+}
  193
+
152 194
 /**
153 195
 Panics the client
154 196
 */
@@ -187,7 +229,7 @@ GLDEF_C TInt E32Main() // Symbian EXE file entry point
187 229
 
188 230
 
189 231
 LOCAL_C void runServerL()
190  
-{ 
  232
+{
191 233
 	// Create the server, if one with this name does not already exist.
192 234
 	TFindServer findServer(KMoSyncServer);
193 235
 	TFullName name;
@@ -205,7 +247,7 @@ LOCAL_C void runServerL()
205 247
 
206 248
 	//Install the active scheduler
207 249
 	CActiveScheduler::Install(pA);
208  
-	
  250
+
209 251
 	LOG("CActiveScheduler Installed.\n");
210 252