diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java index 514d3ba..a455fd0 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java @@ -13,23 +13,18 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** - * Creates underlying database table using DAOs. - */ + /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { GasValueBeanDao.createTable(db, ifNotExists); } - /** - * Drops underlying database table using DAOs. - */ + /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { GasValueBeanDao.dropTable(db, ifExists); } @@ -80,9 +75,7 @@ } } - /** - * WARNING: Drops all table on Upgrade! Use only during development. - */ + /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java index 514d3ba..a455fd0 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java @@ -13,23 +13,18 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** - * Creates underlying database table using DAOs. - */ + /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { GasValueBeanDao.createTable(db, ifNotExists); } - /** - * Drops underlying database table using DAOs. - */ + /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { GasValueBeanDao.dropTable(db, ifExists); } @@ -80,9 +75,7 @@ } } - /** - * WARNING: Drops all table on Upgrade! Use only during development. - */ + /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java b/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java index f252abc..259243d 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java @@ -14,7 +14,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -34,7 +34,7 @@ registerDao(GasValueBean.class, gasValueBeanDao); } - + public void clear() { gasValueBeanDaoConfig.clearIdentityScope(); } diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java index 514d3ba..a455fd0 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java @@ -13,23 +13,18 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** - * Creates underlying database table using DAOs. - */ + /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { GasValueBeanDao.createTable(db, ifNotExists); } - /** - * Drops underlying database table using DAOs. - */ + /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { GasValueBeanDao.dropTable(db, ifExists); } @@ -80,9 +75,7 @@ } } - /** - * WARNING: Drops all table on Upgrade! Use only during development. - */ + /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java b/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java index f252abc..259243d 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java @@ -14,7 +14,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -34,7 +34,7 @@ registerDao(GasValueBean.class, gasValueBeanDao); } - + public void clear() { gasValueBeanDaoConfig.clearIdentityScope(); } diff --git a/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java b/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java index 6025bbf..5149375 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java +++ b/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java @@ -12,10 +12,9 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - -/** +/** * DAO for table "GAS_VALUE_BEAN". - */ +*/ public class GasValueBeanDao extends AbstractDao { public static final String TABLENAME = "GAS_VALUE_BEAN"; @@ -35,16 +34,14 @@ public GasValueBeanDao(DaoConfig config) { super(config); } - + public GasValueBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** - * Creates the underlying database table. - */ + /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists ? "IF NOT EXISTS " : ""; + String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"GAS_VALUE_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TIME\" TEXT," + // 1: time @@ -52,9 +49,7 @@ "\"LOCATION\" TEXT);"); // 3: location } - /** - * Drops the underlying database table. - */ + /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GAS_VALUE_BEAN\""; db.execSQL(sql); @@ -63,18 +58,18 @@ @Override protected final void bindValues(DatabaseStatement stmt, GasValueBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String time = entity.getTime(); if (time != null) { stmt.bindString(2, time); } stmt.bindLong(3, entity.getValue()); - + String location = entity.getLocation(); if (location != null) { stmt.bindString(4, location); @@ -84,18 +79,18 @@ @Override protected final void bindValues(SQLiteStatement stmt, GasValueBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String time = entity.getTime(); if (time != null) { stmt.bindString(2, time); } stmt.bindLong(3, entity.getValue()); - + String location = entity.getLocation(); if (location != null) { stmt.bindString(4, location); @@ -105,36 +100,36 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override public GasValueBean readEntity(Cursor cursor, int offset) { GasValueBean entity = new GasValueBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // time - cursor.getInt(offset + 2), // value - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // location + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // time + cursor.getInt(offset + 2), // value + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // location ); return entity; } - + @Override public void readEntity(Cursor cursor, GasValueBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTime(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setValue(cursor.getInt(offset + 2)); entity.setLocation(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - } - + } + @Override protected final Long updateKeyAfterInsert(GasValueBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override public Long getKey(GasValueBean entity) { - if (entity != null) { + if(entity != null) { return entity.getId(); } else { return null; @@ -150,5 +145,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java index 514d3ba..a455fd0 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoMaster.java @@ -13,23 +13,18 @@ // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - /** * Master of DAO (schema version 1): knows all DAOs. */ public class DaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; - /** - * Creates underlying database table using DAOs. - */ + /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { GasValueBeanDao.createTable(db, ifNotExists); } - /** - * Drops underlying database table using DAOs. - */ + /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { GasValueBeanDao.dropTable(db, ifExists); } @@ -80,9 +75,7 @@ } } - /** - * WARNING: Drops all table on Upgrade! Use only during development. - */ + /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); diff --git a/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java b/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java index f252abc..259243d 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/endoscope/greendao/DaoSession.java @@ -14,7 +14,7 @@ /** * {@inheritDoc} - * + * * @see org.greenrobot.greendao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { @@ -34,7 +34,7 @@ registerDao(GasValueBean.class, gasValueBeanDao); } - + public void clear() { gasValueBeanDaoConfig.clearIdentityScope(); } diff --git a/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java b/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java index 6025bbf..5149375 100644 --- a/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java +++ b/app/src/main/java/com/casic/endoscope/greendao/GasValueBeanDao.java @@ -12,10 +12,9 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - -/** +/** * DAO for table "GAS_VALUE_BEAN". - */ +*/ public class GasValueBeanDao extends AbstractDao { public static final String TABLENAME = "GAS_VALUE_BEAN"; @@ -35,16 +34,14 @@ public GasValueBeanDao(DaoConfig config) { super(config); } - + public GasValueBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** - * Creates the underlying database table. - */ + /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists ? "IF NOT EXISTS " : ""; + String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"GAS_VALUE_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TIME\" TEXT," + // 1: time @@ -52,9 +49,7 @@ "\"LOCATION\" TEXT);"); // 3: location } - /** - * Drops the underlying database table. - */ + /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GAS_VALUE_BEAN\""; db.execSQL(sql); @@ -63,18 +58,18 @@ @Override protected final void bindValues(DatabaseStatement stmt, GasValueBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String time = entity.getTime(); if (time != null) { stmt.bindString(2, time); } stmt.bindLong(3, entity.getValue()); - + String location = entity.getLocation(); if (location != null) { stmt.bindString(4, location); @@ -84,18 +79,18 @@ @Override protected final void bindValues(SQLiteStatement stmt, GasValueBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String time = entity.getTime(); if (time != null) { stmt.bindString(2, time); } stmt.bindLong(3, entity.getValue()); - + String location = entity.getLocation(); if (location != null) { stmt.bindString(4, location); @@ -105,36 +100,36 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override public GasValueBean readEntity(Cursor cursor, int offset) { GasValueBean entity = new GasValueBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // time - cursor.getInt(offset + 2), // value - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // location + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // time + cursor.getInt(offset + 2), // value + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // location ); return entity; } - + @Override public void readEntity(Cursor cursor, GasValueBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTime(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setValue(cursor.getInt(offset + 2)); entity.setLocation(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - } - + } + @Override protected final Long updateKeyAfterInsert(GasValueBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override public Long getKey(GasValueBean entity) { - if (entity != null) { + if(entity != null) { return entity.getId(); } else { return null; @@ -150,5 +145,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt index 6a70d67..6c32dad 100644 --- a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt +++ b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt @@ -223,6 +223,9 @@ //导出到本地文件 val rootDirectory = FileManager.getRootDirectory() val file = File("${rootDirectory}/GasDensityValue.json") + if (file.exists()) { + file.delete() + } valueBeans.toJson().writeToFile(file) "数据导出成功,请在设备文件管理根目录【Endoscope】查看".show(this) } @@ -448,7 +451,7 @@ } binding.resetButton.setOnClickListener { - executeAngle(0, 0) + executeAngle(60, 0) } } @@ -538,9 +541,9 @@ serialStart.dwSerialPort = 2 //串口编号 serialStart.wPort = 0 - val serialHandle = hkSDK.NET_DVR_SerialStart_V40( - returnUserId, serialStart - ) { _, _, _, _ -> } + val serialHandle = hkSDK.NET_DVR_SerialStart_V40(returnUserId, serialStart) { _, _, _, _ -> + + } //向透明通道发送数据,水平和垂直需要分开发送 hkSDK.NET_DVR_SerialSend( @@ -550,7 +553,7 @@ horizontal.createHorizontalCommand().size ) try { - Thread.sleep(50) + Thread.sleep(100) } catch (e: InterruptedException) { e.printStackTrace() } @@ -559,7 +562,7 @@ ) try { - Thread.sleep(50) + Thread.sleep(100) } catch (e: InterruptedException) { e.printStackTrace() }