《BREW進階與精通——3G移動增值業務的運營、定製與開發》連載之77——BREW中位置資訊的獲得(LBS應用)

來源:互聯網
上載者:User

IPosDet介面可以直接獲得經緯度等相關資訊,應用將這些資訊傳遞給伺服器與GIS系統配合使用就可以開發出各種豐富多彩的應用了,IPosDet的使用樣本如下:

// create the instance for PosDet

ISHELL_CreateInstance(pi->a.m_pIShell, AEECLSID_POSDET, (void **) &(pi->m_pPosDet));                                           

if(pi->m_pPosDet)        {

                // Initialize the Callback function

                CALLBACK_Init(&pi->SimpleGPSCB, simplegps_PosDetCB, pi);

                // You also can get seperate information through

                IPOSDET_GetGPSInfo(pi->m_pPosDet, AEEGPS_GETINFO_LOCATION|AEEGPS_GETINFO_VELOCITY|AEEGPS_GETINFO_ALTITUDE,AEEGPS_ACCURACY_LEVEL1, &pi->m_gpsInfo, &pi->SimpleGPSCB);

}

                return(TRUE);

Simplegps_PosDetCB函數將得到的位置資訊顯示的螢幕上,以顯示緯度為例的代碼如下:

// wasFactor is the factor between AEEGPSInfo and real world data.

   STR_TO_WSTR("186413.5111",szNum,sizeof(szNum));

   wgsFactor= WSTR_TO_FLOAT(szNum);

   //Display Latitude on the screen

   val = IntegerToFloat(pMe->m_gpsInfo.dwLat);

   val = FDIV(val, wgsFactor);

   FLOATTOWSTR(val, szNum, TEXT_BUFFER_SIZE);

   STR_TO_WSTR("Lat:", szText, TEXT_BUFFER_SIZE);

   WSTRCAT(szText,szNum);

   // IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);

   IDISPLAY_DrawText(pMe->a.m_pIDisplay,    // Display instance

                  AEE_FONT_BOLD,       // Use BOLD font

                  szText,              // Text - Normally comes from resource

                  -1,                  // -1 = Use full string length

                  0,                   // Ignored - IDF_ALIGN_CENTER

                  32,                   // Ignored - IDF_ALIGN_MIDDLE

                  NULL,                // No clipping

                  IDF_ALIGN_CENTER);

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.