HTCSensors library for HTC Diamond

Discussion in 'Additional Libraries' started by agraham, Oct 28, 2008.

  1. agraham

    agraham Expert Licensed User

    Attached Files:

    Last edited: Sep 16, 2010
  2. Mr_Gee

    Mr_Gee Active Member Licensed User

    you are the man, sorry i didn't get around to posting the spb file with the functions of your previous version, ill do that when i get my pc back
  3. csandman

    csandman Member Licensed User

    G-sensor lib for HTC Touch HD too?

    I can't get it working on my Touch HD? Startup of library seems not to work. Anybody out there with any ideas?

    Merry Christmas and a happy new year
  4. UTISS.DEV01

    UTISS.DEV01 Member Licensed User

    compile error compiling 'HTCSensors library for HTC Diamond' demo source project

    I downloaded the library at but if I try to compile HTCSensorsDemo.sbp the compiler doesn't compile ("Variable main.unknown1 in sub main.getgsensordata is never used. Occurred on line: 49 End Sub"; see attached screenshots).

    May you help me?


  5. agraham

    agraham Expert Licensed User

    It's a Basic4ppc warning aboout an unused variable. Either remove line 39 or untick Tools->Check for unassigned/unused variables.
  6. UTISS.DEV01

    UTISS.DEV01 Member Licensed User

    It's Run!

    Yes, if I uncheck the checkbox demo is compiled!
    THANKS! :)
  7. CryoGenID

    CryoGenID Active Member Licensed User


    This is an awesome dll!
    Thanks a lot for writing it!

    But I have a question:
    Are you planning (which I could use very well *g*) on implementing
    a possibility to change the backlight intensity?
    (Like this program here does: Lumos@XDA-Devs

    Thanks a lot for your help!

    Best regards,

  8. agraham

    agraham Expert Licensed User

    I'm afraid not.
  9. CryoGenID

    CryoGenID Active Member Licensed User


    thanks for your reply!
    What a pity, that would have been perfect...

    But anyway: Thanks a lot for the HTCSensors-Library :sign0060:

    Best regards,

  10. bob_zollo

    bob_zollo New Member Licensed User

    just getting started

    Hi ... Can you tell me what version of Basic4PPC is needed to use the HTCSensors library?

    I have 6.01 and when I tried to load the demo program, I got an error that this file was created under a newer version.

    I'm simply trying to detect if the keyboard is slid-out on an HTC Touch Pro 2. Not trying anything fancy. An old B4PPC program I wrote looks bad when the screen rotates due to keyboard being slid-out, so I figure if I can detect it being open or closed, then I can redraw the screen correctly.

    Any suggestions?

  11. klaus

    klaus Expert Licensed User

    The HTDSensor demo program was written with B4PPC version 6.5.
    You can easily find out with what version a program was written by loading the sbp file into a text editor and on top the version is given.

    Best regards.
  12. Andrew Woodhead

    Andrew Woodhead New Member Licensed User

    HTCSensores library

    Will this library work with an HTC HD2?
  13. agraham

    agraham Expert Licensed User

    I've no idea :(. Try it and let us know if smoke comes out of the back!

    Seriously it won't do any harm if it doesn't work (well not a lot! :))
  14. klaus

    klaus Expert Licensed User

    You should test it.

    On my htc-HD it works.

    Best regards.​
  15. Filippo

    Filippo Expert Licensed User

    Hi agraham,

    can you please add this code in your library(Class HTCGSensor)?

    public void ChangeOrientation(int DisplayOrientation)
        switch (DisplayOrientation) {
            case ScreenOrientation.Portrait:
                SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle0;
            case ScreenOrientation.Landscape:
                SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle90;
            case ScreenOrientation.ReversePortrait:
                SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle180;
            case ScreenOrientation.ReverseLandscape:
                SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle270;
    so it is possible to change the orientation of the screen.

  16. agraham

    agraham Expert Licensed User

    Hi Filippo

    The Display object in ControlsExDevice already has code using SystemSettings to set the screen orientation. I don't want to duplicate functionality in my libraries unless it is really necessary.
  17. Filippo

    Filippo Expert Licensed User

    It was only a suggestion from me.

    So I personally think that's the functional fits right into this library. In this library is tested whether the orientation of the device has changed, and then you can change the orientation of the screen.
    Thus, one can achieve with just a library everything you want.;)
  18. UTISS.DEV05

    UTISS.DEV05 New Member Licensed User

    htcsensor - GetGVector

    is GetGVector included in the HTCSensor library?
    If not how can i create a library from the .cs file?

  19. agraham

    agraham Expert Licensed User

    If by GetGVector you mean a function that returns the actual measurement of G in m/s2 or feet/s2 for x, y and z then then you just need to scale the values of TiltX etc appropriately. As you can see from the help entry for GetRawSensorData 1G is nominally 1000 Tilt units but the measurement is actually very imprecise and the actual value may vary for each axis.
  20. UTISS.DEV05

    UTISS.DEV05 New Member Licensed User

    now it's clear...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice