Git Product home page Git Product logo

pgwakeonlanplugin's Introduction

PGWakeOnLanPlugin

by Simon Yeldon

About

PGWakeOnLan is a PhoneGap plugin that will send a Wake-on-LAN magic packet to the machine you specify from within your PhoneGap project.

Dependancies

iOS

Android

  • Standard android stuffs.

Adding the plugin to your project

iOS

  1. Place the WakeOnLan.h and WakeOnLan.m to your Plugins folder.
  2. Place the WakeOnLan.js in your www folder and link it into your project using a <script> tag.
  3. Download RegexKitLite and add it to your project.
  4. Add the required librariy libicucore.dylib to your project.
  5. Open up your PhoneGap.plist file (in Resources) and add the key wakeonlan and the value WakeOnLan to the end of the plugins declaration.

Android

  1. Create the folder src/uk/co/ghosty/phonegap/plugins and place the WakeOnLan.java within it.
  2. Place the WakeOnLan.js in your www folder and link it into your project using a <script> tag.
  3. Add the following to your res/xml/plugins.xml <plugin name="WakeOnLan" value="uk.co.ghosty.phonegap.plugins.WakeOnLan"/>

Using the plugin

To use the plugin call the function window.plugins.wol.wake(macAddress, ipAddress, success, fail); somewhere in your JavaScript

Example

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);
    }
);

Acknowledgements

iOS code inspired heavily by openwol, with code borrowed from Ben Ripley

iOS regex provided by RegexKitLite.

Android code inspired by Jibbler.

Licence

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.

Disclaimer

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.