472,355 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,355 software developers and data experts.

getting resource information: battery level and more

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
Jul 17 '05 #1
5 5580
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.
Jul 17 '05 #2
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
Jul 17 '05 #3
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

Jul 17 '05 #4
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" <Th****************************@sbcglobal.net> wrote in
message news:K7*****************@newssvr31.news.prodigy.co m...
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

Jul 17 '05 #5
On Mon, 2 Feb 2004 23:06:31 -0000, in comp.lang.c , "Maria Gaitani"
<M.*******@warwick.ac.uk> 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 =---
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
10
by: Maria | last post by:
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...
12
by: bj7lewis | last post by:
I am working on a project I want to add a few files as resource to access(copy them to FS and use) at runtime. So far in VS.NET IDE, I Add Files to the project and set its Build Action to...
9
by: Microsoft News Server | last post by:
Hi, I am currently having a problem with random, intermittent lock ups in my ASP.net application on our production server (99% CPU usage by 3 threads, indefinately). I currently use IIS Debug...
2
by: Miri | last post by:
Hi I have 3200 series laptop battery light is on but battery wont charge...anyone with any suggestion, it has no charge at all thanks
5
by: Daniel | last post by:
Hey guys When you hook an event (c# 2.0 syntax): myEvent += MyMethodToFire; You need to also unsubscribe it to avoid a resource leak so that the object it is in gets garbage collected like so...
23
by: kid joe | last post by:
Hi all, Sorry this is a bit off-topic... but I do write a good amount of C code on my laptop so there is a link... Basically, it's a question about laptop batteries. About ten days ago, I...
1
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
Could someone please let me know the C# codes to check the battery status of Windows mobile 5.0. The application should check the PC device battery level. I can use BatteryStatus however it runs...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.