Explorar el Código

更新上传

tags/old_version_1
fyf hace 1 año
padre
commit
3c67a54dee
Se han modificado 17 ficheros con 216 adiciones y 10 borrados
  1. +20
    -0
      app/release/output-metadata.json
  2. BIN
     
  3. +4
    -0
      app/src/main/AndroidManifest.xml
  4. +2
    -0
      app/src/main/java/com/bonait/bnframework/MainApplication.java
  5. +2
    -3
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  6. +5
    -3
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  7. +2
    -2
      app/src/main/java/com/bonait/bnframework/common/iot/AliyunIOTManager.java
  8. +7
    -1
      app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpServer.java
  9. +1
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/ResGoodProcess.java
  10. +82
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/NetworkUtils.java
  11. +50
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/WifiInterceptor.java
  12. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java
  13. BIN
     
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. +40
    -0
      code/工序.txt

+ 20
- 0
app/release/output-metadata.json Ver fichero

@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.bonait.bnframework",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}


+ 4
- 0
app/src/main/AndroidManifest.xml Ver fichero

@@ -15,6 +15,10 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />


<uses-sdk tools:overrideLibrary="com.aliyun.iot.breeze.biz,com.aliyun.iot.breeze.ota,
com.aliyun.iot.breeze.sdk,com.aliyun.iot.ble,com.aliyun.alink.linksdk.tmp"/>



+ 2
- 0
app/src/main/java/com/bonait/bnframework/MainApplication.java Ver fichero

@@ -32,6 +32,7 @@ import com.bonait.bnframework.common.helper.CrashHandler;
import com.bonait.bnframework.common.helper.I.IMessageLogNotify;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.SdCart;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.common.constant.Constants;
@@ -76,6 +77,7 @@ public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
NetworkUtils.exec3("ip rule add from all lookup main pref 9999");
context = getApplicationContext();
ConfigName.getInstance().dishesCon = this;
ConfigName.getInstance().app = this;


+ 2
- 3
app/src/main/java/com/bonait/bnframework/business/ConfigData.java Ver fichero

@@ -292,7 +292,6 @@ public class ConfigData {
*/
public void GetOrganize(Context context) {
if (NetworkUtils.checkNetworkAvailable(context)) {

//获取店铺信息
OkGo.<ResAPI<OrganizeMode>>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey).tag(context).execute(new JsonDialogCallback<ResAPI<OrganizeMode>>(context) {
@Override
@@ -316,8 +315,8 @@ public class ConfigData {
}
}
});
} else {
ToastUtils.warning("无网络,请先连接网络!!!");
}
}



+ 5
- 3
app/src/main/java/com/bonait/bnframework/business/MainInit.java Ver fichero

@@ -25,7 +25,9 @@ import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.SdCart;
import com.bonait.bnframework.common.notification.MainNotification;
import com.bonait.bnframework.common.utils.AppUtils;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.common.utils.WifiInterceptor;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheEntity;
@@ -94,7 +96,8 @@ public class MainInit {
DataBus.getInstance().GetLc();//获取料仓数据
ConfigData.getInstance().LoadingCloud();//加载云端数据


//设置连接到有线网络
// NetworkUtils.connetEnternet(app);
}

//========================================================================//
@@ -257,7 +260,7 @@ public class MainInit {
loggingInterceptor.setColorLevel(Level.INFO);
//添加OkGo默认debug日志
builder.addInterceptor(loggingInterceptor);
//builder.addInterceptor(new WifiInterceptor(app));
//-------------------------配置超时时间,默认60000ms,60s------------------------------//
//OkGo.DEFAULT_MILLISECONDS
//全局的连接超时时间
@@ -266,7 +269,6 @@ public class MainInit {
builder.readTimeout(Constants.CONNECT_TIME_OUT, TimeUnit.MILLISECONDS);
//全局的写入超时时间
builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);

OkGo.getInstance().init(app) //必须调用初始化
.setOkHttpClient(builder.build()) //建议设置OkHttpClient,不设置将使用默认的
.setCacheMode(CacheMode.NO_CACHE) //全局统一缓存模式,默认不使用缓存,可以不传


+ 2
- 2
app/src/main/java/com/bonait/bnframework/common/iot/AliyunIOTManager.java Ver fichero

@@ -282,7 +282,7 @@ public class AliyunIOTManager {
List<Service> services= LinkKit.getInstance().getDeviceThing().getServices();
for (Service item:services)
{
LinkKit.getInstance().getDeviceThing().thingServiceRegister(item.getName(),itResRequestHandler);
LinkKit.getInstance().getDeviceThing().setServiceHandler(item.getIdentifier(),itResRequestHandler);
}
}

@@ -445,7 +445,7 @@ public class AliyunIOTManager {
AppLog.d(TAG, "初始化IOT成功: data = [" + data + "]");
isInitDone = true;

MonitorService();
}
});
}


+ 7
- 1
app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpServer.java Ver fichero

