|
|
|
@ -31,26 +31,22 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
{ |
|
|
|
|
public class MainModel : CPF.CpfObject |
|
|
|
|
{ |
|
|
|
|
private static List<IWebSocketConnection> allSockets; |
|
|
|
|
//初始化网络连接 |
|
|
|
|
public static void DeviceControllerInit() |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
allSockets = new List<IWebSocketConnection>(); |
|
|
|
|
var server = new WebSocketServer("ws://0.0.0.0:19983"); |
|
|
|
|
server.Start(socket => |
|
|
|
|
{ |
|
|
|
|
Parame.socket = socket; |
|
|
|
|
socket.OnOpen = () => |
|
|
|
|
{ |
|
|
|
|
allSockets.Add(socket); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; |
|
|
|
|
socket.Send(result); |
|
|
|
|
}; |
|
|
|
|
socket.OnClose = () => |
|
|
|
|
{ |
|
|
|
|
allSockets.Remove(socket); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接关闭\"}"; |
|
|
|
|
socket.Send(result); |
|
|
|
|
}; |
|
|
|
@ -158,6 +154,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
case "aks100115": |
|
|
|
|
result = playVideo(content); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
//刻录文件:{ "code":"aks100116","name":"测试文件","obj":"http://127.0.0.1/test.doc","ext":"doc"}, obj:可以是url地址或者base64 |
|
|
|
|
case "aks100116": |
|
|
|
|
result = BurnFile(content); |
|
|
|
@ -1180,7 +1177,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//// Log.Info("根据文件base64打印: " + path + ""); |
|
|
|
|
string command = $"lp -d {PrinterName} {path}"; |
|
|
|
|
string command = $"dd if={path} of=/dev/chrom bs=4M status=progress"; |
|
|
|
|
ShllCommad(command); |
|
|
|
|
|
|
|
|
|
//弹出光驱 eject /dev/cdrom |
|
|
|
|