Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 56570d2f9f0b90bae8bf0309f7f279bb1ff173c9 2 parents 9fa1cd1 + acd3c93
Mikael Kindborg authored
Showing with 1,360 additions and 242 deletions.
  1. +3 −1 .gitignore
  2. +1 −0  intlibs/hashmap/hashmap.cpp
  3. +4 −4 intlibs/stabs/stabs_builtins.cpp
  4. +2 −2 intlibs/stabs/stabs_type.h
  5. +1 −1  libs/MAUtil/mauuid.h
  6. +2 −2 rules/mosync_exe.rb
  7. +2 −0  runtimes/cpp/base/AudioChannel.h
  8. +37 −37 runtimes/cpp/core/Core.cpp
  9. +1 −1  runtimes/cpp/core/sld.cpp
  10. +1 −1  runtimes/cpp/platforms/sdl/netImpl.cpp
  11. +7 −0 runtimes/cpp/platforms/symbian/inc/AppUi.h
  12. +10 −4 runtimes/cpp/platforms/symbian/inc/AppView.h
  13. +12 −4 runtimes/cpp/platforms/symbian/inc/Platform.h
  14. +4 −1 runtimes/cpp/platforms/symbian/inc/SyscallImpl.h
  15. +2 −3 runtimes/cpp/platforms/symbian/inc/config_platform.h.example
  16. +0 −1  runtimes/cpp/platforms/symbian/inc/config_platform.h.guido.example
  17. +28 −7 runtimes/cpp/platforms/symbian/inc/netImpl.h
  18. +2 −0  runtimes/cpp/platforms/symbian/inc/symbian_errors.h
  19. +216 −0 runtimes/cpp/platforms/symbian/server/Autostart.cpp
  20. +10 −3 runtimes/cpp/platforms/symbian/server/ClientServer.h
  21. +60 −16 runtimes/cpp/platforms/symbian/server/MoSyncServer.cpp
  22. +25 −9 runtimes/cpp/platforms/symbian/server/MoSyncServer.h
  23. +7 −3 runtimes/cpp/platforms/symbian/server/MoSyncServer.mmp
  24. +7 −3 runtimes/cpp/platforms/symbian/server/MoSyncServer.pkg
  25. BIN  runtimes/cpp/platforms/symbian/server/MoSyncServer_Express_Signed.sis
  26. +7 −0 runtimes/cpp/platforms/symbian/server/MoSyncServer_startup.rss
  27. +108 −0 runtimes/cpp/platforms/symbian/server/NetworkInfo.h
  28. +2 −2 runtimes/cpp/platforms/symbian/sis-ed3/MoSync-guido.pkg
  29. +4 −4 runtimes/cpp/platforms/symbian/sis-ed3/MoSync-server.pkg
  30. +4 −4 runtimes/cpp/platforms/symbian/sis-ed3/MoSync-template.pkg
  31. +2 −2 runtimes/cpp/platforms/symbian/sis-ed3/MoSync.pkg
  32. +4 −0 runtimes/cpp/platforms/symbian/sis-ed5/MoSync-template.pkg
  33. +2 −2 runtimes/cpp/platforms/symbian/sis-ed5/MoSync.pkg
  34. +53 −7 runtimes/cpp/platforms/symbian/src/AppUi.cpp
  35. +10 −0 runtimes/cpp/platforms/symbian/src/AppView.cpp
  36. +41 −6 runtimes/cpp/platforms/symbian/src/Client.cpp
  37. +34 −1 runtimes/cpp/platforms/symbian/src/SyscallImpl.cpp
  38. +201 −77 runtimes/cpp/platforms/symbian/src/netImpl.cpp
  39. +160 −0 testPrograms/iap/main.cpp
  40. +66 −0 testPrograms/keyCapture/main.cpp
  41. +54 −0 testPrograms/networkStatus/main.cpp
  42. +1 −1  tools/ProfileConverter/conv.rb
  43. +1 −0  tools/RuntimeBuilder/BuildS60.rb
  44. +2 −2 tools/debugger/cmd_data.cpp
  45. +4 −4 tools/debugger/cmd_stack.cpp
  46. +4 −4 tools/debugger/cmd_var.cpp
  47. +15 −15 tools/debugger/debugger.cpp
  48. +1 −0  tools/debugger/expression_tree.h
  49. +3 −3 tools/debugger/opHandler.h
  50. +129 −3 tools/idl2/maapi.idl
  51. +1 −0  tools/package/android.cpp
  52. +3 −2 tools/rcomp/inc/rcscan.h
