Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: SBDJ Battery Status - Page: 1

This part of topic is old and might contain outdated or incorrect information

SBDJPRO Infinity Member since 2006
Afternoon all,

New plugin uploaded today that provides yet another simple function - a battery monitor.

http://www.virtualdj.com/addons/13066/SBDJ_Battery_Status.html

Installation: Copy the DLL file to the Documents\VirtualDJ\Plugins\Other folder.

The plugin runs automatically when VirtualDJ starts, and displays the current battery information in it's window. Since this isn't easily accessible the real bonus is for skin authors. It sets a couple of VDJScript variables which you can then use in your skins:

$battery_ac (0=unplugged, 1=plugged in, 255=unknown)
$battery_percent (Battery power in percent)
$battery_secs (Total battery time remaining in seconds, -1 if time is unknown)

Added in v1.01

$battery_active (0=plugin not active/not installed, 1=plugin active and monitoring battery)

Obviously you could use these with var_equal, var_smaller, var_greater and so on.

Skin Examples:

Battery Percent Display:
<textzone>
<pos x="0" y="0"/>
<size width="100" height="18"/>
<text font="Tahoma" size="10" align="center" weight="bold" color="#d1d3d4" format="`get var $battery_percent`%"/>
</textzone>


Battery Indicator:
<button action="var $battery_active ? var_equal $battery_ac 1 ? off : var_smaller $battery_percent 50 ? blink : on">
<tooltip>SBDJ Battery Status Plugin</tooltip>
<size width="10" height="20"/>
<pos x="10" y="0"/>
<selected x="+0" y="+1000"/>
</button>


Battery Indicator Bar Meter
<button action="var_greater $battery_percent 90 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="1"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 80 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="2"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 70 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="3"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 60 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="4"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 50 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="5"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 40 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="6"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 30 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="7"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 20 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="8"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 10 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="9"/>
<selected x="+0" y="+1000"/>
</button>
<button action="var_greater $battery_percent 0 ? on : off">
<size width="10" height="1"/>
<pos x="10" y="10"/>
<selected x="+0" y="+1000"/>
</button>


AC Adapter Status Text Display:
<textzone>
<pos x="0" y="0"/>
<size width="100" height="18"/>
<text font="Tahoma" size="10" align="center" weight="bold" color="#d1d3d4" format="`var_equal $battery_ac 1 ? get text 'Connected' : get text 'Unplugged'`"/>
</textzone>


Thanks to Supacon for some of the skin examples.

Thoughts and feedback welcome.
 

Posted Sat 30 Oct 10 @ 8:46 am
djdadPRO InfinityDevelopment ManagerMember since 2005
Damn Good News !!!!!!

I will try to implement this on my skins later tonight and let you know ....

 

Posted Sat 30 Oct 10 @ 9:16 am
DHoudePRO InfinityMember since 2009
you truly push VDJ to a whole new level, thanks for all the hard work man.
 

Posted Sat 30 Oct 10 @ 10:51 am
SupaconPRO InfinityMember since 2005
Interesting - I didn't realize it was possible to use plugins in this manner in VDJ.

Is it possible to set up a skin so that it installs this plugin along with the skin? Otherwise, how would a person installing a skin that uses this know that they need to use this for the full functionality?

Perhaps a popup at installation for those who don't have the required dependencies installed?
 

Posted Sat 30 Oct 10 @ 11:28 am
SBDJPRO Infinity Member since 2006
Skins are auto packaged when uploaded aren't they? I guess you'd just have to make a note in the skin notes and on the skin info thread in the skins forum. I believe this is what Dan has done with his skin that requires my notepad plugin. We could also make a sticky in the skins forum to inform people that certain plugins provide certain skin functions for reference.

I was thinking of passing a display message to controllers with displays like the HC4500 to display a warning when AC is disconnected and for low battery conditions etc...

If you have any other ideas for random plugins like this to get data passed to a skin then let me know :)
 

Posted Sat 30 Oct 10 @ 11:48 am
Supacon wrote :
Perhaps a popup at installation for those who don't have the required dependencies installed?


On my skins if you just hold the mouse over the button that the plugin is made for it will say " SBDJ Battery Status Required - Download from VDJ Website" granted its not during installation but its something. There called "Tool Tips".

Although this wont go away even if you have installed the plugin.

