InitialCommit

This commit is contained in:
2022-08-01 15:48:08 +03:00
commit 4870bf7883
10 changed files with 14168 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
document.getElementById("ON").onclick=api.func;
+18
View File
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>WizBulbs</title>
<link rel="stylesheet" type="text/css" href="style.css" >
<script src='./button.js'></script>
</head>
<body>
<div class="container">
<div class="button" id="ON" onclick="api.func({'state': true})">ON</div>
<div class="button" id="OFF" onclick="api.func({'state':false})">OFF</div>
<div class="button" id="B10" onclick="api.func({'dimming':10})">10%</div>
<div class="button" id="B50" onclick="api.func({'dimming':50})">50%</div>
<div class="button" id="B100" onclick="api.func({'dimming':100})">100%</div>
</div>
</body>
</html>
+28
View File
@@ -0,0 +1,28 @@
const dgram = require("node:dgram");
const find = require("local-devices");
const MAC_adress="a8:bb:50:4c:e6:1a";
const port=38899;
const message={"method": "setPilot","params": {}}
const getmsg={"method":"getPilot","params":{}}
let address="";
const sendData = (params)=>{
find().then(devices=>{
devices.forEach(device => {
if(device.mac===MAC_adress){
address=device.ip;
}
});
message.params=params
}).then(()=>{
server.send(JSON.stringify(message),port,address);
})
const server=new dgram.createSocket("udp4");
server.on("message",(msg,rinfo)=>{
console.log(msg.toString()+" "+rinfo.toString());
});
};
module.exports={sendData}
+5
View File
@@ -0,0 +1,5 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld("api",{
func: (params)=>ipcRenderer.send("call",params)
})
+70
View File
@@ -0,0 +1,70 @@
.button {
padding: 15px 25px;
border: unset;
border-radius: 15px;
color: #212121;
z-index: 1;
background: #e8e8e8;
position: relative;
font-weight: 1000;
font-size: 17px;
-webkit-box-shadow: 4px 8px 19px -3px rgba(0,0,0,0.27);
box-shadow: 4px 8px 19px -3px rgba(0,0,0,0.27);
transition: all 250ms;
overflow: hidden;
text-align: center;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.button::before {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
border-radius: 15px;
background-color: #212121;
z-index: -1;
-webkit-box-shadow: 4px 8px 19px -3px rgba(0,0,0,0.27);
box-shadow: 4px 8px 19px -3px rgba(0,0,0,0.27);
transition: all 250ms
}
.button:hover {
color: #e8e8e8;
}
.button:hover::before {
width: 100%;
}
.container{
max-width: 330px;
max-height: 600px;
display: grid;
grid-template-columns: auto auto;
grid-template-rows: auto auto auto auto;
gap: 20px 20px;
}
#ON{
grid-column: 1;
grid-row: 1;
}
#OFF{
grid-column: 2;
grid-row: 1;
}
#B10{
grid-column: 1;
grid-row: 2;
}
#B50{
grid-column: 2;
grid-row: 2;
}
#B100{
grid-column: 1;
grid-row: 3;
}