View
4 .gitignore
@@ -68,6 +68,7 @@ wormhole.js
/tools/ReleasePackageBuild/run.bat
/tools/ReleasePackageBuild/setcurrev.bat
+/tools/ReleasePackageBuild/build_package_tools/mosync_bin/version.dat
/tools/DocbookIndexer/src/*.c
/tools/DocbookIndexer/src/*.s
@@ -102,6 +103,7 @@ wormhole.js
/libs/newlib/libc/sys/mosync/maapi_defs.h
/libs/Wormhole/jslib/html5
+/libs/Wormhole/jslib/mosync-constants.js
/testPrograms/_masterdump.s
/testPrograms/temp.s
@@ -238,4 +240,4 @@ wormhole.js
/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Advertising.Mobile
/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Advertising.Mobile.UI
/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Phone.Controls
-/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Phone.Controls.Maps
+/runtimes/csharp/windowsphone/mosync/mosyncRuntime/Libraries/Microsoft.Phone.Controls.Maps
View
1  intlibs/hashmap/hashmap.cpp
@@ -92,6 +92,7 @@ void HashMapBase::close() {
}
free(m.base);
m.base = NULL;
+ memset(&m, 0, sizeof(m));
//DebugMarkEnd();
LOG_HASH("HashMapBase::close() complete.\n\n");
}
View
8 intlibs/stabs/stabs_builtins.cpp
@@ -72,14 +72,14 @@ void Int::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) con
}
void Char::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
-
+
if(fmt==eNatural) {
printPrimitiveByFormat<char>(pf, data, "%i", eDecimal, eDecimal);
char c = *(char*)data;
if(c>=0 && c<=32) pf(" \'\\\\%o\'", c);
else pf(" \'%c\'", c);
} else {
- printPrimitiveByFormat<char>(pf, data, "%i", fmt, fmt);
+ printPrimitiveByFormat<char>(pf, data, "%i", fmt, fmt);
}
}
@@ -96,11 +96,11 @@ void LongUnsignedInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFor
}
void LongLongInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
- printPrimitiveByFormat<s64>(pf, data, "%"INT64PREFIX"i", fmt, TypeBase::eDecimal);
+ printPrimitiveByFormat<s64>(pf, data, "%" INT64PREFIX "i", fmt, TypeBase::eDecimal);
}
void LongLongUnsignedInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
- printPrimitiveByFormat<u64>(pf, data, "%"INT64PREFIX"u", fmt, TypeBase::eDecimal);
+ printPrimitiveByFormat<u64>(pf, data, "%" INT64PREFIX "u", fmt, TypeBase::eDecimal);
}
void ShortInt::printMI(printfPtr pf, const void* data, TypeBase::PrintFormat fmt) const {
View
4 intlibs/stabs/stabs_type.h
@@ -119,9 +119,9 @@ void printPrimitiveByFormat(printfPtr pf, const void* data, const char* decimalF
} else if(fmt == TypeBase::eDecimal) {
pf(decimalFmt, t);
} else if(fmt == TypeBase::eOctal) {
- pf("%"PFZT_PREFIX"o", (size_t)t);
+ pf("%" PFZT_PREFIX "o", (size_t)t);
} else if(fmt == TypeBase::eHexadecimal) {
- pf("0x%"PFZT_PREFIX"x", (size_t)t);
+ pf("0x%" PFZT_PREFIX "x", (size_t)t);
} else if(fmt == TypeBase::eBinary) {
u64 tt = (u64)(size_t)t;
int numBits = (int)(sizeof(T)<<3)-1;
View
2  libs/MAUtil/mauuid.h
@@ -26,7 +26,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
* Defines a MAUUID that follows the Bluetooth standard of UUIDs.
* The lower 96 bits are constant.
*/
-#define DEFINE_BTMAUUID(name, uuid16) static const MAUUID name = {{ uuid16, 0x00001000, 0x80000080, 0x5F9B34FB }}
+#define DEFINE_BTMAUUID(name, uuid16) static const MAUUID name = {{ uuid16, 0x00001000, (int)0x80000080, 0x5F9B34FB }}
DEFINE_BTMAUUID(Bluetooth_Base_MAUUID, 0);
View
4 rules/mosync_exe.rb
@@ -168,9 +168,9 @@ def setup3(all_objects, have_cppfiles)
@prerequisites << @resourceTask
end
if(USE_NEWLIB)
- default(:DEFAULT_LIBS, ["newlib","rescompiler"])
+ default(:DEFAULT_LIBS, ['newlib'])
else
- default(:DEFAULT_LIBS, ["mastd","rescompiler"])
+ default(:DEFAULT_LIBS, ['mastd'])
end
# libs
View
2  runtimes/cpp/base/AudioChannel.h
@@ -49,6 +49,8 @@ class AudioChannel
*/
AudioChannel ( int s, AudioSource* audioSource = NULL );
+ virtual ~AudioChannel() {}
+
/**
* Set the channel audio source
*
View
74 runtimes/cpp/core/Core.cpp
@@ -124,7 +124,7 @@ class VMCoreInt : public VMCore {
int csRegs[128];
int *csMem;
- struct StateChange {
+ struct StateChange {
int type; // 0 = reg state change, 1 = mem state change
int ip, instCount;
struct regdata
@@ -136,7 +136,7 @@ class VMCoreInt : public VMCore {
int address;
unsigned char before, after;
};
-
+
regdata regdata;
memdata memdata;
};
@@ -144,7 +144,7 @@ class VMCoreInt : public VMCore {
#define STATE_BUFFER_SIZE 1024
StateChange stateChanges[STATE_BUFFER_SIZE];
int curStateChange;
-
+
void initStateChange() {
csMem = 0;
curStateChange = 0;
@@ -215,7 +215,7 @@ class VMCoreInt : public VMCore {
void logStateChange(int ip) {
//LOG("logStateChange(0x%x)\n", ip);
-
+
if(!csMem) {
curStateChange = 0;
#if 0
@@ -273,7 +273,7 @@ class VMCoreInt : public VMCore {
while(i--) {
if(csRegs[i] != regs[i]) {
//LOG("R%d: 0x%x != %d\n", i, csRegs[i], gCore->regs[i]);
-
+
stateChanges[curStateChange].type = 0;
stateChanges[curStateChange].ip = ip;
stateChanges[curStateChange].instCount = stateChangeInstCount;
@@ -318,7 +318,7 @@ class VMCoreInt : public VMCore {
byte* rIP;
int VM_Yield;
-
+
void* customEventPointer;
#ifdef USE_ARM_RECOMPILER
@@ -617,7 +617,7 @@ class VMCoreInt : public VMCore {
void GenConstTable() {
int n, p;
int mask;
-
+
for(p=0; p<32; p++) {
regs[p] = 0;
}
@@ -658,7 +658,7 @@ class VMCoreInt : public VMCore {
FileStream mod(modfile);
if(!LoadVM(mod))
return false;
-
+
FileStream res(resfile);
if(!mSyscall.loadResources(res, resfile))
return false;
@@ -751,12 +751,12 @@ class VMCoreInt : public VMCore {
LOG("Recompiler Closed!\n");
#endif
}
-
+
//****************************************
//Loader
//****************************************
int LoadVM(Stream& file) {
-
+
LOG("LoadVM\n");
TEST(file.isOpen());
@@ -817,37 +817,37 @@ class VMCoreInt : public VMCore {
DUMPHEX(Head.DataSize);
if(Head.DataLen > 0) {
DATA_SEGMENT_SIZE = nextPowerOf2(16, Head.DataSize);
-
+
#ifdef _android
/*
jclass cls = mJniEnv->GetObjectClass(mJThis);
jmethodID methodID = mJniEnv->GetMethodID(cls, "generateDataSection", "(I)Ljava/nio/ByteBuffer;");
if (methodID == 0) return -1;
jobject jo = mJniEnv->CallObjectMethod(mJThis, methodID, (DATA_SEGMENT_SIZE));
-
+
// if the java object jo is NULL at this point there was not enought memory to allocate the data section
- if(jo == NULL)
+ if(jo == NULL)
{
__android_log_write(ANDROID_LOG_INFO, "MoSync Syscall", "Deta section was allocated, not enough memory!");
return 0;
}
-
+
mem_ds = (int*)mJniEnv->GetDirectBufferAddress(jo);
mJniEnv->DeleteLocalRef(cls);
*/
char* buffer = (char*)malloc(DATA_SEGMENT_SIZE);
if(buffer == NULL) return 0;
-
+
jobject byteBuffer = mJniEnv->NewDirectByteBuffer((void*)buffer, DATA_SEGMENT_SIZE);
if(byteBuffer == NULL) return 0;
-
+
jclass cls = mJniEnv->GetObjectClass(mJThis);
jmethodID methodID = mJniEnv->GetMethodID(cls, "generateDataSection", "(Ljava/nio/ByteBuffer;)Z");
if (methodID == 0) return 0;
-
+
jboolean ret = mJniEnv->CallBooleanMethod(mJThis, methodID, byteBuffer);
- if(false == ret)
+ if(false == ret)
{
__android_log_write(ANDROID_LOG_INFO, "MoSync Syscall", "Deta section was allocated, not enough memory!");
return 0;
@@ -857,10 +857,10 @@ class VMCoreInt : public VMCore {
mJniEnv->DeleteLocalRef(cls);
mJniEnv->DeleteLocalRef(byteBuffer);
-
+
#else
mem_ds = new int[DATA_SEGMENT_SIZE / sizeof(int)];
-#endif
+#endif
if(!mem_ds) BIG_PHAT_ERROR(ERR_OOM);
TEST(file.read(mem_ds, Head.DataLen));
@@ -893,7 +893,7 @@ class VMCoreInt : public VMCore {
#endif
customEventPointer = ((char*)mem_ds) + (Head.DataSize - maxCustomEventSize);
-
+
#ifdef USE_ARM_RECOMPILER
//initRecompilerVariables();
#ifndef _android
@@ -1017,7 +1017,7 @@ void WRITE_REG(int reg, int value) {
void checkProtection(uint address, uint size) const {
if(protectionEnabled) {
- for(uint i = address; i < address+size; i++)
+ for(uint i = address; i < address+size; i++)
if(GET_PROTECTION(i)) {
BIG_PHAT_ERROR(ERR_MEMORY_PROTECTED);
}
@@ -1040,7 +1040,7 @@ void WRITE_REG(int reg, int value) {
((address & (sizeof(T) - 1)) != 0) || //alignment check
(address < 4)) //NULL pointer check
{
- LOG("Memory reference validation failed. Size %"PFZT", address 0x%x\n",
+ LOG("Memory reference validation failed. Size %" PFZT ", address 0x%x\n",
sizeof(T), address);
if((address & (sizeof(T) - 1)) != 0) {
BIG_PHAT_ERROR(ERR_MEMORY_ALIGNMENT);
@@ -1051,7 +1051,7 @@ void WRITE_REG(int reg, int value) {
}
}
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(address, sizeof(T));
#endif
@@ -1066,19 +1066,19 @@ void WRITE_REG(int reg, int value) {
//****************************************
#define PTR2ADDRESS(ptr) ((unsigned)((char*)ptr - (char*)mem_ds))
void ValidateMemStringAddress(unsigned address) const {
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
int initialAddr = address;
#endif
do {
if(address >= DATA_SEGMENT_SIZE)
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
} while(RAW_MEMREF(char, address++) != 0);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(initialAddr, address-initialAddr);
#endif
}
void ValidateMemWStringAddress(unsigned address) const {
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
int initialAddr = address;
#endif
address -= 2;
@@ -1087,7 +1087,7 @@ void WRITE_REG(int reg, int value) {
if(address >= DATA_SEGMENT_SIZE)
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
} while(RAW_MEMREF(short, address) != 0);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(initialAddr, address-initialAddr);
#endif
}
@@ -1098,7 +1098,7 @@ void WRITE_REG(int reg, int value) {
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
} while(RAW_MEMREF(char, address++) != 0);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(PTR2ADDRESS(ptr), address-PTR2ADDRESS(ptr));
#endif
return address - PTR2ADDRESS(ptr) - 1;
@@ -1108,7 +1108,7 @@ void WRITE_REG(int reg, int value) {
if(address >= DATA_SEGMENT_SIZE || (address+size) >= DATA_SEGMENT_SIZE ||
size > DATA_SEGMENT_SIZE)
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(address, size);
#endif
}
@@ -1117,7 +1117,7 @@ void WRITE_REG(int reg, int value) {
if(uint(address) >= DATA_SEGMENT_SIZE || uint(address+size) >= DATA_SEGMENT_SIZE ||
uint(size) > DATA_SEGMENT_SIZE)
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(address, size);
#endif
return ((char*)mem_ds) + address;
@@ -1144,7 +1144,7 @@ void WRITE_REG(int reg, int value) {
if(address >= DATA_SEGMENT_SIZE)
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
} while(RAW_MEMREF(char, address++) != 0);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(a, address-a);
#endif
return ((char*)mem_ds) + a;
@@ -1158,7 +1158,7 @@ void WRITE_REG(int reg, int value) {
if(address >= DATA_SEGMENT_SIZE)
BIG_PHAT_ERROR(ERR_MEMORY_OOB);
} while(RAW_MEMREF(wchar, address) != 0);
-#ifdef MEMORY_PROTECTION
+#ifdef MEMORY_PROTECTION
checkProtection(a, address-a);
#endif
return (wchar*)(((char*)mem_ds) + a);
@@ -1315,7 +1315,7 @@ void WRITE_REG(int reg, int value) {
initStateChange();
#endif
}
-
+
virtual ~VMCoreInt() {
#ifdef GDB_DEBUG
if(mGdbOn)
@@ -1375,7 +1375,7 @@ void WRITE_REG(int reg, int value) {
#endif
}
-
+
private:
Syscall& mSyscall;
};
@@ -1460,7 +1460,7 @@ void RunFrom(VMCore* core, int ip) {
// ***************************************
// Debugger
-// ***************************************
+// ***************************************
/*
#ifdef ENABLE_DEBUGGER
bool initDebugger(VMCore* core, int port) {
@@ -1472,7 +1472,7 @@ void closeDebugger() {
}
#endif
*/
-// ***************************************
+// ***************************************
void Run2(VMCore* core) {
CORE->Run2();
View
2  runtimes/cpp/core/sld.cpp
@@ -265,7 +265,7 @@ bool loadSLD(const char* filename) {
while(1) {
TEST(readLine(buffer, BUFSIZE, file));
LineMapping m;
- if(sscanf(buffer, "%x:%i:%"PFZT"i", &m.ip, &m.line, &m.file) != 3)
+ if(sscanf(buffer, "%x:%i:%" PFZT "i", &m.ip, &m.line, &m.file) != 3)
break;
std::pair<std::set<LineMapping>::iterator, bool> res = sLineSet.insert(m);
TEST(res.second);
View
2  runtimes/cpp/platforms/sdl/netImpl.cpp
@@ -63,7 +63,7 @@ static void dumpSslErrors() {
}
#define TSSL_CUSTOM(func, test, action) { ssize_t _res = (size_t)(func); if(_res test) { IN_FILE_ON_LINE;\
- LOG("OpenSSL error %"PFSZT"\n", _res); dumpSslErrors(); action; } }
+ LOG("OpenSSL error %" PFSZT "\n", _res); dumpSslErrors(); action; } }
#define TSSL(func, test) TSSL_CUSTOM(func, test, return CONNERR_SSL)
#define TSSLZ(func) TSSL(func, == 0)
View
7 runtimes/cpp/platforms/symbian/inc/AppUi.h
@@ -68,13 +68,20 @@ class CAppUi : public CAknAppUi
CAppView* iAppView;
TBool iExiting;
HBufC8* iBuf;
+
#ifdef __SERIES60_3X__
+ RWsSession& iWsSession;
+ CApaWindowGroupName* iGn;
+ bool iHomeScreenShown;
+
CRemConInterfaceSelector* iInterfaceSelector;
CRemConCoreApiTarget* iCoreTarget;
void MrccatoCommand(TRemConCoreApiOperationId aOperationId,
TRemConCoreApiButtonAction aButtonAct);
#endif
+
+ void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
};
#endif // __CAPPUI_H__
View
14 runtimes/cpp/platforms/symbian/inc/AppView.h
@@ -60,6 +60,12 @@ class CAppView : public CCoeControl {
int TextBox(const TDesC& title, const TDesC& inText, TDes& outText, int constraints);
void SetIdleDelay(int ms);
+#ifdef __SERIES60_3X__
+ int WindowGroupId() const { return Window().WindowGroupId(); }
+#endif
+ void HomeScreenEventsOn();
+ void HomeScreenEventsOff();
+
//CCoeControl
public:
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
@@ -76,7 +82,7 @@ class CAppView : public CCoeControl {
static TInt RunIdle(TAny*);
TInt RunL();
static TInt StartStuff(TAny*);
-
+
void CreateCoreL();
void LoadProgramL();
#ifndef MOSYNC_COMMERCIAL
@@ -117,12 +123,12 @@ class CAppView : public CCoeControl {
CAppView& mAppView;
}; //DO NOT INSTANTIATE C-TYPE CLASSES AS MEMBERS! THEY WILL FUCK YOU UP! :)
CWaitTimer* iWaitTimer;
-
+
class CCloseTimer : public CMyBaseTimer {
void RunL();
};
CCloseTimer* iCloseTimer;
-
+
class CDelayTimer : public CMyBaseTimer {
public:
CDelayTimer(CAppView& appView);
@@ -133,7 +139,7 @@ class CAppView : public CCoeControl {
CDelayTimer* iDelayTimer;
int iIdleLoopDelay; // milliseconds
friend class CDelayTimer;
-
+
CAppUi& iAppUi;
};
View
16 runtimes/cpp/platforms/symbian/inc/Platform.h
@@ -155,7 +155,7 @@ class CConnection : public CBase {
virtual bool Write(const TDesC8& aDesc, CPublicActive& op) = 0;
virtual void CancelAll() = 0;
-
+
virtual void GetAddr(MAConnAddr* addr) = 0;
virtual CHttpConnection* http() { return NULL; }
@@ -170,20 +170,28 @@ class CConnection : public CBase {
#ifdef SUPPORT_MOSYNC_SERVER
class RMoSyncServerSession : public RSessionBase {
public:
- RMoSyncServerSession() : mPositionPckg(mPosition) {}
+ RMoSyncServerSession() : mPositionPckg(mPosition), mConnected(false) {}
int Connect();
TVersion Version(void) const;
int GetNetworkInfo(TDes8& aPckg);
-
+
void LocationGet(TRequestStatus& aStatus);
int LocationStop();
-
+
const TPosition& Position() const { return mPosition; }
+
+ int AutostartOn();
+ int AutostartOff();
+
+ int GetNetworkStatus(CTelephony::TNetworkRegistrationV1&);
+ void GetNetworkStatusChange(CTelephony::TNetworkRegistrationV1Pckg&, TRequestStatus&);
+ void CancelNetworkStatusChange();
private:
TPosition mPosition;
TPckg<TPosition> mPositionPckg;
+ bool mConnected;
};
#endif //SUPPORT_MOSYNC_SERVER
View
5 runtimes/cpp/platforms/symbian/inc/SyscallImpl.h
@@ -137,7 +137,7 @@ public MCameraObserver
#endif //CALL
//Location API
-#if defined(SUPPORT_MOSYNC_SERVER) && !defined(__S60_50__)
+#if defined(SUPPORT_MOSYNC_SERVER)
RMoSyncServerSession gServer;
#endif
@@ -156,6 +156,9 @@ public MCameraObserver
void AddLocationEvent(const TPosition&);
#endif
+ int maAutostartOn();
+ int maAutostartOff();
+
bool gStreamWantsToPause;
int maStreamVideoStart(const char* url);
View
5 runtimes/cpp/platforms/symbian/inc/config_platform.h.example
@@ -12,17 +12,16 @@
#define MOSYNC_COMMERCIAL //controls nag text
#define PUBLIC_DEBUG
-//#define MA_PROF_SUPPORT_FRAMEBUFFER_32BIT
+//#define MA_PROF_SUPPORT_FRAMEBUFFER_32BIT
//#define GUIDO
//#define BABILE2
#define WLAN
-//#define SAVE_IAP
//#define CELLID
#define CALL
-//#define SUPPORT_MOSYNC_SERVER
+#define SUPPORT_MOSYNC_SERVER
//#define SUPPORT_AUDIOBUFFER
//#define USE_ARM_RECOMPILER
View
1  runtimes/cpp/platforms/symbian/inc/config_platform.h.guido.example
@@ -19,7 +19,6 @@
#define BABILE2
#define WLAN
-#define SAVE_IAP
//#define CELLID
#define CALL
//#define SUPPORT_MOSYNC_SERVER
View
35 runtimes/cpp/platforms/symbian/inc/netImpl.h
@@ -241,6 +241,22 @@ void FinishNetworkingStartL();
void maAccept(MAHandle conn);
+bool getSavedIap(TUint& iap);
+
+int maIapSave();
+int maIapReset();
+int maIapShutdown();
+
+#ifdef __SERIES60_3X__
+#ifdef SUPPORT_MOSYNC_SERVER
+int maNetworkStatus();
+void NetworkStatusChangeHandlerL(TInt result);
+#endif
+
+int maIapSetMethod(int method);
+int maIapSetFilter(int filter);
+#endif //__SERIES60_3X__
+
//******************************************************************************
//Variables
//******************************************************************************
@@ -251,6 +267,18 @@ HashMap<CConnection> gConnections;
TDblQue<ConnOp> gConnOps;
CActiveEnder* gConnCleanupQue;
RStringPool gHttpStringPool;
+#ifdef __SERIES60_3X__
+#ifdef SUPPORT_MOSYNC_SERVER
+CTelephony::TNetworkRegistrationV1 gNetworkRegistration;
+CTelephony::TNetworkRegistrationV1Pckg gNetworkRegistrationPckg;
+CClassSynchronizer<Syscall>* gNetworkStatusSync;
+#endif
+int gIapMethod;
+int gIapFilter;
+#endif
+TUint gIapId;
+TBuf16<KMaxPath> gIapPath16;
+TBuf8<KMaxPath> gIapPath8;
//TDblQue<ConnOp> gConnOpsWaitingForNetworkingStart; //error; can't be in two Ques at once.
//just a little inefficient, but since this is used only once,
@@ -260,10 +288,3 @@ RPointerArray<ConnOp> gConnOpsWaitingForNetworkingStart;
enum NetworkingState {
EIdle, EStarting, EStarted
} gNetworkingState;
-
-//temp, for testing
-#if SYNCTEST
-TNameEntry tNameEntry;
-CCBSynchronizer* tSync;
-friend void tSyncFunc(TAny* arg, TInt res);
-#endif
View
2  runtimes/cpp/platforms/symbian/inc/symbian_errors.h
@@ -22,5 +22,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
m(200004, SYMERR_VIBRATION_DURATION_NEGATIVE, "Negative vibration duration")\
m(200005, SYMERR_NO_MATCHING_DECODER, "No matching decoder found")\
m(200006, SYMERR_SOUND_DECODING_ERROR, "Error while decoding sound"/* Can happen when MIME type and sound file don't match. */ )\
+ m(200007, SYMERR_IAP_METHOD, "Invalid IAP method")\
+ m(200008, SYMERR_IAP_FILTER, "Invalid IAP filter")\
DECLARE_ERROR_ENUM(SYMBIAN)
View
216 runtimes/cpp/platforms/symbian/server/Autostart.cpp
@@ -0,0 +1,216 @@
+/* Copyright (C) 2010 MoSync AB
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License, version 2, as published by
+the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include "MoSyncServer.h"
+#include "ActiveEnder.h"
+#include "Log.h"
+#include <e32base.h>
+#include <e32std.h>
+#include <w32std.h>
+#include <APACMDLN.H>
+#include <APGCLI.H>
+#include <APGTASK.H>
+
+_LIT(KDatabaseFileName, "autostart.dat");
+
+#define PIE(func) { int _res = (func); if(_res < 0) { LOG("Error in %s on %i: %i\n", __FILE__, __LINE__, _res); User::Leave(_res); } }
+
+static void autostartProgramL(int uid, CApaCommandLine* cmdLine, RApaLsSession& ls, RWsSession& wss);
+
+//***************************************************************************
+// File system server connection management
+//***************************************************************************
+
+class MyRFs {
+public:
+ MyRFs() {}
+ void Connect() {
+ int res = rfs.Connect();
+ if(res < 0)
+ User::Leave(res);
+ }
+ ~MyRFs() {
+ rfs.Close();
+ }
+ RFs& operator()() { return rfs; }
+private:
+ RFs rfs;
+};
+#define FSS (myrfs())
+
+//***************************************************************************
+// Server functions
+//***************************************************************************
+
+void CMoSyncServer::writeAutostartDbL() {
+ MyRFs myrfs;
+ myrfs.Connect();
+ RFile file;
+ TFileName path;
+ PIE(FSS.CreatePrivatePath(EDriveC));
+ PIE(FSS.PrivatePath(path));
+ path.Append(KDatabaseFileName);
+ PIE(file.Replace(FSS, path, EFileStream | EFileShareExclusive | EFileWrite));
+ CArrayFixFlat<TInt>& as(*mAutostart);
+ for(int i=0; i<as.Count(); i++) {
+ TPtrC8 ptr((const TUint8 *)&as[i], 4);
+ PIE(file.Write(ptr));
+ }
+ PIE(file.Flush());
+ file.Close();
+}
+
+void CMoSyncServer::doAutostartL() {
+ LOG("doAutostartL\n");
+ if(mAutostart != NULL) {
+ LOG("mAutostart != NULL\n");
+ PanicServer(EInternal);
+ }
+ //LOG("doAutostartL 1\n");
+ mAutostart = new (ELeave) CArrayFixFlat<TInt>(4);
+ CArrayFixFlat<TInt>& as(*mAutostart);
+ //LOG("doAutostartL 2\n");
+
+ // read database file, if it exists.
+ MyRFs myrfs;
+ myrfs.Connect();
+ RFile file;
+ int res = file.Open(FSS, KDatabaseFileName, EFileStream | EFileShareExclusive | EFileRead);
+ if(res == KErrNotFound || res == KErrPathNotFound) {
+ // no database. no need to read anything.
+ LOG("Autostart database not found.\n");
+ return;
+ }
+ //LOG("doAutostartL 3\n");
+ PIE(res);
+ int size;
+ PIE(file.Size(size));
+ //LOG("doAutostartL 4\n");
+ if((size % 4) != 0) {
+ LOG("Autostart database corrupted! Size: %i Not loading it.\n", size);
+ return;
+ }
+ int count = size / 4;
+ as.ResizeL(count);
+ if(count == 0) {
+ LOG("Database empty.\n");
+ return;
+ }
+ //LOG("doAutostartL 5\n");
+ TPtr8 ptr((TUint8 *)&as[0], size);
+ //LOG("doAutostartL 6\n");
+ PIE(file.Read(ptr));
+ if(ptr.Length() != size) {
+ LOG("Autostart database couldn't be completely read! Length: %i\n", ptr.Length());
+ as.Reset();
+ return;
+ }
+ //LOG("doAutostartL 7\n");
+
+ LOG("Autostart database read successfully. Launching %i programs...\n", as.Count());
+
+ CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
+ RApaLsSession ls;
+ PIE(ls.Connect());
+ RWsSession wss;
+ PIE(wss.Connect());
+ for(int i=0; i<as.Count(); i++) {
+ autostartProgramL(as[i], cmdLine, ls, wss);
+ }
+ wss.Close();
+ ls.Close();
+ CleanupStack::PopAndDestroy(cmdLine);
+
+ LOG("Autostart complete.\n");
+}
+
+static void autostartProgramL(int uid, CApaCommandLine* cmdLine, RApaLsSession& ls, RWsSession& wss) {
+ LOG("autostart: 0x%08X\n", uid);
+ TUid tuid(TUid::Uid(uid));
+
+ // check if the app is already running.
+ TApaTaskList apataskList(wss);
+ TApaTask apatask = apataskList.FindApp(tuid);
+ bool isRunning = apatask.Exists();
+ if(isRunning) {
+ LOG("Already running.\n");
+ return;
+ }
+
+ TApaAppInfo appInfo;
+ int res = ls.GetAppInfo(appInfo, tuid);
+ if(res < 0) {
+ // If the program doesn't exist anymore (maybe it got uninstalled)
+ // we don't want to cause a fuss, so just fail silently with logging.
+ LOG("GetAppInfo failed: %i\n", res);
+ return;
+ }
+ cmdLine->SetExecutableNameL(appInfo.iFullName);
+ cmdLine->SetCommandL(EApaCommandBackground);
+ res = ls.StartApp(*cmdLine);
+ if(res < 0) {
+ // The program may already be running.
+ LOG("StartApp failed: %i\n", res);
+ }
+}
+
+//***************************************************************************
+// Session functions
+//***************************************************************************
+
+void CMoSyncSession::AutostartOnL(const RMessage2& aMessage) {
+ // get the uid of the calling client.
+ int uid = aMessage.SecureId().iId;
+ LOG("AutostartOnL(0x%08X)\n", uid);
+
+ CMoSyncServer* server = (CMoSyncServer*)Server();
+ CArrayFixFlat<TInt>& as(*server->mAutostart);
+ // search for the uid.
+ for(int i=0; i<as.Count(); i++) {
+ if(as[i] == uid) {
+ aMessage.Complete(0);
+ return;
+ }
+ }
+
+ // not found, so add it.
+ as.AppendL(uid);
+ server->writeAutostartDbL();
+
+ aMessage.Complete(1);
+}
+
+void CMoSyncSession::AutostartOffL(const RMessage2& aMessage) {
+ // get the uid of the calling client.
+ int uid = aMessage.SecureId().iId;
+ LOG("AutostartOffL(0x%08X)\n", uid);
+
+ CMoSyncServer* server = (CMoSyncServer*)Server();
+ CArrayFixFlat<TInt>& as(*server->mAutostart);
+ // search for the uid.
+ for(int i=0; i<as.Count(); i++) {
+ if(as[i] == uid) { // gotcha.
+ as.Delete(i);
+ server->writeAutostartDbL();
+ aMessage.Complete(1);
+ return;
+ }
+ }
+
+ // not found, so we can't remove it.
+ aMessage.Complete(0);
+}
View
13 runtimes/cpp/platforms/symbian/server/ClientServer.h
@@ -21,11 +21,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <e32base.h>
// server name
-_LIT(KMoSyncServer, "MoSync Server");
+_LIT(KMoSyncServer, "MoSync Server 2");
// A version must be specified when creating a session with the server
const TUint KMoSyncMajorVersionNumber=1;
-const TUint KMoSyncMinorVersionNumber=2;
+const TUint KMoSyncMinorVersionNumber=5;
const TUint KMoSyncBuildVersionNumber=0;
// Function codes (opcodes) used in message passing between client and server
@@ -35,6 +35,12 @@ enum TMoSyncServRqst
EMoSyncGetSubscriberId, //CTelephony::GetSubscriberId
EMoSyncLocationGet,
EMoSyncLocationStop,
+ EMoSyncAutostartOn,
+ EMoSyncAutostartOff,
+ EMoSyncAutostartTimer,
+ EMoSyncGetNetworkStatus,
+ EMoSyncGetNetworkStatusChange,
+ EMoSyncCancelNetworkStatusChange,
};
// reasons for server panic
@@ -45,7 +51,8 @@ enum TMoSyncPanic
EMainSchedulerError,
ESvrCreateServer,
ESvrStartServer,
- ECreateTrapCleanup
+ ECreateTrapCleanup,
+ EInternal,
//ENotImplementedYet,
};
View
76 runtimes/cpp/platforms/symbian/server/MoSyncServer.cpp
@@ -28,13 +28,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "ClientServer.h"
#include "ActiveEnder.h"
#include "Log.h"
+#include "NetworkInfo.h"
//**********************************
//CMoSyncServer - implementations
//**********************************
/**
-Constructor takes the server priority value.
+Constructor takes the server priority value.
The server is an active object, and the priority value is the priority
of this active object.
@@ -44,10 +45,13 @@ By default, the session is not sharable, which is what we want here
so no second parameter is passed to the CServer2 constructor.
*/
CMoSyncServer::CMoSyncServer(CActive::TPriority aActiveObjectPriority)
-: CServer2(aActiveObjectPriority)
+: CServer2(aActiveObjectPriority), mAutostart(NULL)
{
}
+CMoSyncServer::~CMoSyncServer() {
+ delete mAutostart;
+}
/**
Creates a new session with the server.
@@ -59,12 +63,12 @@ CSession2* CMoSyncServer::NewSessionL(const TVersion& aVersion,
TVersion v(KMoSyncMajorVersionNumber, KMoSyncMinorVersionNumber,
KMoSyncBuildVersionNumber);
if (!User::QueryVersionSupported(v,aVersion))
- User::Leave(KErrNotSupported);
-
+ User::Leave(KErrNotSupported);
+
// CAN USE THE aMessage argument to check client's security and identity
// can make use of this later but for now ignore. AH 4/5/05
- // the connect message is delivered via the RMessage2 object passed.
-
+ // the connect message is delivered via the RMessage2 object passed.
+
// Create the session.
CMoSyncSession* s = new (ELeave) CMoSyncSession;
CleanupStack::PushL(s);
@@ -89,20 +93,33 @@ void CMoSyncServer::PanicServer(TMoSyncPanic aPanic)
//***********************************
CMoSyncSession::CMoSyncSession()
-: mEnder(NULL), mTelephony(NULL), mPn(NULL), mPositionerOpen(false)
+: mEnder(NULL), mTelephony(NULL),
+mNetworkInfo(NULL),
+mNetworkStatus(NULL),
+mNetworkStatusChange(NULL),
+mPn(NULL), mPositionerOpen(false)
{
}
CMoSyncSession::~CMoSyncSession() {
LOG("~CMoSyncSession 1\n");
LocationStop();
- LOG("~CMoSyncSession 2\n");
+ LOG("~mTelephony\n");
if(mTelephony != NULL)
delete mTelephony;
- LOG("~CMoSyncSession 3\n");
+ LOG("~mNetworkInfo\n");
+ if(mNetworkInfo != NULL)
+ delete mNetworkInfo;
+ LOG("~mNetworkStatus\n");
+ if(mNetworkStatus != NULL)
+ delete mNetworkStatus;
+ LOG("~mNetworkStatusChange\n");
+ if(mNetworkStatusChange != NULL)
+ delete mNetworkStatusChange;
+ LOG("~mEnder\n");
if(mEnder != NULL)
delete mEnder;
- LOG("~CMoSyncSession 4\n");
+ LOG("~CMoSyncSession ends\n");
}
void CMoSyncSession::ConstructL() {
@@ -130,7 +147,7 @@ void CMoSyncSession::DispatchMessageL(const RMessage2& aMessage)
switch (aMessage.Function())
{
case EMoSyncGetNetworkInfo:
- GetNetworkInfoL(aMessage);
+ GetTelephonyInfoL(aMessage, mNetworkInfo);
return;
case EMoSyncLocationGet:
LocationGetL(aMessage);
@@ -138,9 +155,24 @@ void CMoSyncSession::DispatchMessageL(const RMessage2& aMessage)
case EMoSyncLocationStop:
LocationStopL(aMessage);
return;
-
+ case EMoSyncAutostartOn:
+ AutostartOnL(aMessage);
+ return;
+ case EMoSyncAutostartOff:
+ AutostartOffL(aMessage);
+ return;
+ case EMoSyncGetNetworkStatus:
+ GetTelephonyInfoL(aMessage, mNetworkStatus);
+ return;
+ case EMoSyncGetNetworkStatusChange:
+ GetTelephonyInfoL(aMessage, mNetworkStatusChange);
+ return;
+ case EMoSyncCancelNetworkStatusChange:
+ CancelNetworkStatusChange(aMessage);
+ return;
+
// Requests that we don't understand at all are a different matter.
- // This is considered a client programming error, so we panic the
+ // This is considered a client programming error, so we panic the
// client - this also completes the message.
default:
LOG("Bad request: %i\n", aMessage.Function());
@@ -149,6 +181,16 @@ void CMoSyncSession::DispatchMessageL(const RMessage2& aMessage)
}
}
+void CMoSyncSession::CancelNetworkStatusChange(const RMessage2& aMessage) {
+ LOG("CancelNetworkStatusChange\n");
+ if(mNetworkStatusChange) {
+ if(mNetworkStatusChange->IsActive()) {
+ mNetworkStatusChange->Cancel();
+ }
+ }
+ aMessage.Complete(KErrNone);
+}
+
/**
Panics the client
*/
@@ -187,7 +229,7 @@ GLDEF_C TInt E32Main() // Symbian EXE file entry point
LOCAL_C void runServerL()
-{
+{
// Create the server, if one with this name does not already exist.
TFindServer findServer(KMoSyncServer);
TFullName name;
@@ -205,7 +247,7 @@ LOCAL_C void runServerL()
//Install the active scheduler
CActiveScheduler::Install(pA);
-
+
LOG("CActiveScheduler Installed.\n");
// Start the server
@@ -222,11 +264,13 @@ LOCAL_C void runServerL()
RProcess::Rendezvous(KErrNone);
LOG("RProcess Rendezvous'd.\n");
+ pS->doAutostartL();
+
// And start fielding requests from client(s).
CActiveScheduler::Start();
LOG("CActiveScheduler Started.\n");
- // Tidy up...
+ // Tidy up...
delete pS;
delete pA;
View
34 runtimes/cpp/platforms/symbian/server/MoSyncServer.h
@@ -40,7 +40,7 @@ class CMoSyncServer : public CServer2
{
public:
// Creates a new session with the server; the function
- // implements the pure virtutal function
+ // implements the pure virtutal function
// defined in class CServer2
CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
public:
@@ -48,13 +48,22 @@ class CMoSyncServer : public CServer2
static void PanicServer(TMoSyncPanic aPanic);
CMoSyncServer(CActive::TPriority aActiveObjectPriority);
-};
+ virtual ~CMoSyncServer();
+
+ // Load autostart database and start any programs therein.
+ void doAutostartL();
+ void writeAutostartDbL();
+ CArrayFixFlat<TInt>* mAutostart;
+};
//**********************************
//CMoSyncSession
//**********************************
class CPositionNotifier;
+class CNetworkInfoGetter;
+class CNetworkStatusGetter;
+class CNetworkStatusChangeGetter;
/**
This class represents a session with the server.
@@ -65,32 +74,39 @@ class CMoSyncSession : public CSession2
public:
CMoSyncSession();
virtual ~CMoSyncSession();
-
+
void ConstructL();
//service request
void ServiceL(const RMessage2& aMessage);
void DispatchMessageL(const RMessage2& aMessage);
-
+
void LazyDelete(CActiveLink* aObject);
//individual service calls
- void GetNetworkInfoL(const RMessage2& aMessage);
-
+ template<class T> void GetTelephonyInfoL(const RMessage2& aMessage, T*&);
+ void CancelNetworkStatusChange(const RMessage2& aMessage);
+
void LocationStop();
-
+
void LocationGetL(const RMessage2& aMessage);
void LocationStopL(const RMessage2& aMessage);
+ void AutostartOnL(const RMessage2& aMessage);
+ void AutostartOffL(const RMessage2& aMessage);
+
protected:
// panic the client, but leave the server running
void PanicClient(const RMessage2& aMessage,TInt aPanic) const;
private:
CActiveEnder* mEnder;
-
+
CTelephony* mTelephony;
-
+ CNetworkInfoGetter* mNetworkInfo;
+ CNetworkStatusGetter* mNetworkStatus;
+ CNetworkStatusChangeGetter* mNetworkStatusChange;
+
RPositionServer mPositionServer;
RPositioner mPositioner;
CPositionNotifier* mPn; //no need to delete this in destructor
View
10 runtimes/cpp/platforms/symbian/server/MoSyncServer.mmp
@@ -8,18 +8,20 @@
TARGET MoSyncServer.exe
TARGETTYPE exe
-UID 0x100039CE 0x20022A9D
+UID 0x100039CE 0x20037EBF
VENDORID 0
-CAPABILITY ReadDeviceData Location
+CAPABILITY ReadDeviceData Location WriteDeviceData SwEvent
EPOCSTACKSIZE 0x10000
SOURCEPATH .
SOURCE MoSyncServer.cpp
-SOURCE GetNetworkInfo.cpp
SOURCE ActiveEnder.cpp
SOURCE Log.cpp
SOURCE Location.cpp
+SOURCE Autostart.cpp
+
+RESOURCE MoSyncServer_startup.rss
USERINCLUDE .
SYSTEMINCLUDE \Epoc32\include
@@ -28,3 +30,5 @@ LIBRARY euser.lib
LIBRARY etel3rdparty.lib
LIBRARY efsrv.lib
LIBRARY Lbs.lib
+LIBRARY ws32.lib apgrfx.lib
+LIBRARY apparc.lib
View
10 runtimes/cpp/platforms/symbian/server/MoSyncServer.pkg
@@ -4,7 +4,7 @@
&EN
; standard SIS file header
-#{"MoSyncServer"},(0x20022A9D),1,2,0, TYPE=SA
+#{"MoSyncServer2"},(0x20037EBF),1,5,0, TYPE=SA
;Localised Vendor name
%{"Mobile Sorcery AB"}
@@ -15,8 +15,12 @@
;Supports S60 3rd Edition
[0x101F7961], 0, 0, 0, {"S60ProductID"};
+;Supports S60 5th Edition
+[0x1028315F], 0, 0, 0, {"Series60ProductID"}
+
;Files to install
-"\Symbian\9.2\S60_3rd_FP1\Epoc32\release\gcce\urel\MoSyncServer.exe" -"!:\sys\bin\MoSyncServer.exe"
+"\Symbian\9.2\S60_3rd_FP1\Epoc32\data\MoSyncServer_startup.RSC" -"c:\private\101f875a\import\[20037EBF].rsc"
+"\Symbian\9.2\S60_3rd_FP1\Epoc32\release\gcce\urel\MoSyncServer.exe" -"!:\sys\bin\20037EBF.exe"
-;required for application to be covered by backup/restore facility
+;required for application to be covered by backup/restore facility
; "backup_registration.xml" -"!:\private\MoSyncServer\backup_registration.xml"
View
BIN  runtimes/cpp/platforms/symbian/server/MoSyncServer_Express_Signed.sis
Binary file not shown
View
7 runtimes/cpp/platforms/symbian/server/MoSyncServer_startup.rss
@@ -0,0 +1,7 @@
+#include <startupitem.rh>
+
+RESOURCE STARTUP_ITEM_INFO mosync_server
+{
+ executable_name = "!:\\sys\\bin\\20037EBF.exe";
+ recovery = EStartupItemExPolicyNone;
+}
View
108 runtimes/cpp/platforms/symbian/server/NetworkInfo.h
@@ -0,0 +1,108 @@
+/* Copyright (C) 2009 Mobile Sorcery AB
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License, version 2, as published by
+the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include <Etel3rdParty.h>
+
+#include "MoSyncServer.h"
+#include "ActiveEnder.h"
+#include "Log.h"
+
+class CTelephonyHandler : public CActiveLink {
+protected:
+ RMessage2 mMessage;
+ TPtr8 mPckg;
+ const CTelephony::TCancellationRequest mCancellationCode;
+ CTelephony* mTelephony;
+public:
+ template<class T> CTelephonyHandler(CTelephony* aTelephony, CTelephony::TCancellationRequest cr, T& data) :
+ mPckg((TUint8*)&data, sizeof(T), sizeof(T)), mCancellationCode(cr), mTelephony(aTelephony) {}
+ virtual ~CTelephonyHandler() {
+ if(IsActive())
+ Cancel();
+ }
+
+ void RunL() {
+ //LOG("CTelephonyHandler %i RunL %i 0x%x\n", mCancellationCode, iStatus.Int(), this);
+ if(iStatus == KErrNone)
+ mMessage.WriteL(0, mPckg);
+ mMessage.Complete(iStatus.Int());
+ }
+
+ void DoCancel() {
+ LOG("CTelephonyHandler %i DoCancel\n", mCancellationCode);
+ mTelephony->CancelAsync(mCancellationCode);
+ mMessage.Complete(KErrCancel);
+ }
+};
+
+class CNetworkInfoGetter : public CTelephonyHandler {
+public:
+ CNetworkInfoGetter(CTelephony* aTelephony) :
+ CTelephonyHandler(aTelephony, CTelephony::EGetCurrentNetworkInfoCancel, mInfo) {}
+ virtual ~CNetworkInfoGetter() {}
+
+ void start(const RMessage2& aMessage) {
+ mMessage = aMessage;
+ LOG("GetCurrentNetworkInfo\n");
+ mTelephony->GetCurrentNetworkInfo(iStatus, mPckg);
+ SetActive();
+ }
+private:
+ CTelephony::TNetworkInfoV1 mInfo;
+};
+
+class CNetworkStatusGetter : public CTelephonyHandler {
+public:
+ CNetworkStatusGetter(CTelephony* aTelephony) :
+ CTelephonyHandler(aTelephony, CTelephony::EGetNetworkRegistrationStatusCancel, mNR) {}
+ virtual ~CNetworkStatusGetter() {}
+
+ void start(const RMessage2& aMessage) {
+ mMessage = aMessage;
+ LOG("GetNetworkRegistrationStatus\n");
+ mTelephony->GetNetworkRegistrationStatus(iStatus, mPckg);
+ SetActive();
+ }
+private:
+ CTelephony::TNetworkRegistrationV1 mNR;
+};
+
+class CNetworkStatusChangeGetter : public CTelephonyHandler {
+public:
+ CNetworkStatusChangeGetter(CTelephony* aTelephony) :
+ CTelephonyHandler(aTelephony, CTelephony::ENetworkRegistrationStatusChangeCancel, mNR) {}
+ virtual ~CNetworkStatusChangeGetter() {}
+
+ void start(const RMessage2& aMessage) {
+ mMessage = aMessage;
+ LOG("GetNetworkRegistrationStatusChange\n");
+ mTelephony->NotifyChange(iStatus, CTelephony::ENetworkRegistrationStatusChange, mPckg);
+ SetActive();
+ }
+private:
+ CTelephony::TNetworkRegistrationV1 mNR;
+};
+
+template<class T> void CMoSyncSession::GetTelephonyInfoL(const RMessage2& aMessage, T*& getter) {
+ if(mTelephony == NULL) {
+ mTelephony = CTelephony::NewL();
+ }
+ if(getter == NULL) {
+ getter = new (ELeave) T(mTelephony);
+ }
+ getter->start(aMessage);
+}
View
4 runtimes/cpp/platforms/symbian/sis-ed3/MoSync-guido.pkg
@@ -4,7 +4,7 @@
&EN
; standard SIS file header
-#{"MoSync"},(0xE7654321),1,2,0, TYPE=SA
+#{"MoSync"},(0xE7654321),1,5,0, TYPE=SA
;Localised Vendor name
%{"Mobile Sorcery"}
@@ -23,5 +23,5 @@
; "\Symbian\9.2\S60_3rd_FP1\Epoc32\release\armv5\lib\babile_2000725c.dll" -"!:\sys\bin\babile_2000725c.dll"
"\Symbian\9.2\S60_3rd_FP1\Epoc32\release\gcce\urel\MoSync2.exe" -"!:\sys\bin\E7654321.exe"
-;required for application to be covered by backup/restore facility
+;required for application to be covered by backup/restore facility
; "backup_registration.xml" -"!:\private\E7654321\backup_registration.xml"
View
8 runtimes/cpp/platforms/symbian/sis-ed3/MoSync-server.pkg
@@ -4,7 +4,7 @@
&EN
; standard SIS file header
-#{"MoSync"},(0xE7654321),1,2,0, TYPE=SA
+#{"MoSync"},(0xE7654321),1,5,0, TYPE=SA
;Localised Vendor name
%{"Mobile Sorcery"}
@@ -15,9 +15,9 @@
;Supports S60 3rd Edition
[0x101F7961], 0, 0, 0, {"S60ProductID"};
-;Requires the MoSync Server, v1.2.0
+;Requires the MoSync Server, v1.5.0
@"MoSyncServer.sis",(0x20022A9D)
-(0x20022A9D), 1, 2, 0, {"MoSync Server"}
+(0x20022A9D), 1, 5, 0, {"MoSync Server"}
;Files to install
"\Symbian\9.2\S60_3rd_FP1\Epoc32\data\z\resource\apps\MoSync_3rd.RSC" -"!:\resource\apps\E7654321.rsc"
@@ -25,5 +25,5 @@
"\Symbian\9.2\S60_3rd_FP1\Epoc32\data\Z\private\10003a3f\import\apps\MoSync_reg.RSC" -"!:\private\10003a3f\import\apps\E7654321_reg.rsc"
"\Symbian\9.2\S60_3rd_FP1\Epoc32\release\gcce\urel\MoSync2.exe" -"!:\sys\bin\E7654321.exe"
-;required for application to be covered by backup/restore facility
+;required for application to be covered by backup/restore facility
; "backup_registration.xml" -"!:\private\E7654321\backup_registration.xml"
View
8 runtimes/cpp/platforms/symbian/sis-ed3/MoSync-template.pkg
@@ -4,7 +4,7 @@
&EN
; standard SIS file header
-#{"%project-name%"},(0x%uid%),1,2,0, TYPE=SA
+#{"%project-name%"},(0x%uid%),1,5,0, TYPE=SA
;Localised Vendor name
%%{"%vendor-name%"}
@@ -15,9 +15,9 @@
;Supports S60 3rd Edition
[0x101F7961], 0, 0, 0, {"S60ProductID"};
-;Requires the MoSync Server, v1.2.0
-@"%pkg-runtime-dir%/MoSyncServer.sis",(0x20022A9D)
-(0x20022A9D), 1, 2, 0, {"MoSync Server"}
+;Requires the MoSync Server, v1.5.0
+@"%pkg-runtime-dir%/MoSyncServer.sis",(0x20037EBF)
+(0x20037EBF), 1, 5, 0, {"MoSync Server"}
;Files to install
"%pkg-package-output-dir%/%uid%.exe" -"!:\sys\bin\%uid%.exe"
View
4 runtimes/cpp/platforms/symbian/sis-ed3/MoSync.pkg
@@ -4,7 +4,7 @@
&EN
; standard SIS file header
-#{"MoSync"},(0xE7654321),1,2,0, TYPE=SA
+#{"MoSync"},(0xE7654321),1,5,0, TYPE=SA
;Localised Vendor name
%{"Mobile Sorcery"}
@@ -21,5 +21,5 @@
"\Symbian\9.2\S60_3rd_FP1\Epoc32\data\Z\private\10003a3f\import\apps\MoSync_reg.RSC" -"!:\private\10003a3f\import\apps\E7654321_reg.rsc"
"\Symbian\9.2\S60_3rd_FP1\Epoc32\release\gcce\urel\MoSync2.exe" -"!:\sys\bin\E7654321.exe"
-;required for application to be covered by backup/restore facility
+;required for application to be covered by backup/restore facility
; "backup_registration.xml" -"!:\private\E7654321\backup_registration.xml"
View
4 runtimes/cpp/platforms/symbian/sis-ed5/MoSync-template.pkg
@@ -15,6 +15,10 @@
;Supports S60 5th Edition
[0x1028315F], 0, 0, 0, {"Series60ProductID"}
+;Requires the MoSync Server, v1.5.0
+@"%pkg-runtime-dir%/MoSyncServer.sis",(0x20037EBF)
+(0x20037EBF), 1, 5, 0, {"MoSync Server"}
+
;Files to install
"%pkg-package-output-dir%\%uid%.exe" -"!:\sys\bin\%uid%.exe"
"%pkg-programcomb-output%" -"!:\resource\apps\%uid%.comb"
View
4 runtimes/cpp/platforms/symbian/sis-ed5/MoSync.pkg
@@ -4,7 +4,7 @@
&EN
; standard SIS file header
-#{"MoSync"},(0xE7654321),1,2,0, TYPE=SA
+#{"MoSync"},(0xE7654321),1,5,0, TYPE=SA
;Localised Vendor name
%{"Mobile Sorcery"}
@@ -21,5 +21,5 @@
"\Symbian\s60v5\S60_5th_Edition_SDK_v1.0\epoc32\data\z\private\10003a3f\import\apps\MoSync_reg.RSC" -"!:\private\10003a3f\import\apps\E7654321_reg.rsc"
"\Symbian\s60v5\S60_5th_Edition_SDK_v1.0\epoc32\release\gcce\urel\MoSync2.exe" -"!:\sys\bin\E7654321.exe"
-;required for application to be covered by backup/restore facility
+;required for application to be covered by backup/restore facility
; "backup_registration.xml" -"!:\private\E7654321\backup_registration.xml"
View
60 runtimes/cpp/platforms/symbian/src/AppUi.cpp
@@ -18,6 +18,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <eikon.hrh>
#include <apgcli.h>
#include <aknutils.h>
+#include <APGWGNAM.H>
#include "Application.h"
#include "AppUi.h"
@@ -37,11 +38,14 @@ CAppUi::~CAppUi()
RemoveFromStack(iAppView);
delete iAppView;
}
+#ifdef __SERIES60_3X__
+ SAFE_DELETE(iGn);
+#endif
SAFE_DELETE(iBuf);
LOGD("~CAppUi ends\n");
}
-void CAppUi::ConstructL( void )
+void CAppUi::ConstructL( void )
{
// initialize appUI with standard values, read standard resource files
BaseConstructL(EAknEnableSkin);
@@ -53,6 +57,8 @@ void CAppUi::ConstructL( void )
AddToStackL( iAppView ); // view now gets key press events
#ifdef __SERIES60_3X__
+ iGn = CApaWindowGroupName::NewL(iWsSession);
+
iInterfaceSelector = CRemConInterfaceSelector::NewL();
iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *this);
iInterfaceSelector->OpenTargetL();
@@ -61,13 +67,16 @@ void CAppUi::ConstructL( void )
LOG("Initialization complete.\n");
}
-CAppUi::CAppUi( CDocument& aDocument )
+CAppUi::CAppUi( CDocument& aDocument )
: iDocument(aDocument), iReload(false), iAppView(NULL), iExiting(false), iBuf(NULL)
-{
+#ifdef __SERIES60_3X__
+ ,iWsSession(iEikonEnv->WsSession()), iGn(NULL), iHomeScreenShown(false)
+#endif
+{
}
-void CAppUi::HandleCommandL( TInt aCommand )
-{
+void CAppUi::HandleCommandL( TInt aCommand )
+{
switch(aCommand) {
case EEikCmdExit:
LOG("EEikCmdExit\n");
@@ -143,12 +152,49 @@ void CAppUi::Exit() {
}
iExiting = true;
Stop();
-
+
//HACK-test, recompiler USER-EXEC 3
//LOG("calling User::Leave()\n");
//User::Leave(KLeaveMoSyncExit);
-
+
LOG("calling CAknAppUi::Exit()\n");
CAknAppUi::Exit();
LOG("CAppUi::Exit() ends\n");
}
+
+void CAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) {
+ CAknAppUi::HandleWsEventL(aEvent, aDestination);
+ LOGD("WsEvent type %i\n", aEvent.Type());
+#ifdef __SERIES60_3X__
+ if(aEvent.Type() == EEventFocusGroupChanged) {
+ LOGD("EEventFocusGroupChanged\n");
+ TInt wgid = iWsSession.GetFocusWindowGroup();
+ iGn->ConstructFromWgIdL(wgid);
+ int uid = iGn->AppUid().iUid;
+ LOGD("UID: 0x%08X\n", uid);
+ MAEvent e;
+ bool doEvent = false;
+ switch(uid) {
+ // http://wiki.forum.nokia.com/index.php/UID_standby_phone
+ case 0x100058B3:
+ case 0x102750F0:
+ case 0x101FD64C:
+ LOGD("Standby screen!\n");
+ e.type = EVENT_TYPE_HOMESCREEN_SHOWN;
+ if(!iHomeScreenShown) {
+ iHomeScreenShown = true;
+ doEvent = true;
+ }
+ break;
+ default:
+ e.type = EVENT_TYPE_HOMESCREEN_HIDDEN;
+ if(iHomeScreenShown) {
+ iHomeScreenShown = false;
+ doEvent = true;
+ }
+ }
+ if(doEvent)
+ iAppView->AddEvent(e);
+ }
+#endif //__SERIES60_3X__
+}
View
10 runtimes/cpp/platforms/symbian/src/AppView.cpp
@@ -839,3 +839,13 @@ int CAppView::TextBox(const TDesC& title, const TDesC& inText, TDes& outText, in
CleanupStack::Pop(dlg);
return answer ? 1 : 0;
}
+
+void CAppView::HomeScreenEventsOn() {
+ RWindowGroup& wg(CCoeEnv::Static()->RootWin());
+ LHEL(wg.EnableFocusChangeEvents());
+}
+
+void CAppView::HomeScreenEventsOff() {
+ RWindowGroup& wg(CCoeEnv::Static()->RootWin());
+ wg.DisableFocusChangeEvents();
+}
View
47 runtimes/cpp/platforms/symbian/src/Client.cpp
@@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <apgcli.h> // link against apgrfx.lib
#include <apacmdln.h> // link against apparc.lib
-_LIT(KMoSyncServerExe, "MoSyncServer.exe");
+_LIT(KMoSyncServerExe, "20037EBF.exe");
//does nothing if server is already started
//todo: don't die if server can't be started
@@ -39,7 +39,7 @@ static void StartServer() {
LOG("Starting server...\n");
/* TThreadId app_threadid;
- CApaCommandLine* cmdLine;
+ CApaCommandLine* cmdLine;
cmdLine=CApaCommandLine::NewLC();
cmdLine->SetExecutableNameL(KMoSyncServerExe);
cmdLine->SetCommandL(EApaCommandRun);
@@ -49,10 +49,10 @@ static void StartServer() {
ls.Close();
CleanupStack::PopAndDestroy(cmdLine);
LHEL(err);*/
-
+
RProcess proc;
TRequestStatus rendezvousStatus;
-
+
//if this fails, display a friendly "reinstall" message.
TInt res = proc.Create(KMoSyncServerExe, KNullDesC);
if(IS_SYMBIAN_ERROR(res)) {
@@ -64,7 +64,7 @@ static void StartServer() {
#endif
ShowAknErrorNoteThenExitL(KErrorMessage);
}
-
+
proc.Rendezvous(rendezvousStatus);
proc.Resume();
User::WaitForRequest(rendezvousStatus);
@@ -74,10 +74,16 @@ static void StartServer() {
int RMoSyncServerSession::Connect() {
StartServer();
- return CreateSession(KMoSyncServer, Version(), 4);
+ int res = CreateSession(KMoSyncServer, Version(), 4);
+ if(res == KErrNone) {
+ mConnected = true;
+ }
+ return res;
}
TVersion RMoSyncServerSession::Version() const {
+ LOG("Client version: %i.%i.%i\n", KMoSyncMajorVersionNumber,
+ KMoSyncMinorVersionNumber, KMoSyncBuildVersionNumber);
return TVersion(KMoSyncMajorVersionNumber, KMoSyncMinorVersionNumber,
KMoSyncBuildVersionNumber);
}
@@ -92,7 +98,36 @@ void RMoSyncServerSession::LocationGet(TRequestStatus& aStatus) {
SendReceive(EMoSyncLocationGet, args, aStatus);
}
int RMoSyncServerSession::LocationStop() {
+ if(!mConnected)
+ return 0;
return Send(EMoSyncLocationStop);
}
+int RMoSyncServerSession::AutostartOn() {
+ return SendReceive(EMoSyncAutostartOn);
+}
+
+int RMoSyncServerSession::AutostartOff() {
+ return SendReceive(EMoSyncAutostartOff);
+}
+
+int RMoSyncServerSession::GetNetworkStatus(
+ CTelephony::TNetworkRegistrationV1& nr)
+{
+ CTelephony::TNetworkRegistrationV1Pckg pckg(nr);
+ TIpcArgs args(&pckg);
+ return SendReceive(EMoSyncGetNetworkStatus, args);
+}
+
+void RMoSyncServerSession::GetNetworkStatusChange(
+ CTelephony::TNetworkRegistrationV1Pckg& nr, TRequestStatus& aStatus)
+{
+ TIpcArgs args(&nr);
+ SendReceive(EMoSyncGetNetworkStatusChange, args, aStatus);
+}
+
+void RMoSyncServerSession::CancelNetworkStatusChange() {
+ Send(EMoSyncCancelNetworkStatusChange);
+}
+
#endif //SUPPORT_MOSYNC_SERVER
View
35 runtimes/cpp/platforms/symbian/src/SyscallImpl.cpp
@@ -248,6 +248,9 @@ CONSTRUCTOR_ARGUMENTS(INIT_ARG_VAR, COMMA),
#ifdef TELEPHONY
gTelephony(NULL),
#endif
+#ifdef SUPPORT_MOSYNC_SERVER
+gNetworkRegistrationPckg(gNetworkRegistration),
+#endif
gBtDeviceArray(8, 0),
resourcesCount(-1),
resource(NULL)
@@ -508,6 +511,11 @@ void Syscall::platformDestruct() {
gFileLists.close();
+#ifdef SUPPORT_MOSYNC_SERVER
+ LOG("gServer.Close();\n");
+ gServer.Close();
+#endif
+
DebugMarkEnd();
LOG("platformDestruct() done\n");
}
@@ -1633,6 +1641,32 @@ SYSCALL(longlong, maIOCtl(int function, int a, int b, int c)) {
maIOCtl_syscall_case(maTextBox);
+#ifdef SUPPORT_MOSYNC_SERVER
+ case maIOCtl_maAutostartOn:
+ return gServer.AutostartOn();
+ case maIOCtl_maAutostartOff:
+ return gServer.AutostartOff();
+#endif
+
+ case maIOCtl_maHomeScreenEventsOn:
+ gAppView.HomeScreenEventsOn();
+ return 1;
+ case maIOCtl_maHomeScreenEventsOff:
+ gAppView.HomeScreenEventsOff();
+ return 1;
+
+ maIOCtl_syscall_case(maIapSave);
+ maIOCtl_syscall_case(maIapReset);
+ maIOCtl_syscall_case(maIapShutdown);
+
+#ifdef __SERIES60_3X__
+#ifdef SUPPORT_MOSYNC_SERVER
+ maIOCtl_syscall_case(maNetworkStatus);
+#endif
+ maIOCtl_syscall_case(maIapSetMethod);
+ maIOCtl_syscall_case(maIapSetFilter);
+#endif //__SERIES60_3X__
+
default:
return IOCTL_UNAVAILABLE;
}
@@ -1641,7 +1675,6 @@ SYSCALL(longlong, maIOCtl(int function, int a, int b, int c)) {
#ifdef CALL
int Syscall::platformTel(const char* tel) {
TPtrC8 np(CBP tel);
-
LOG("platformTel \"%s\"\n", tel);
if(gCallSync->Status()->Int() == KRequestPending ||
View
278 runtimes/cpp/platforms/symbian/src/netImpl.cpp
@@ -25,8 +25,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "AppView.h"
#include "net/net_errors.h"
#include "net/net.h"
+#include "symbian_errors.h"
using namespace Base;
+using namespace MoSyncError;
static void storeBtAddr(TBTDevAddr btaddr, MAConnAddr* addr);
static void storeSockAddr(const TSockAddr& sockaddr, MAConnAddr* addr);
@@ -35,51 +37,162 @@ void Syscall::ClearNetworkingVariables() {
gConnNextHandle = 1;
gConnCleanupQue = NULL;
gNetworkingState = EIdle;
+#ifdef __SERIES60_3X__
+#ifdef SUPPORT_MOSYNC_SERVER
+ gNetworkStatusSync = NULL;
+#endif
+ gIapMethod = MA_IAP_METHOD_STANDARD;
+ gIapFilter = MA_IAP_FILTER_ALL;
+#endif
}
void Syscall::ConstructNetworkingL() {
gHttpStringPool.OpenL();
gConnOps.SetOffset(_FOFF(ConnOp, mLink));
gConnCleanupQue = new (ELeave) CActiveEnder(_FOFF(ConnOp, mLink));
+
+ MyRFs myrfs;
+ myrfs.Connect();
+ LHEL(FSS.SessionPath(gIapPath16));
+
+ // apparently, it doesn't exist by default.
+ int res = FSS.MkDir(gIapPath16);
+ if(res != KErrAlreadyExists) {
+ LHEL(res);
+ }
+
+ _LIT(KIapFileName, "iap.txt");
+ gIapPath16.Append(KIapFileName);
+ gIapPath8.Copy(gIapPath16);
+ LOGS("iap path: %s\n", gIapPath8.PtrZ());
+
+#if 0//def SUPPORT_MOSYNC_SERVER
+ gNetworkStatusSync = new (ELeave) CClassSynchronizer<Syscall>(this,
+ &Syscall::NetworkStatusChangeHandlerL);
+ gServer.GetNetworkStatusChange(gNetworkRegistrationPckg,
+ *gNetworkStatusSync->Status());
+ gNetworkStatusSync->SetActive();
+#endif
}
-#if defined(SAVE_IAP)
+void Syscall::DestructNetworking() {
+ LOG("DestructNetworking\n");
+#ifdef SUPPORT_MOSYNC_SERVER
+ // Can freeze. UI activation appears to unfreeze it. Very weird.
+ if(gNetworkStatusSync) {
+ gServer.CancelNetworkStatusChange();
+ User::WaitForRequest(*gNetworkStatusSync->Status());
+ }
+ SAFE_DELETE(gNetworkStatusSync);
+#endif
+ maIapShutdown();
+ SAFE_DELETE(gConnCleanupQue);
+ gHttpStringPool.Close();
+ LOG("DestructNetworking done\n");
+}
-#ifdef __SERIES60_3X__
-#define IAP_STORE_PATH "C:\\Data\\MAStore\\iap.txt"
-#else //Series 60, 2nd Ed.
-#define IAP_STORE_PATH "C:\\MAStore\\iap.txt"
-#endif //__SERIES60_3X__
-
-#ifdef GUIDO
-static int getSavedIap() {
- FileStream readFile(IAP_STORE_PATH);
+#ifdef SUPPORT_MOSYNC_SERVER
+int Syscall::maNetworkStatus() {
+ CTelephony::TNetworkRegistrationV1 nr;
+ int res = gServer.GetNetworkStatus(nr);
+ if(res != KErrNone) {
+ LOG("GetNetworkStatus error %i\n", res);
+ return res;
+ }
+ return nr.iRegStatus;
+}
+
+void Syscall::NetworkStatusChangeHandlerL(TInt result) {
+ LOG("NetworkStatusChangeHandlerL(%i) %i\n", result, gNetworkRegistration.iRegStatus);
+ if(result != KErrNone) {
+ LOG("Error %i, stopping network status change notifications.\n", result);
+ return;
+ }
+ // send event to inferior.
+ MAEvent e;
+ e.type = EVENT_TYPE_NETWORK;
+ e.state = gNetworkRegistration.iRegStatus;
+ gAppView.AddEvent(e);
+
+ // moar notifications, please.
+ gServer.GetNetworkStatusChange(gNetworkRegistrationPckg,
+ *gNetworkStatusSync->Status());
+ gNetworkStatusSync->SetActive();
+}
+#endif //SUPPORT_MOSYNC_SERVER
+
+// todo: improve efficiency by using native file api instead of FileStream.
+bool Syscall::getSavedIap(TUint& iap) {
+ FileStream readFile(CCP gIapPath8.PtrZ());
if(!readFile.isOpen())
- return 0;
+ return false;
TBuf8<32> buf;
int len;
DEBUG_ASSERT(readFile.length(len));
buf.SetLength(len);
DEBUG_ASSERT(readFile.read((void*)buf.Ptr(), len));
TLex8 lex(buf);
- uint iap;
DEBUG_ASSERT(!lex.Val(iap));
- return iap;
+ return true;
}
-#endif //GUIDO
-
-static void saveIap(uint iap) {
- MyRFs myrfs;
- myrfs.Connect();
- FSS.MkDir(KMAStorePath16);
- WriteFileStream writeFile(IAP_STORE_PATH);
+int Syscall::maIapSave() {
+ if(gNetworkingState != EStarted)
+ return 0;
+ WriteFileStream writeFile(CCP gIapPath8.PtrZ());
DEBUG_ASSERT(writeFile.isOpen());
TBuf8<32> buf;
- buf.Format(_L8("%i\n"), iap);
+ buf.Format(_L8("%i\n"), gIapId);
DEBUG_ASSERT(writeFile.write(buf.Ptr(), buf.Size()));
+ return 1;
+}
+
+int Syscall::maIapReset() {
+ MyRFs myrfs;
+ myrfs.Connect();
+ int res = FSS.Delete(gIapPath16);
+ switch(res) {
+ case KErrNone:
+ return 1;
+ case KErrNotFound:
+ return 0;
+ default:
+ return res;
+ }
+}
+
+// unstable. please don't use.
+int Syscall::maIapShutdown() {
+ StopNetworking();
+
+ gConnOpsWaitingForNetworkingStart.Close();
+
+ //destroy all humans... I mean Connections :)
+ gConnections.close();
+
+ if(gNetworkingState != EIdle) {
+ gConnection.Close();
+ }
+ gNetworkingState = EIdle;
+
+ return 1;
}
-#endif //SAVE_IAP
+
+#ifdef __SERIES60_3X__
+int Syscall::maIapSetMethod(int method) {
+ MYASSERT(method == MA_IAP_METHOD_STANDARD || method == MA_IAP_METHOD_WLAN,
+ SYMERR_IAP_METHOD);
+ gIapMethod = method;
+ return 1;
+}
+
+int Syscall::maIapSetFilter(int filter) {
+ MYASSERT(filter >= MA_IAP_FILTER_NOT_WLAN && filter <= MA_IAP_FILTER_ALL,
+ SYMERR_IAP_FILTER);
+ gIapFilter = filter;
+ return 1;
+}
+#endif //__SERIES60_3X__
void Syscall::StartNetworkingL(ConnOp& connOp) {
LOGST("StartNetworkingL");
@@ -95,33 +208,61 @@ void Syscall::StartNetworkingL(ConnOp& connOp) {
gNetworkingState = EStarting;
LHEL(gConnection.Open(gSocketServ));
-#if 0//defined(__WINSCW__)
- {
- TUint count;
- LHEL(gConnection.EnumerateConnections(count));
- LOG("%i active connections.\n", count);
- if(count == 0) {
- gConnection.Start(connOp.iStatus);
+ TCommDbConnPref pref;
+#ifdef __SERIES60_3X__
+ if(gIapMethod == MA_IAP_METHOD_WLAN) {
+#if 0 // didn't work; prompted anyway.
+ pref.SetBearerSet(KCommDbBearerWLAN);
+#endif
+ RArray<TUint> iaps;
+ if(gWlanAvailable) {
+ LHEL(gWlanClient->GetAvailableIaps(iaps));
+ LOG("%i WLAN IAPs available.\n", iaps.Count());
}
+ if(iaps.Count() > 0) {
+ LOG("Picked IAP %i\n", iaps[0]);
+ pref.SetIapId(iaps[0]);
+ pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
+ } else {
+ LOG("No WLAN IAPs available. Failing...\n");
+ //connOp.SendResult(CONNERR_NETWORK);
+ connOp.mConn.connErr = CONNERR_NETWORK;
+ //connOp.RunL();
+ connOp.SetActive();
+ TRequestStatus* rsp = &connOp.iStatus;
+ User::RequestComplete(rsp, KErrGeneral);
+ return;
+ }
+ } else
+#endif //__SERIES60_3X__
+ if(gIapMethod == MA_IAP_METHOD_STANDARD) {
+ bool hasSavedIap = getSavedIap(gIapId);
+ if(hasSavedIap) {
+ LOG("Saved IAP: %u\n", gIapId);
+ pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
+ pref.SetIapId(gIapId);
+ DEBUG_ASSERT(pref.IapId() == gIapId);
+ } else {
+ LOG("No saved IAP, showing dialog...\n");
+#ifdef __SERIES60_3X__
+ if(gIapFilter == MA_IAP_FILTER_NOT_WLAN) {
+ // Note: doesn't work on E61i. WLAN is still displayed.
+ LOG("Not wlan.\n");
+ pref.SetBearerSet(0xFF & ~KCommDbBearerWLAN);
+ } else if(gIapFilter == MA_IAP_FILTER_WLAN) {
+ LOG("Wlan only.\n");
+ pref.SetBearerSet(KCommDbBearerWLAN);
+ } else {
+ DEBUG_ASSERT(gIapFilter == MA_IAP_FILTER_ALL);
+ }
+#endif //__SERIES60_3X__
+ pref.SetDialogPreference(ECommDbDialogPrefPrompt);
+ }
+ } else {
+ DEBIG_PHAT_ERROR;
}
-#else //hardware
- {
- //TODO: enable user to select. keep default code for Gui-Do.
- TCommDbConnPref pref;
-#ifdef GUIDO
- uint iap = 0;
-#ifdef SAVE_IAP
- iap = getSavedIap();
-#endif
- pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
- pref.SetIapId(iap); //magic number, uses the default IAP
- DEBUG_ASSERT(pref.IapId() == iap);
-#else //GUIDO
- pref.SetDialogPreference(ECommDbDialogPrefPrompt);
-#endif //GUIDO
- gConnection.Start(pref, connOp.iStatus);
- }
-#endif //__WINSCW__
+ gConnection.Start(pref, connOp.iStatus);
+
connOp.SetActive();
LOGST("SN active");
}
@@ -139,9 +280,7 @@ void Syscall::FinishNetworkingStartL() {
//name seems extremely hard to get. maybe just save IAP number in an ini file?
//what if user wants to change IAP? maybe she picked the wrong one.
-#ifdef SAVE_IAP
- saveIap(ci.iIapId);
-#endif
+ gIapId = ci.iIapId;
gNetworkingState = EStarted;
@@ -169,23 +308,6 @@ void Syscall::StopNetworking() {
}
}
-void Syscall::DestructNetworking() {
- StopNetworking();
-
- gConnOpsWaitingForNetworkingStart.Close();
-
- //destroy all humans... I mean Connections :)
- gConnections.close();
-
- SAFE_DELETE(gConnCleanupQue);
-
-#if SYNCTEST
- delete tSync;
-#endif
- gConnection.Close();
- gHttpStringPool.Close();
-}
-
void Syscall::CancelConnOps(MAHandle conn) {
//cancel all operations on this connection
TDblQueIter<ConnOp> itr(gConnOps);
@@ -309,7 +431,7 @@ void Syscall::ConnOp::SendResult(int result) {
//LOGS("cops %i 0x%08X\n", mSyscall.gConnOps.IsEmpty(), mSyscall.gConnOps.First());
mSyscall.gConnCleanupQue->move(this);
//LOGS("cops %i\n", mSyscall.gConnOps.IsEmpty());
-
+
if(mConn.errorOverride)
result = mConn.errorOverride;
@@ -432,7 +554,7 @@ void Syscall::ConnOp::RunL() {
subOps.Pop();
}
-
+
if(!subOps.IsEmpty()) {
StartConnSubOpL();
} else {
@@ -585,7 +707,9 @@ void Syscall::ConnOp::StartConnSubOpL() {
LOG("Unhandled SubConnOp %i\n", sop.type);
DEBIG_PHAT_ERROR;
}
- LOGST("SCSO end");
+ // this line would randomly (maybe 30%) cause KERN-EXEC 3
+ // during StartNetworkingL after a call to maIapShutdown().
+ //LOGST("SCSO end");
}
//******************************************************************************
@@ -714,7 +838,7 @@ void Syscall::ConnOp::addHttpSendHeaders() {
//send headers
http->mBufPtr.Set(CBufFlatPtr(http->mBuffer()));
CSO_ADD(Write, http->mBufPtr);
-
+
http->mState = CHttpConnection::WRITING;
}
@@ -768,7 +892,7 @@ void CHttpConnection::FormatRequestL() {
default:
BIG_PHAT_ERROR(ERR_HTTP_METHOD_INVALID);
}
-
+
APPEND(*mPath);
APPEND(_L8(" HTTP/1.0\r\n"));
@@ -860,7 +984,7 @@ void CHttpConnection::RunL(TInt aResult) {
LOG("HTTP header buffer full!\n");
CompleteReadHeaders(CONNERR_INTERNAL, 0);
}
-
+
// copy partial header lines to beginning of buffer
if(startPos != 0) {
LOGS("Deleting %i bytes.\n", startPos);
@@ -1088,7 +1212,7 @@ void CBtServerSocket::init(RSocketServ& aServer, const TUUID& uuid, bool hasName
// set protocol list to the record
mSdpDB.UpdateAttributeL(mHandle, KSdpAttrIdProtocolDescriptorList, *pdl);
-
+
// set browse group
// service will not appear in scans unless this is set properly!
TCleaner<CSdpAttrValueDES> bga(CSdpAttrValueDES::NewDESL(NULL));
@@ -1273,7 +1397,7 @@ SYSCALL(MAHandle, maConnect(const char* url)) {
return CONNERR_URL;
}
Smartie<CSocket> sockp(createSocket(ssl));
-
+
_LIT8(K127, "127.");
TInetAddr addr;
bool localhost = false;
@@ -1412,7 +1536,7 @@ SYSCALL(int, maConnGetAddr(MAHandle conn, MAConnAddr* addr)) {
if(addr->family == CONN_FAMILY_BT) {
TBTDevAddr btaddr;
//TPckgBuf<TBTDevAddr> pckg(btaddr);
-
+
//old style, might work on Symbian 7.0 and earlier
//update: doesn't work on 6630.
#if 0//!defined(__SERIES60_3X__)
@@ -1455,7 +1579,7 @@ SYSCALL(int, maConnGetAddr(MAHandle conn, MAConnAddr* addr)) {
return CONNERR_INTERNAL;
}
}
-
+
CConnection* cc = gConnections.find(conn);
MYASSERT(cc, ERR_CONN_HANDLE_INVALID);
//we have 4 options: tcp client, bt client, tcp server, bt server
View
160 testPrograms/iap/main.cpp
@@ -0,0 +1,160 @@
+/* Copyright (C) 2009 Mobile Sorcery AB
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License, version 2, as published by
+the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+/**
+* This example shows how to do basic Moblet based HTTP/HTTPS communication.
+*
+* If content-length is returned as an response header, then the first 1024
+* bytes of the content will be read.
+*
+*/
+
+#include <maapi.h>
+#include <MAUtil/Moblet.h>
+#include <MAUtil/Connection.h>
+#include <conprint.h>
+#include <maassert.h>