// mod_MobileDial.cpp : Defines the exported functions for the DLL application. // #include "stdafx2.h" #include "mod_MobileDial.h" #include "MobileDlg.h" CAppModule _Module; void CMobileDialServerSession::Handle_Query(SpReqAnsContext::Pointer ctx) { LOG_FUNCTION(); m_pEntity->Query(ctx); } void CMobileDialServerSession::Handle_GetDevInfo(SpReqAnsContext::Pointer ctx) { LOG_FUNCTION(); m_pEntity->GetDevInfo(ctx); } void CMobileDialServerSession::Handle_ShowDialog(SpOnewayCallContext::Pointer ctx) { m_pEntity->CreateMobileDialog(ctx); } unsigned int WINAPI CMobileDialEntity::WndThreadEntry(PVOID param) { CMobileDialEntity* pEntity = reinterpret_cast(param); pEntity->GetFunction()->InitLogCurrentThread(); pEntity->WndEntry(); return 0; } BOOL CMobileDialEntity::UpdateProfileInfo(LPCTSTR lpszInterfaceId) { return FALSE; } BOOL CMobileDialEntity::UpdateProfileInfo(int nCurSel) { return m_fsm.UpdateProfileInfo(nCurSel); } BOOL CMobileDialEntity::UpdateSubInfo(int nCurSel) { return m_fsm.UpdateSubInfo(nCurSel); } ErrorCodeEnum CMobileDialEntity::Connect( int nWayToConnect, LPCTSTR lpszInterfaceID, LPCTSTR lpszProfileName) { LOG_FUNCTION(); FSMEvent *e = new FSMEvent(USER_EVT_CONNECT_FINISHED); if(nWayToConnect == CNT_MBN) { //MBN if(m_fsm.Dial4GConnectEx(lpszInterfaceID, lpszProfileName) > 0) { e->param1 = 4; m_fsm.PostEventLIFO(e); return Error_Succeed; } else { e->param1 = -1; m_fsm.PostEventLIFO(e); return Error_Unexpect; } } else if(nWayToConnect == CNT_RAS) { //RAS if(m_fsm.Dial3GConnectEx(lpszInterfaceID, lpszProfileName) > 0) { e->param1 = 3; m_fsm.PostEventLIFO(e); return Error_Succeed; } else { e->param1 = -1; m_fsm.PostEventLIFO(e); return Error_Unexpect; } } else if(nWayToConnect == CNT_MBB) { //HuaWei MBB //if(m_fsm.SwithMBBConnectStatus(TRUE)) { // e->param1 = 5; // m_fsm.PostEventLIFO(e); // return Error_Succeed; //} else { // e->param1 = -1; // m_fsm.PostEventLIFO(e); // return Error_Unexpect; //} MBBDialupTask* task = new MBBDialupTask(&m_fsm); GetFunction()->PostThreadPoolTask(task); return Error_Succeed; } e->DecRef(); return Error_NoDefine; } ErrorCodeEnum CMobileDialEntity::Disconnect(int nWayToConnect, LPCTSTR lpszInterfaceID) { if(nWayToConnect == CNT_MBN) { //MBN if(m_fsm.Dis4GConnect(lpszInterfaceID)) { return Error_Succeed; } else { return Error_Unexpect; } } else if(nWayToConnect == CNT_RAS) { //RAS if(m_fsm.RasHangUpSuffix(FALSE)) { return Error_Succeed; } else { return Error_Unexpect; } } else if(nWayToConnect == CNT_MBB) { //HuaWei MBB MBBDialupTask* task = new MBBDialupTask(&m_fsm, FALSE); GetFunction()->PostThreadPoolTask(task); return Error_Succeed; //if(m_fsm.SwithMBBConnectStatus(FALSE)) { // return Error_Succeed; //} else { // return Error_Unexpect; //} } return Error_NoDefine; } ErrorCodeEnum CMobileDialEntity::AddNewProfile( const CSimpleStringA csInterfaceID, const AccessKeyInfo newInfo, bool fApplyNow) { return m_fsm.AddNewProfile(csInterfaceID, newInfo, fApplyNow); } ErrorCodeEnum CMobileDialEntity::UpdateProfile(const CSimpleStringA csInterfaceID, LPCTSTR lpszProfileName, const AccessKeyInfo newInfo, bool fApplyNow) { return m_fsm.UpdateProfile(csInterfaceID, lpszProfileName, newInfo, fApplyNow); } ErrorCodeEnum CMobileDialEntity::DeleteProfile(int nDongleIdx, int nProfileIdx) { return m_fsm.DeleteProfile(nDongleIdx, nProfileIdx); } ErrorCodeEnum CMobileDialEntity::SwitchDefaultSlot(int slotIdx) { return m_fsm.SwitchDefaultSlot(slotIdx); } ErrorCodeEnum CMobileDialEntity::ConnectWIFIWithDefault() { ConnectWlanTask* pTask = new ConnectWlanTask(&m_fsm); return GetFunction()->PostEntityTaskFIFO(pTask); //return m_fsm.ConnectWithDefault(); } int CMobileDialEntity::WndEntry() { // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used ::DefWindowProc(NULL, 0, 0, 0L); int nRet = 0; { CMobileDlg dlgMain(this); nRet = dlgMain.DoModal(); } SetEvent(m_hGUIClosedEvent); m_hDialogWnd = NULL; m_fsm.SetNotifyWnd(NULL); m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_DIALOG_OUT)); return nRet; } SP_BEGIN_ENTITY_MAP() SP_ENTITY(CMobileDialEntity) SP_END_ENTITY_MAP()