by Simon Yeldon
PGWakeOnLan is a PhoneGap plugin that will send a Wake-on-LAN magic packet to the machine you specify from within your PhoneGap project.
- iPhone PhoneGap 1.0.0 (http://github.com/phonegap/phonegap-iphone)
- RegexKitLite 4.0 (http://regexkit.sourceforge.net/RegexKitLite/index.html)
- Standard android stuffs.
- Place the WakeOnLan.h and WakeOnLan.m to your Plugins folder.
- Place the WakeOnLan.js in your www folder and link it into your project using a <script> tag.
- Download RegexKitLite and add it to your project.
- Add the required librariy libicucore.dylib to your project.
- Open up your PhoneGap.plist file (in Resources) and add the key
wakeonlan
and the valueWakeOnLan
to the end of the plugins declaration.
- Create the folder
src/uk/co/ghosty/phonegap/plugins
and place the WakeOnLan.java within it. - Place the WakeOnLan.js in your www folder and link it into your project using a <script> tag.
- Add the following to your res/xml/plugins.xml
<plugin name="WakeOnLan" value="uk.co.ghosty.phonegap.plugins.WakeOnLan"/>
To use the plugin call the function window.plugins.wol.wake(macAddress, ipAddress, success, fail);
somewhere in your JavaScript
window.plugins.wol.wake("00:00:00:00:00:00", "192.168.1.255", function(success) {
console.log("Success: "+success);
}, function(fail) {
console.log("There was an error: "+fail);
}
);
iOS code inspired heavily by openwol, with code borrowed from Ben Ripley
iOS regex provided by RegexKitLite.
Android code inspired by Jibbler.
Apache Licence, version 2.0
Copyright 2011 Simon Yeldon
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Whilst I have done everything I can to make this code as reliable as possible, it has never been submitted in an app that has gone through the approval process. I cannot guarantee that the code will be approved.