4 Replies Latest reply on Jan 31, 2012 3:58 AM by Naveen Thomas

    Vibration and Imager Sample

      Our customer Qatar Airways is evaluating Rho on ET1;

       

      Kindly go thru the comment below by the customer and advice me to resolve this issue;

       

      While trying to test “Notification – Vibrator” and “Imaging – Camera”

       

      I tired few sample application for notification and imager, but I couldn’t get it right. Both notification.enumerate(); and imager.enumerate(); is not responding and the system hangs on executing these lines. Is there any configuration/reference file I’m missing ?

        • Re: Vibration and Imager Sample
          Pietro Francesco Maggi

          Hi Pavol,

          Attached below you can find a small sample that enumerates Imagers and notification elements on the ET1.

           

          It works on my ET1 DV unit with BSP 112811 with RhoElements v1.0.1.1.

           

          Hope this helps.

          Regards

          Pietro

           

          -- Follows "enumerate.html"


          <html>

          <script type="text/javascript" src="../../Android/data/com.motorolasolutions.rhoelements/JSobjects.js"></script><!-- For Android Beta -->

          <head>

          <meta HTTP-Equiv="imager" Content="imagerEnumEvent:url('Javascript:fnEnumImagers(%s);')">

          <META HTTP-Equiv="notification" content="EnumNotificationsEvent:url('Javascript:fnEnumNtfy(%s)');">

          </head>

          <style>

          #cmdBar {

          position:absolute;

          top:600;

          right:20;

          }

           

          </style>

          <body BGCOLOR="#FFFFEA" TEXT="#0000A0" LINK="#FF0000" VLINK="#808080" ALINK="#008040" onLoad="fnSetEnumTimer();">

          <br>

          <br>

          <header onclick="history.back()">

              Back to Menu

          </header></body>

          <br>

          <div ID="msgImager"></div>

          <div ID="msgNtfy"></div>

          <br>

          <br>

          <br>

          <div id="cmdBar"/>

           

          </html>

           

          <SCRIPT LANGUAGE="JavaScript">

          var g_nImageCounter = 1;

           

             

          function fnEnumImagers(imagerArray)

          {

                var imagerInfo = "Imagers On Device: " + imagerArray.length + "<BR><select id='imagers_menu'>"

           

              for (i=0; i < imagerArray.length; i++) {

                  imagerInfo = imagerInfo + '<option value="' + imagerArray[i][1] + '">' + imagerArray[i][0] + '</option>';

              }

              imagerInfo = imagerInfo + '</select><BR>'

             

              msgImager.innerHTML = imagerInfo;   

          }

           

          function fnEnumNtfy(ntfyArray)

          {

              var ntfyInfo = "Notification On Device: " + ntfyArray.length + "<BR><select id='notification_menu'>"

           

              for (i=0; i < ntfyArray.length; i++) {

                  ntfyInfo = ntfyInfo + '<option value="' + ntfyArray[i][1] + '">' + ntfyArray[i][2] + '</option>';

              }

              ntfyInfo = ntfyInfo + '</select><BR>'

             

              msgNtfy.innerHTML = ntfyInfo;   

          }

           

          //  We can not call Scanner:Enumerate during page load on WM so give the page 3 seconds to finish loading

          function fnSetEnumTimer()

          {

              msgImager.innerHTML = "getting Imager data...";

              msgNtfy.innerHTML = "getting Notification data...";

              setTimeout("fnOnImagerEnable()", 3000);

              setTimeout("fnOnNtfyEnable()", 3000);

          }

           

          function fnOnImagerEnable()

          {

              var Generic = new ActiveXObject("PocketBrowser.Generic");

              Generic.InvokeMETAFunction('imager', 'Enumerate');

          }

           

          function fnOnNtfyEnable()

          {

              var Generic = new ActiveXObject("PocketBrowser.Generic");

              Generic.InvokeMETAFunction('notification', 'Enumerate');

          }

          </SCRIPT>

            • Re: Vibration and Imager Sample

              Hi Pietro,

               

              The initial question from Pavol was actually Originated from me. I was trying to embedd the imager/notification functionality in one of our application. Well the sample provided by you doesn't seem to work in our test device(ET1) provided by motorola.

               

              I even tried a simple one page application with a alert function and it failed to call the JS function. Below is the sample application and the config.xml file. I really don't know why the JS functions are not firing at all ???

               

              The current RhoElements installed in the device is 1.0.3.6

               

              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

              <html>

              <head>

              <SCRIPT LANGUAGE="JavaScript">


              function fnAlert()
              {

              alert('Hello');

              }

              </SCRIPT>

              </head>


              <body>

              <button id="btAlert" onclick="fnAlert()">Test</button>

              </body>


              </html>

              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

               

              Below is the Config.xml

              ------------------------------------

              <?xml version = "1.0"?>
              <!-- RhoElements Configuration file -->
              <Configuration>

              <DebugButtons>
                <DebugButtonsEnabled value="1" />
              </DebugButtons>

              <Logger>
                <LgoProtocol    value="FILE: />
                <LogPort value="80"/>
                <LogFile  value="file://\Program Files\RhoElements\log.txt" />
                <LogError  value="1" />
                <LogWarning value="1" />
                <LogInfo value="1" />
                <LogUser value="1" />
                <LogDebug value="1" />
              </Logger>

              <FileLocations>
                <RegEXFile  value="file://%INSTALLDIR%/RegEx.xml" />
              </FileLocations>

               

              <Screen>
                <FullScreen value="1" />
              </Screen>

              <Navigation>
                <NavTimeout value="45000"/>
              </Navigation>

              <Proxy>
                <ProxyHost  value="" />
                <ProxyPort  value="" />
                <!-- ProxyExceptions: a list of hosts that should be reached directly,
                 bypassing the proxy. This is a list of regular expressions separated by '|'.
                 Any host matching one of these regular expressions will be reached through
                 a direct connection instead of through a proxy. -->
                <ProxyExceptions value="" />
              </Proxy>

              <Applications>
                <Application>
               
                 <General>
                  <StartPage value="file://\Android\data\com.motorolasolutions.rhoelements\AlertTest.html" name="AlertTest"/>
                  <!--<Name VALUE="Mobile Dispatcher"/>-->
                  <!--<StartPage value="http://qrdispatchtest.qatarairways.com.qa/MobileDispatch_dev/FlightList.aspx" />-->
                 </General>
                
                 <WebDB>
                  <WebStorageDBPath value="file://%INSTALLDIR%"/>
                  <WebSQLDBQuota value="5000000"/>
                  <WebSQLDBPath value="file://%INSTALLDIR%"/>
                 </WebDB>
                
                 <ApplicationCache>
                  <ApplicationCachePath value="file://%INSTALLDIR%"/>
                  <ApplicationCacheQuota value="5000000"/>
                 </ApplicationCache>
                
                 <NPAPI>
                  <Preloads>
                   <PreloadLegacyGeneric value="1"/>
                   <PreloadLegacyODAX    value="1"/>
                   <PreloadLegacyNoSIP   value="1"/>
                   <PreloadLegacyAirBeam value="1"/>
                   <PreloadLegacyAPD     value="1"/>
                   <PreloadJSObjects     value="1"/>
                  </Preloads>
                 </NPAPI>

                 <HTMLStyles>
                  <TextSelectionEnabled  value="0" />
                  <FontFamily            value="Tahoma" />
                 </HTMLStyles>
                   
                 <SIP>
                  <SoftInputMethodAvailable value="1" />
                 </SIP>
                
                 <GUI>
                  <SignalRefresh  value="5000" />
                  <HourglassEnabled value="1" />
                  <HourglassLeft   value="" />
                  <HourglassTop  value="" />
                 </GUI>
                   
                 <Navigation>
                  <BadLinkURI value="file://%INSTALLDIR%/badlink.html" />
                  <UserAgent  value="Mozilla/5.0 (%p) AppleWebKit/%w (KHTML, like Gecko) MotorolaWebKit/%e Safari/%w" />
                 </Navigation>
                
                </Application>
              </Applications>
              </Configuration>

               

               

               

              Regards,

              NT

               

              Message was edited by: Naveen Thomas Included the RhoElement version in the device