473,651 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 22 '05 #1
10 2844
"Maria" <m.*******@warw ick.ac.uk> wrote in message
news:e7******** *************** ***@posting.goo gle.com...
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
Jul 22 '05 #2
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(Bi g);return 0;}

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Jul 22 '05 #3
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" <te******@kanga roologic.com> wrote in message news:<bv******* *****@ID-216073.news.uni-berlin.de>...
"Maria" <m.*******@warw ick.ac.uk> wrote in message
news:e7******** *************** ***@posting.goo gle.com...
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

Jul 22 '05 #4
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?Tes...UserInterfaces
Jul 22 '05 #5
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 22 '05 #6
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" <ph*******@yaho o.com> wrote in message
news:QD******** ***********@new ssvr16.news.pro digy.com...
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?Tes...UserInterfaces

Jul 22 '05 #7
"Phlip" <ph*******@yaho o.com> wrote in message
news:QD******** ***********@new ssvr16.news.pro digy.com...
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
Jul 22 '05 #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.l earn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #9
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******** *********@newss vr31.news.prodi gy.com...
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.l earn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #10

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

Similar topics

5
5659
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 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...
303
17589
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. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
12
2044
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 Embedded Resource... Now where should look next... Any help...
9
3252
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 Tools to do a memory dump of the app when the lock up occurs, however the stack information is not very useful. I have just put a new build of our system onto production, and this build is a "Debug" build as opposed to a "Release" build. I am...
2
1530
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
2763
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 : myEvent -= MyMethodToFire; That's all fine, but when you use visual studio to create events for objects it never creates an unsubscribing reference, so is it puting in resource leaks? Or is this being cleared somewhere that i am not seeing?
23
2146
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 switched off my laptop with the battery fully charged. I haven't touched it since then. This morning I turned it on, and the battery was practically empty.
1
911
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 only in Windows Form; it wont run with smart device form. Thanks -- Nejadian
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.