1. The final effect
Remote boot app download:
Download link: https://wwp.lanzoup.com/iDR330ml4l2b
Extract code: dxcg
Note: Please follow the steps in 2.1 to set up the computer before use"
mac address: fill in your own mac address
Host address: fill in your own public network ip, Baidu search ip
Mapped port: the mapped port configured in the second preparation
2. Preparation
2.1. Enable the wol remote wakeup function of bios
- Common Assembled Motherboards
motherboard brand | start button |
---|---|
Intel motherboard | F12 |
onda motherboard | F11 |
Topstar Motherboard | F11 or F12 |
Foxconn Motherboard | ESC or F12 |
Champions League Main Board | F11 or F12 |
Guanming motherboard | F9 |
ASRock Motherboard | F11 |
asus motherboard | F8 |
Gigabyte Motherboard | F12 |
Jiewei Motherboard | ESC or F8 |
Jetway motherboard | ESC |
Elite Motherboard | ESC or F11 |
Soyo Motherboard | E5C or F12 |
MAXSUN Motherboard | ESC |
For example, the main board | ESC |
Colorful Motherboard | ESC or F11 |
Dual Sensitive Motherboard | ESC |
Spartan Card Motherboard | ESC |
msi motherboard | F11 |
ASL Motherboard | F10 |
Yeston Main Board | F8 |
Playback motherboard | F9 |
Zhiming Motherboard | F12 |
Zhiying Motherboard | ESC |
Common Notebook Brands
notebook brand | start button |
---|---|
eMachines Notebook | F12 |
Gateway Notebook | F12 |
IBM notebook | F12 |
toshiba notebook | F12 |
Founder notebook | F12 |
haier notebook | F12 |
Acer notebook | F12 |
asus notebook | ESC |
patient notebook | F9 |
gigabyte notebook | F12 |
cutle notebook | F12 |
Lenovo Thinkpad | F12 |
lenovo notebook | F12 |
benq notebook | F9 |
apple notebook | Long press the "option" key |
Tsinghua Tongfang Notebook | F12 |
samsung notebook | F12 |
shenzhou notebook | F12 |
Stonetone Notebook | F12 |
suni notebook | ESC |
msi notebook | F11 |
- desktop brand
desktop brand | start button |
---|---|
Founder desktop | F12 |
haier desktop | F12 |
Acer Desktop | F12 |
asus desktop | F8 |
Huisha desktop | F12 |
Cel desktop | ESC |
lenovo desktop | F12 |
benq desktop | F8 |
Tsinghua Tongfang Desktop | F12 |
Shenzhou desktop | F12 |
Note: For other brands, please Baidu or try the above buttons
After entering the BIOS, check whether there are options related to Wake On LAN, remote wake-up, WOL, etc., find and enable them.
If you still don’t know how to set it up, Baidu search for “mainboard model + remote wake-up”
- set up router
The TP Link router settings are as follows, and other router settings are similar, please Baidu by yourself.
- Set IP and MAC Binding
- Set up port mapping
Note that the intranet IP is consistent with the IP of the computer, which is the IP address when the MAC was bound just now, the port can be selected arbitrarily, and the protocol type is ALL or UDP.
- set up computer
Click "This PC->Device Manager->Network Adapter" to enable Wake Magic Packet.
2.2. Download Andlua+ software
Software download link, follow [product manager is not manager] gzh, reply [andlua+] to download.
3. Realize the code
3.1. Open the software and create a new project. The creation steps are as follows:
- Click on the "+" sign
- Select a template, here we choose a blank template.
- Fill in the project name and package name. Fill in the project name as you like, and the package name is similar to com.xx.xx, just fill in whatever you want.
- The generated template code is as follows:
3.2. Write code:
- The main.lua code is as follows:
require "import" import "android.app.*" import "android.os.*" import "android.widget.*" import "android.view.*" import "layout" import "socket" activity.setTheme(R.Theme_Blue) activity.setTitle("remote boot") activity.setContentView(loadlayout(layout)) -- Convert the hexadecimal represented by a set of two strings to a hexadecimal string -- 'ff'(66 66) -> 0xff -> '.'(255) function to(str) ret = '' for i = 1, string.len(str), 2 do byte = ('0x' .. string.sub(str, 0 + i, 1 + i)) a = tonumber(byte) ret = ret .. string.char(a) end return ret end function wakeUp(mac,bip,port) -- to target host MAC address -- router broadcast address -- mapped port mac=string.gsub(mac,":","") head = 'FFFFFFFFFFFF' -- header head = to(head) mac = to(mac) for i = 1, 16 do head = head .. mac end u = socket.udp() u:sendto(head,bip,port) u:close() toast("Magic packet sent successfully") end -- Determine whether it is empty function isEmpty(s) local flag=false if s==nil or s=="" then flag=true end return flag end -- customize toast function toast(msg,activity,duration) local activity=activity or this local msg=msg or "" local duration=duration or Toast.LENGTH_SHORT Toast.makeText(activity, msg,duration).show() end btn.onClick=function() mac=tostring(macAddr.getText()) host1=tostring(host.getText()) port1=tostring(port.getText()) if isEmpty(mac) or isEmpty(host1) or isEmpty(port1) then toast("mac The address, host address, and port cannot be empty") return end wakeUp(mac,host1,port1) end
- The layout.aly code is as follows:
{ LinearLayout; orientation="vertical"; layout_height="wrap_content"; layout_width="match_parent"; backgroundColor="0xffc4d7d6"; { LinearLayout; layout_marginTop="20dp"; layout_width="match_parent"; { TextView; textSize="16sp"; layout_marginLeft="10dp"; layout_width="wrap_content"; layout_height="wrap_content"; textColor="0xff000000"; text="mac address:"; }; { EditText; text="04:7C:16:01:21:85"; layout_width="match_parent"; id="macAddr"; layout_marginRight="10dp"; }; }; { LinearLayout; layout_width="match_parent"; layout_height="wrap_content"; { TextView; textSize="16sp"; textColor="0xff000000"; layout_marginLeft="10dp"; text="Host address:"; }; { EditText; text="123.145.8.199"; layout_width="match_parent"; id="host"; layout_marginRight="10dp"; }; }; { LinearLayout; layout_width="match_parent"; { TextView; textSize="16sp"; textColor="0xff000000"; layout_marginLeft="10dp"; text="Mapped port:"; }; { EditText; layout_marginRight="10dp"; layout_width="match_parent"; id="port"; text="9"; }; }; { Button; layout_marginLeft="15dp"; id="btn"; text="One key boot"; layout_marginTop="20dp"; backgroundColor="0xff10aec2"; textColor="0xffffffff"; layout_height="wrap_content"; layout_width="match_parent"; layout_marginRight="15dp"; }; };
- init.lua uses template code, no changes.
- After the modification is complete, click the triangle symbol to preview
3.2. Package app:
- Click Properties to set project properties.
Uncheck the debug mode, and we only need to have full network access permissions for the permissions required by the app. After the settings are complete, click the tick in the upper right corner to save.
- Click Package, after the package is complete, it will prompt to install, just click Install.
3. Summary
The andlua+ software provides a wealth of functions, allowing us to program and quickly generate our own applications on the mobile phone. More complex applications need to be explored by ourselves.
This article was released simultaneously by [product manager is not a manager] gzh, welcome to pay attention