@@ -8,6 +8,7 @@ import com.bonait.bnframework.common.helper.DataFormat;
import com.bonait.bnframework.common.helper.I.IReadCallBack;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.licheedev.modbus4android.ModbusCallback;
import com.licheedev.modbus4android.ModbusParam;
import com.licheedev.modbus4android.ModbusRespException;
@@ -153,9 +154,11 @@ public class ModbusTcpServer {

if(returnMsg.indexOf("100% packet loss")!=-1){
System.out.println("与 " +address +" 连接不畅通.");
ToastUtils.info("与 " +address +" 连接不畅通.");

return false;
} else{
ToastUtils.info("与 " +address +" 连接畅通.");
System.out.println("与 " +address +" 连接畅通.");
return true;
}
@@ -206,6 +209,8 @@ public class ModbusTcpServer {
ModbusTcpHelper.get().init(param, new ModbusCallback<ModbusMaster>() {
@Override
public void onSuccess(ModbusMaster modbusMaster) {
ToastUtils.info("设备 " + ConfigName.getInstance().Address + " 连接成功");

MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " 连接成功");
ConfigName.getInstance().PlcIsConnect = true;
ConfigData.getInstance().PLC_Init();
@@ -214,6 +219,7 @@ public class ModbusTcpServer {
@Override
public void onFailure(Throwable tr) {
ConfigName.getInstance().PlcIsConnect = false;
ToastUtils.info("设备 " + ConfigName.getInstance().Address + " 连接失败:" + tr.getMessage());
MessageLog.ShowError("设备 " + ConfigName.getInstance().Address + " 连接失败:" + tr.getMessage());
}
@Override


+ 1
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/ResGoodProcess.java Ver fichero

@@ -11,4 +11,5 @@ public class ResGoodProcess {
* 商品配方
*/
public List<BomTechnologyActionInfo> bomTechnologyActionInfo;

}

+ 82
- 0
app/src/main/java/com/bonait/bnframework/common/utils/NetworkUtils.java Ver fichero

@@ -2,9 +2,14 @@ package com.bonait.bnframework.common.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.os.Build;
import android.util.Log;

import java.io.DataOutputStream;

/**
* Created by LY on 2019/1/4.
@@ -127,4 +132,81 @@ public class NetworkUtils {
}
return false;
}

/**
* 绑定有线网络
* @param context
*/
public static void connetEnternet(Context context)
{
ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addTransportType(NetworkCapabilities.TRANSPORT_ETHERNET);
//builder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
NetworkRequest networkRequest = builder.build();
connManager.requestNetwork(networkRequest, new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
connManager.bindProcessToNetwork(network); // 绑定应用程序到有线网络
}
});
}

/**
* 绑定有线网络
* @param context
*/
public static void connetWifi(Context context)
{
ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
NetworkRequest networkRequest = builder.build();
connManager.requestNetwork(networkRequest, new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
connManager.bindProcessToNetwork(network); // 绑定应用程序到有线网络
}
});
}


/**
* 发送
* @param cmds
*/
public static void exec3(String... cmds) {
StringBuffer command = new StringBuffer();
if (cmds.length <= 0) {
return;
}
for (String cmd : cmds) {
command.append(cmd).append("\n");
}
Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("su");
// process = Runtime.getRuntime().exec("system/bin/su");
os = new DataOutputStream(process.getOutputStream());
os.write(command.toString().getBytes());
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
Log.e("eeee",""+e.toString());
} finally {
try {
os.close();
} catch (Exception e) {
e.printStackTrace();
}
if(process!=null){
process.destroy();
}
}
}
}

+ 50
- 0
app/src/main/java/com/bonait/bnframework/common/utils/WifiInterceptor.java Ver fichero

@@ -0,0 +1,50 @@
package com.bonait.bnframework.common.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
* wifi
*/
public class WifiInterceptor implements Interceptor {
private Context context;

public WifiInterceptor(Context context) {
this.context = context;
}

@Override
public Response intercept(Chain chain) throws IOException {
ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
NetworkRequest networkRequest = builder.build();

ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
connManager.bindProcessToNetwork(network); // 绑定应用程序到 Wi-Fi 网络
}
};

connManager.requestNetwork(networkRequest, networkCallback);

try {
Request request = chain.request();
Response response = chain.proceed(request);
return response;
} finally {
connManager.unregisterNetworkCallback(networkCallback);
}
}
}

+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java Ver fichero

@@ -4,7 +4,7 @@ import android.os.Bundle;
import androidx.annotation.NonNull;

import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.iot.AliyunIOTManager;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.viewpager.widget.ViewPager;
import android.view.KeyEvent;






+ 40
- 0
code/工序.txt Ver fichero

@@ -0,0 +1,40 @@
工序主要有:
搅拌 热油 主料 加热 液体料 延迟 勾芡 出菜 热锅

搅拌模型:
搅拌动作(正转反转、一直正转、一直反转)
正转速度(停止、最低、低速、中速、高速、最高、极高)
反转速度(停止、最低、低速、中速、高速、最高、极高)
正转(秒)
反转(秒)
停止(秒)
延迟(秒)

热油模型:
加热功率(停止、一档、二档、三档、四档、五档)
热油(克)

主料模型:
主料名称
主料重量
烹饪(秒)
投料动作(投出抖动三次、投出等待三秒、直接投出、手动投料)


加热模型:
加热功率(停止、一档、二档、三档、四档、五档)
延迟(秒)

液体料模型:【注意:下方展示物料与克数】

延迟模型:
延迟(秒)

勾芡模型:
勾芡(克)

出菜模型:
时间(秒)

热锅模型:
热锅功率(停止、一档、二档、三档、四档、五档)

Cargando…
Cancelar
Guardar