Huey

Another top notch plugin Scott, Thank You!!
 

Posted Sat 30 Oct 10 @ 11:58 am
SupaconPRO InfinityMember since 2005
For anyone wanting to use this, I have created a template with the requisite code (it took me a while to figure it out, so hopefully this will save others some head scratching)

This will turn the button ON when the power is unplugged, and make it blink when the battery falls below 50%.

This is exactly how I envisioned such an indicator to work - of course you can tweak it if you prefer a different percentage, or if you'd rather have it be on when plugged in, for instance.


--Battery Indicator
<button action="var $battery_active ? var_equal $battery_ac 1 ? off : var_smaller $battery_percent 50 ? blink : on">
<tooltip>SBDJ Battery Status Plugin</tooltip>
<size width="10" height="20"/>
<pos x="10" y="0"/>
<selected x="+0" y="+1000"/>
</button>


Edit:
This has been updated to support v1.01 of SBDJ Battery Status so that now it will show as off when the requisite plugin is not installed. If you want it to blink when not installed, just remove the "var $battery_active" part of the vdjscript.

Much thanks to Scott for this handy plugin!
 

Posted Sat 30 Oct 10 @ 12:56 pm
Nice work Scott!!

And Supacon for skin implementation!! :-)
 

Posted Sat 30 Oct 10 @ 1:08 pm
SBDJPRO Infinity Member since 2006
I've got an idea to prevent your problem Supacon, give me 2 minutes ;)
 

Posted Sat 30 Oct 10 @ 1:16 pm
SBDJPRO Infinity Member since 2006
v1.0.1 uploaded. Changes:

* Catch error condition if winapi call fails
* New variable: $battery_active (set to 1 when plugin is active and 0 when plugin is inactive or not installed)

OK, so it was 3 minutes. It means you could just turn the indicator off now, blink at a different rate, use panels and so on.
 

Posted Sat 30 Oct 10 @ 1:19 pm
SupaconPRO InfinityMember since 2005
Thanks Scott, I've tested this and it works great. My code is updated in the message above for those who want to copy-and-paste it.
 

Posted Sat 30 Oct 10 @ 1:31 pm
SBDJPRO Infinity Member since 2006
If anyone else wants to post up some different samples too then feel free; you can do a few different things with the available variables.
 

Posted Sat 30 Oct 10 @ 1:35 pm
SupaconPRO InfinityMember since 2005
I just thought of an addon to my previous code. If someone didn't want to see the battery status for some reason, you could just toggle it off with a click (in v1.0.1 only)

rightclick="toggle $battery_active"
 

Posted Sat 30 Oct 10 @ 1:36 pm
SBDJPRO Infinity Member since 2006
Yup - the plugin only sets this when it is started by VDJ so unsetting it means the plugin won't reset it until the next load.
 

Posted Sat 30 Oct 10 @ 1:38 pm
SBDJPRO Infinity Member since 2006
Just a thought - I could probably add some temperature monitoring to this plugin - or probably to another plugin to keep the two seperate for people who don't need/want both (or if it causes issues with some peoples systems!)...
 

Posted Sat 30 Oct 10 @ 1:43 pm
SupaconPRO InfinityMember since 2005
Cool idea (pun not intended :P )- personally I don't think that's too interesting to most people, though unless you work in a really hot locale or are crazy enough to overclock a gigging computer.

But if you're going to go there, I'm guessing it's a similar kind of job to query fan speed, hard drive SMART status etc?
 

Posted Sat 30 Oct 10 @ 2:25 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
can we use this as a textzone ?
$battery_percent
 

Posted Sat 30 Oct 10 @ 6:25 pm
JoeyKJPRO InfinityMember since 2008
Nice job guys...
 

Posted Sat 30 Oct 10 @ 8:17 pm
SBDJPRO Infinity Member since 2006
djdad wrote :
can we use this as a textzone ?
$battery_percent


I don't know if you can display the contents of variables in a textzone I'm afraid. Dan might know, I'm not an experienced skinner ;)
 

Posted Sat 30 Oct 10 @ 8:27 pm
SupaconPRO InfinityMember since 2005
I have a feeling that this would require work in VirtualDJ's core, but it would be great if you could programmatically manipulate and display strings in this way.
 

Posted Sat 30 Oct 10 @ 8:29 pm
33%