getting resource information: battery level and more

Discussion in 'C++' started by Maria, Feb 1, 2004.

  1. Maria

    Maria Guest

    Hi all ! :)

    I am trying to find a way to return the battery level of a notebook or
    laptop or any mobile device (but to make it simple a laptop would be
    fine).
    I am trying to do this because I'm building for a project a small part
    of an interface for a computational grid that would accommodate in
    adition to the usual devices, wireless ones too.
    ( So I'm trying to measure what a device will be able to offer to the
    Grid ... the next step will be to measure what applications are
    running on a device and so on. )
    I am doing this with Java on two computers, a desktop PC with Windows
    2000 and a laptop with Windows XP.
    Although I have not entirely given up on Java yet, there is no command
    to get me what I want so the only way to do it would be through Java
    Native Interface. That is I will have to do it in C or C++.
    I would be most grateful if you could suggest anyway at all to get the
    battery level in Java, C or C++ or maybe using any J2ME or JINI
    libraries.

    Thanks !
    Maria
     
    Maria, Feb 1, 2004
    #1
    1. Advertising

  2. "Maria" <> wrote in message
    news:...
    > Hi all ! :)



    > I am trying to find a way to return the battery level of a notebook

    or
    > laptop or any mobile device (but to make it simple a laptop would be
    > fine).


    Just include the standard header <battery>.

    Seriously, this issue is not addressed in standard C++, so ask
    elsewhere.

    Regards,
    Jonathan
     
    Jonathan Turkanis, Feb 2, 2004
    #2
    1. Advertising

  3. Maria wrote:
    > Although I have not entirely given up on Java yet, there is no command
    > to get me what I want so the only way to do it would be through Java
    > Native Interface. That is I will have to do it in C or C++.
    > I would be most grateful if you could suggest anyway at all to get the
    > battery level in Java, C or C++ or maybe using any J2ME or JINI
    > libraries.
    >
    > Thanks !
    > Maria

    OT, you should ask in a OS-related newsgroup (btw, are u using Win or
    Linux?)

    --
    #include <stdio.h>
    #define p(s) printf(#s" endian")
    int main(void){int v=1;0[(char*)&v]?p(Little):p(Big);return 0;}

    Giannis Papadopoulos
    http://dop.users.uth.gr/
    University of Thessaly
    Computer & Communications Engineering dept.
     
    Papadopoulos Giannis, Feb 2, 2004
    #3
  4. Maria

    Maria Guest

    Seriously I didn't know !
    Also I didn't understand what you mean by standard header <battery>
    .... would that be the title of the message ?
    I guess I did find out something by asking here though , so thank you

    Maria



    "Jonathan Turkanis" <> wrote in message news:<bvk3f8$tdhf8$-berlin.de>...
    > "Maria" <> wrote in message
    > news:...
    > > Hi all ! :)

    >
    >
    > > I am trying to find a way to return the battery level of a notebook

    > or
    > > laptop or any mobile device (but to make it simple a laptop would be
    > > fine).

    >
    > Just include the standard header <battery>.
    >
    > Seriously, this issue is not addressed in standard C++, so ask
    > elsewhere.
    >
    > Regards,
    > Jonathan
     
    Maria, Feb 2, 2004
    #4
  5. Maria

    Phlip Guest

    Maria wrote:

    > Seriously I didn't know !
    > Also I didn't understand what you mean by standard header <battery>


    That is a thin attempt at humor:

    #include <battery>

    There is no such header.

    You get the abuse because this newsgroup works best on platform-neutral C++
    issues. Technical newsgroups should always focus closely on one topic, for
    best results. Use http://groups.google.com to search for the best newsgroup
    for your question - but you run the risk of finding the answer there too!

    Whatever answer they give will be compatible with C++ - somehow...

    --
    Phlip
    http://www.xpsd.org/cgi-bin/wiki?TestFirstUserInterfaces
     
    Phlip, Feb 2, 2004
    #5
  6. Maria

    Maria Guest

    Thank you very very much for your reply!
    I will post my message to a Windows related newsgroup. I have looked
    at those newsgroups and they mostly have posts about operating system
    problems instead of programming issues and this is what led me to post
    here since I am looking for the c command.

    > btw, are u using Win or
    > Linux?
    >

    I am using a computer with Windows 2000 and one with XP , everything
    I've done so far works perfectly well on both of them.
    Also I do know the command that will do it for linux and it is
    something like "cat /proc/apm" but the trick is to make it multi
    platform :).
    What I am planning is to check the environment variable for os name
    and then act accordingly. So now it is down to the windows bit I am
    afraid.

    Thanks a lot for all your help anyway :) ,
    Maria
     
    Maria, Feb 2, 2004
    #6
  7. Thank you for your reply too :)
    I have tried and searched a lot and have not found the answer... I am not
    simply looking for a C or C++ command but for the whole program because I
    am programming in Java and not in C.
    The above is something that unfortunately I have not yet found not even in
    Google.
    Also I though there would be no harm in asking.

    Thanks again,
    Maria

    "Phlip" <> wrote in message
    news:QDwTb.16865$...
    > Maria wrote:
    >
    > > Seriously I didn't know !
    > > Also I didn't understand what you mean by standard header <battery>

    >
    > That is a thin attempt at humor:
    >
    > #include <battery>
    >
    > There is no such header.
    >
    > You get the abuse because this newsgroup works best on platform-neutral

    C++
    > issues. Technical newsgroups should always focus closely on one topic, for
    > best results. Use http://groups.google.com to search for the best

    newsgroup
    > for your question - but you run the risk of finding the answer there too!
    >
    > Whatever answer they give will be compatible with C++ - somehow...
    >
    > --
    > Phlip
    > http://www.xpsd.org/cgi-bin/wiki?TestFirstUserInterfaces
    >
    >
     
    Maria Gaitani, Feb 2, 2004
    #7
  8. Maria wrote:

    > Thank you very very much for your reply!
    > I will post my message to a Windows related newsgroup. I have looked
    > at those newsgroups and they mostly have posts about operating system
    > problems instead of programming issues and this is what led me to post
    > here since I am looking for the c command.
    >
    >
    >>btw, are u using Win or
    >>Linux?
    >>

    >
    > I am using a computer with Windows 2000 and one with XP , everything
    > I've done so far works perfectly well on both of them.
    > Also I do know the command that will do it for linux and it is
    > something like "cat /proc/apm" but the trick is to make it multi
    > platform :).
    > What I am planning is to check the environment variable for os name
    > and then act accordingly. So now it is down to the windows bit I am
    > afraid.
    >
    > Thanks a lot for all your help anyway :) ,
    > Maria


    I got a lot of articles by using Google and the terms
    "Windows" "API" "Battery".


    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
     
    Thomas Matthews, Feb 2, 2004
    #8
  9. "Phlip" <> wrote in message
    news:QDwTb.16865$...
    > Maria wrote:
    >
    > > Seriously I didn't know !
    > > Also I didn't understand what you mean by standard header

    <battery>
    >
    > That is a thin attempt at humor:
    >
    > #include <battery>
    >
    > There is no such header.


    There's no accounting for taste. ;-)

    Jonathan
     
    Jonathan Turkanis, Feb 2, 2004
    #9
  10. Thank you but I am not looking for a command that I can get from windows
    API, I have that already ... I am looking for a method or procedure ... I
    don't
    know c .. I am only using Java... it's just the only solution I can thing of
    right now.
    Thank you for taking the time to reply really ...but please don't suggest
    that I don't know how to search google.
    Besides I don't think there is no harm in asking ... although I do admit I
    should have added an "off topic" term in my subject, which I did not think
    of .. before sending the post.
    Sorry..
    Maria
    "Thomas Matthews" <> wrote in
    message news:K7zTb.2896$...
    > Maria wrote:
    >
    > > Thank you very very much for your reply!
    > > I will post my message to a Windows related newsgroup. I have looked
    > > at those newsgroups and they mostly have posts about operating system
    > > problems instead of programming issues and this is what led me to post
    > > here since I am looking for the c command.
    > >
    > >
    > >>btw, are u using Win or
    > >>Linux?
    > >>

    > >
    > > I am using a computer with Windows 2000 and one with XP , everything
    > > I've done so far works perfectly well on both of them.
    > > Also I do know the command that will do it for linux and it is
    > > something like "cat /proc/apm" but the trick is to make it multi
    > > platform :).
    > > What I am planning is to check the environment variable for os name
    > > and then act accordingly. So now it is down to the windows bit I am
    > > afraid.
    > >
    > > Thanks a lot for all your help anyway :) ,
    > > Maria

    >
    > I got a lot of articles by using Google and the terms
    > "Windows" "API" "Battery".
    >
    >
    > --
    > Thomas Matthews
    >
    > C++ newsgroup welcome message:
    > http://www.slack.net/~shiva/welcome.txt
    > C++ Faq: http://www.parashift.com/c -faq-lite
    > C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    > alt.comp.lang.learn.c-c++ faq:
    > http://www.raos.demon.uk/acllc-c /faq.html
    > Other sites:
    > http://www.josuttis.com -- C++ STL Library book
    >
     
    Maria Gaitani, Feb 2, 2004
    #10
  11. On Mon, 2 Feb 2004 23:06:31 -0000, in comp.lang.c , "Maria Gaitani"
    <> wrote:

    >Thank you but I am not looking for a command that I can get from windows
    >API, I have that already ... I am looking for a method or procedure ... I
    >don't know c ..


    C doesn't have methods or procedures, it only has functions. But more
    importantly, when it comes to system-specific stuff like you want, you
    have to use the native APIs, in your case windows or linux. So you
    already have your answer.

    >Besides I don't think there is no harm in asking ... although I do admit I
    >should have added an "off topic" term in my subject, which I did not think
    >of .. before sending the post.


    For your information, asking offtopic questions in Comp.lang.c and
    comp.lang.c++ will get you a polite redirection (like you got) to
    either google or a platform-specific group. If you continue to ask
    offtopic questions, you will get much less polite answers. Adding
    "offtopic" to the subject will not help.....

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    Mark McIntyre, Feb 4, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maria
    Replies:
    8
    Views:
    458
    Maria Gaitani
    Feb 4, 2004
  2. pabbu
    Replies:
    8
    Views:
    772
    Marc Boyer
    Nov 7, 2005
  3. Scorpiion
    Replies:
    1
    Views:
    1,404
    Scorpiion
    Dec 25, 2008
  4. gaza
    Replies:
    0
    Views:
    681
  5. Mark Somerville

    Threads, do_nanosleep and battery life

    Mark Somerville, Mar 13, 2008, in forum: Ruby
    Replies:
    3
    Views:
    103
    Roger Pack
    Sep 24, 2008
Loading...

Share This Page