save
Showing
17 changed files
with
91 additions
and
73 deletions
No preview for this file type
| 1 | 087fa2070e28be10c28c122711c04f39 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | ce12addb2986cdd9ed6894c57828ee89a282e32e | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.51</version> | ||
| 8 | </project> |
| 1 | 74a7cbd9127f19d2c6275862a2a2868d | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 9c87db08ce399d074c143a0326d3ab58fe595db2 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | <groupId>org.emercit</groupId> | 3 | <groupId>org.emercit</groupId> |
| 4 | <artifactId>utilstools</artifactId> | 4 | <artifactId>utilstools</artifactId> |
| 5 | <versioning> | 5 | <versioning> |
| 6 | <release>1.50</release> | 6 | <release>1.51</release> |
| 7 | <versions> | 7 | <versions> |
| 8 | <version>1.0</version> | 8 | <version>1.0</version> |
| 9 | <version>1.1</version> | 9 | <version>1.1</version> |
| ... | @@ -51,7 +51,8 @@ | ... | @@ -51,7 +51,8 @@ |
| 51 | <version>1.45</version> | 51 | <version>1.45</version> |
| 52 | <version>1.46</version> | 52 | <version>1.46</version> |
| 53 | <version>1.50</version> | 53 | <version>1.50</version> |
| 54 | <version>1.51</version> | ||
| 54 | </versions> | 55 | </versions> |
| 55 | <lastUpdated>20150812065914</lastUpdated> | 56 | <lastUpdated>20150813132852</lastUpdated> |
| 56 | </versioning> | 57 | </versioning> |
| 57 | </metadata> | 58 | </metadata> | ... | ... |
| ... | @@ -67,7 +67,7 @@ | ... | @@ -67,7 +67,7 @@ |
| 67 | <dependency> | 67 | <dependency> |
| 68 | <groupId>org.emercit</groupId> | 68 | <groupId>org.emercit</groupId> |
| 69 | <artifactId>utilstools</artifactId> | 69 | <artifactId>utilstools</artifactId> |
| 70 | <version>1.50</version> | 70 | <version>1.51</version> |
| 71 | </dependency> | 71 | </dependency> |
| 72 | 72 | ||
| 73 | 73 | ... | ... |
| ... | @@ -69,7 +69,7 @@ import org.emercit.szs.model.*; | ... | @@ -69,7 +69,7 @@ import org.emercit.szs.model.*; |
| 69 | import org.emercit.szs.service.SData; | 69 | import org.emercit.szs.service.SData; |
| 70 | import org.emercit.szs.szsterminal.SZSTerminal; | 70 | import org.emercit.szs.szsterminal.SZSTerminal; |
| 71 | 71 | ||
| 72 | import org.emercit.szs.controldevtools.bean.NotificationBB; | 72 | import org.emercit.szs.controldevtools.bean.Notification; |
| 73 | 73 | ||
| 74 | public class DlgConfirm extends JDialog { | 74 | public class DlgConfirm extends JDialog { |
| 75 | 75 | ||
| ... | @@ -79,7 +79,7 @@ public class DlgConfirm extends JDialog { | ... | @@ -79,7 +79,7 @@ public class DlgConfirm extends JDialog { |
| 79 | 79 | ||
| 80 | boolean animate = false; | 80 | boolean animate = false; |
| 81 | 81 | ||
| 82 | private NotificationBB notification=new NotificationBB(); | 82 | private Notification notification=new Notification(); |
| 83 | 83 | ||
| 84 | private final JPanel contentPanel = new JPanel(); | 84 | private final JPanel contentPanel = new JPanel(); |
| 85 | 85 | ||
| ... | @@ -129,8 +129,28 @@ public class DlgConfirm extends JDialog { | ... | @@ -129,8 +129,28 @@ public class DlgConfirm extends JDialog { |
| 129 | if (countanimate > 0) { | 129 | if (countanimate > 0) { |
| 130 | ev.setCountAnimate(countanimate - 1); | 130 | ev.setCountAnimate(countanimate - 1); |
| 131 | } else { | 131 | } else { |
| 132 | notification.playSiren(); | 132 | |
| 133 | if (ev.getSound()) { | ||
| 134 | |||
| 135 | int countsound = ev.getCountSound(); | ||
| 136 | // on sound method | ||
| 137 | notification.playSound(); | ||
| 138 | |||
| 139 | if (countsound > 0) { | ||
| 140 | ev.setCountSound(countsound - 1); | ||
| 141 | } else { | ||
| 142 | if (ev.getSiren()) { | ||
| 143 | notification.playSound(); | ||
| 144 | } | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 133 | } | 148 | } |
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | |||
| 134 | 154 | ||
| 135 | } | 155 | } |
| 136 | 156 | ||
| ... | @@ -255,8 +275,9 @@ public class DlgConfirm extends JDialog { | ... | @@ -255,8 +275,9 @@ public class DlgConfirm extends JDialog { |
| 255 | 275 | ||
| 256 | MdlEvent buff = ev; | 276 | MdlEvent buff = ev; |
| 257 | ev = null; | 277 | ev = null; |
| 258 | 278 | ||
| 259 | notification.stopSiren(); | 279 | notification.stopSiren(); |
| 280 | |||
| 260 | 281 | ||
| 261 | EventTableModel model = (EventTableModel) SZSTerminal.jpnllog.table | 282 | EventTableModel model = (EventTableModel) SZSTerminal.jpnllog.table |
| 262 | .getModel(); | 283 | .getModel(); | ... | ... |
| ... | @@ -41,13 +41,13 @@ import org.emercit.utilstools.svmanager.model.SvBean; | ... | @@ -41,13 +41,13 @@ import org.emercit.utilstools.svmanager.model.SvBean; |
| 41 | import org.emercit.utilstools.svmanager.service.Sv; | 41 | import org.emercit.utilstools.svmanager.service.Sv; |
| 42 | import org.emercit.utilstools.svmanager.service.SvControl; | 42 | import org.emercit.utilstools.svmanager.service.SvControl; |
| 43 | 43 | ||
| 44 | import org.emercit.szs.controldevtools.bean.NotificationBB; | 44 | import org.emercit.szs.controldevtools.bean.Notification; |
| 45 | 45 | ||
| 46 | public class CheckNotification extends RoundPanel implements Externalizable { | 46 | public class CheckNotification extends RoundPanel implements Externalizable { |
| 47 | 47 | ||
| 48 | private static final Logger log = Logger.getLogger(CheckNotification.class); | 48 | private static final Logger log = Logger.getLogger(CheckNotification.class); |
| 49 | 49 | ||
| 50 | private NotificationBB notificationbb=new NotificationBB(); | 50 | private Notification notificationbb=new Notification(); |
| 51 | 51 | ||
| 52 | private Dimension beanDimension; // simple | 52 | private Dimension beanDimension; // simple |
| 53 | 53 | ||
| ... | @@ -104,6 +104,7 @@ public class CheckNotification extends RoundPanel implements Externalizable { | ... | @@ -104,6 +104,7 @@ public class CheckNotification extends RoundPanel implements Externalizable { |
| 104 | { | 104 | { |
| 105 | protected Void doInBackground() throws Exception | 105 | protected Void doInBackground() throws Exception |
| 106 | { | 106 | { |
| 107 | |||
| 107 | btnSound.setEnabled(false); | 108 | btnSound.setEnabled(false); |
| 108 | notificationbb.playSound(); | 109 | notificationbb.playSound(); |
| 109 | btnSound.setEnabled(true); | 110 | btnSound.setEnabled(true); | ... | ... |
| ... | @@ -31,12 +31,11 @@ import javax.swing.event.SwingPropertyChangeSupport; | ... | @@ -31,12 +31,11 @@ import javax.swing.event.SwingPropertyChangeSupport; |
| 31 | 31 | ||
| 32 | import org.apache.log4j.Logger; | 32 | import org.apache.log4j.Logger; |
| 33 | import org.emercit.utilstools.config.DefSettings; | 33 | import org.emercit.utilstools.config.DefSettings; |
| 34 | |||
| 35 | import org.emercit.szs.controldevtools.bean.DevToolsBean; | 34 | import org.emercit.szs.controldevtools.bean.DevToolsBean; |
| 36 | import org.emercit.szs.controldevtools.bean.RoundPanel; | 35 | import org.emercit.szs.controldevtools.bean.RoundPanel; |
| 37 | |||
| 38 | import org.emercit.utilstools.pckutils.checkservice.STService; | 36 | import org.emercit.utilstools.pckutils.checkservice.STService; |
| 39 | import org.emercit.utilstools.service.Settings; | 37 | import org.emercit.utilstools.service.Settings; |
| 38 | import org.emercit.utilstools.sshexec.SSHExec; | ||
| 40 | import org.emercit.utilstools.svmanager.model.SvBean; | 39 | import org.emercit.utilstools.svmanager.model.SvBean; |
| 41 | import org.emercit.utilstools.svmanager.service.Sv; | 40 | import org.emercit.utilstools.svmanager.service.Sv; |
| 42 | import org.emercit.utilstools.svmanager.service.SvControl; | 41 | import org.emercit.utilstools.svmanager.service.SvControl; |
| ... | @@ -75,7 +74,7 @@ public class DevToolsBean extends RoundPanel implements Externalizable { | ... | @@ -75,7 +74,7 @@ public class DevToolsBean extends RoundPanel implements Externalizable { |
| 75 | 74 | ||
| 76 | public Sv sv; | 75 | public Sv sv; |
| 77 | 76 | ||
| 78 | 77 | private SSHExec sshecex=new SSHExec(); | |
| 79 | 78 | ||
| 80 | 79 | ||
| 81 | protected EventListenerList listenerList = new EventListenerList(); | 80 | protected EventListenerList listenerList = new EventListenerList(); |
| ... | @@ -259,6 +258,10 @@ public class DevToolsBean extends RoundPanel implements Externalizable { | ... | @@ -259,6 +258,10 @@ public class DevToolsBean extends RoundPanel implements Externalizable { |
| 259 | btnStop.setEnabled(false); | 258 | btnStop.setEnabled(false); |
| 260 | 259 | ||
| 261 | try { | 260 | try { |
| 261 | |||
| 262 | sshecex.setCmd("touch /etc/udev/rules.d/70-persistent-net.rules"); | ||
| 263 | sshecex.Exec(); | ||
| 264 | |||
| 262 | settings.init(); | 265 | settings.init(); |
| 263 | 266 | ||
| 264 | Thread.sleep(5000); | 267 | Thread.sleep(5000); | ... | ... |
| ... | @@ -6,49 +6,33 @@ import java.io.IOException; | ... | @@ -6,49 +6,33 @@ import java.io.IOException; |
| 6 | 6 | ||
| 7 | import org.apache.log4j.Logger; | 7 | import org.apache.log4j.Logger; |
| 8 | import org.emercit.szs.controldevtools.bean.Player; | 8 | import org.emercit.szs.controldevtools.bean.Player; |
| 9 | import org.emercit.szs.szsterminal.SZSTerminal; | ||
| 9 | 10 | ||
| 10 | public class NotificationBB implements INotification { | 11 | public class Notification implements INotification { |
| 11 | 12 | ||
| 12 | private static final Logger log = Logger.getLogger(NotificationBB.class); | 13 | private static final Logger log = Logger.getLogger(Notification.class); |
| 13 | 14 | ||
| 14 | 15 | ||
| 15 | public void playSound() { | 16 | public void playSound() { |
| 16 | 17 | ||
| 17 | Player player = new Player("/Alarm.wav"); | 18 | Player player = new Player("/Alarm.wav"); |
| 18 | log.info("Sound - up "); | 19 | player.start(); |
| 19 | player.start(); | ||
| 20 | 20 | ||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | public void playSiren() { | 23 | public void playSiren() { |
| 24 | try { | 24 | SZSTerminal.siren.sirenOn(); |
| 25 | |||
| 26 | FileWriter fw = new FileWriter("/dev/relay1", true); | ||
| 27 | BufferedWriter output = new BufferedWriter(fw); | ||
| 28 | output.write("1"); | ||
| 29 | output.close(); | ||
| 30 | log.info("Siren - up "); | ||
| 31 | |||
| 32 | } catch (IOException e) { | ||
| 33 | log.error(e.getMessage()); | ||
| 34 | } | ||
| 35 | } | 25 | } |
| 36 | 26 | ||
| 37 | public void stopSiren() { | 27 | public void stopSiren() { |
| 38 | try { | ||
| 39 | |||
| 40 | FileWriter fw = new FileWriter("/dev/relay1", true); | ||
| 41 | BufferedWriter output = new BufferedWriter(fw); | ||
| 42 | output.write("0"); | ||
| 43 | output.close(); | ||
| 44 | log.info("Siren - down "); | ||
| 45 | |||
| 46 | } catch (IOException e) { | ||
| 47 | log.error(e.getMessage()); | ||
| 48 | } | ||
| 49 | 28 | ||
| 29 | SZSTerminal.siren.sirenOff(); | ||
| 50 | } | 30 | } |
| 51 | 31 | ||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | |||
| 52 | } | 36 | } |
| 53 | 37 | ||
| 54 | 38 | ... | ... |
| ... | @@ -2,8 +2,7 @@ package org.emercit.szs.model; | ... | @@ -2,8 +2,7 @@ package org.emercit.szs.model; |
| 2 | 2 | ||
| 3 | public class SirenJNI { | 3 | public class SirenJNI { |
| 4 | static { | 4 | static { |
| 5 | // System.loadLibrary("siren"); | 5 | System.loadLibrary("siren"); |
| 6 | |||
| 7 | } | 6 | } |
| 8 | 7 | ||
| 9 | public native void sirenOn(); | 8 | public native void sirenOn(); | ... | ... |
| ... | @@ -99,8 +99,6 @@ public class SZSTerminal { | ... | @@ -99,8 +99,6 @@ public class SZSTerminal { |
| 99 | 99 | ||
| 100 | public static DlgConfirm dlgconfirm = new DlgConfirm(); | 100 | public static DlgConfirm dlgconfirm = new DlgConfirm(); |
| 101 | 101 | ||
| 102 | |||
| 103 | |||
| 104 | private static class ftdTimerTask extends TimerTask { | 102 | private static class ftdTimerTask extends TimerTask { |
| 105 | 103 | ||
| 106 | @Override | 104 | @Override |
| ... | @@ -160,8 +158,6 @@ public class SZSTerminal { | ... | @@ -160,8 +158,6 @@ public class SZSTerminal { |
| 160 | 158 | ||
| 161 | }.execute(); | 159 | }.execute(); |
| 162 | 160 | ||
| 163 | |||
| 164 | |||
| 165 | /* | 161 | /* |
| 166 | * События для подтверждения | 162 | * События для подтверждения |
| 167 | */ | 163 | */ |
| ... | @@ -169,31 +165,20 @@ public class SZSTerminal { | ... | @@ -169,31 +165,20 @@ public class SZSTerminal { |
| 169 | { | 165 | { |
| 170 | protected Void doInBackground() throws Exception | 166 | protected Void doInBackground() throws Exception |
| 171 | { | 167 | { |
| 172 | |||
| 173 | |||
| 174 | ModelResponse mdl=SData.INSTANCE.getData(); | 168 | ModelResponse mdl=SData.INSTANCE.getData(); |
| 175 | 169 | ||
| 176 | |||
| 177 | |||
| 178 | for (EventAgk eventagk : mdl.lsteventagkconfirm) { | 170 | for (EventAgk eventagk : mdl.lsteventagkconfirm) { |
| 179 | |||
| 180 | |||
| 181 | SData.INSTANCE.RemoveEvent(); | 171 | SData.INSTANCE.RemoveEvent(); |
| 182 | 172 | ||
| 183 | MdlEvent ev = new MdlEvent(eventagk.id, eventagk.id_agk, | 173 | MdlEvent ev = new MdlEvent(eventagk.id, eventagk.id_agk, |
| 184 | eventagk.river, eventagk.datetime, eventagk.value, | 174 | eventagk.river, eventagk.datetime, eventagk.value, |
| 185 | eventagk.id_status, eventagk.repair, eventagk.opendoor, | 175 | eventagk.id_status, eventagk.repair, eventagk.opendoor, |
| 186 | eventagk.veracity); | 176 | eventagk.veracity); |
| 187 | |||
| 188 | ev.setSiren(mdl.siren); | 177 | ev.setSiren(mdl.siren); |
| 189 | 178 | ||
| 190 | |||
| 191 | dlgconfirm.setEvent(ev); | 179 | dlgconfirm.setEvent(ev); |
| 192 | |||
| 193 | dlgconfirm.setVisible(true); | 180 | dlgconfirm.setVisible(true); |
| 194 | 181 | ||
| 195 | |||
| 196 | |||
| 197 | } | 182 | } |
| 198 | 183 | ||
| 199 | return null; | 184 | return null; |
| ... | @@ -215,11 +200,7 @@ public class SZSTerminal { | ... | @@ -215,11 +200,7 @@ public class SZSTerminal { |
| 215 | 200 | ||
| 216 | EventQueue.invokeLater(new Runnable() { | 201 | EventQueue.invokeLater(new Runnable() { |
| 217 | public void run() { | 202 | public void run() { |
| 218 | try { | 203 | try {siren.sirenOff(); } catch (Exception e) {}; |
| 219 | // siren.sirenOff(); | ||
| 220 | } catch (Exception e) { | ||
| 221 | |||
| 222 | } | ||
| 223 | mainFrame = new JFrame(); | 204 | mainFrame = new JFrame(); |
| 224 | mainFrame.setSize(800, 600); | 205 | mainFrame.setSize(800, 600); |
| 225 | mainFrame.setUndecorated(false); | 206 | mainFrame.setUndecorated(false); |
| ... | @@ -243,8 +224,6 @@ public class SZSTerminal { | ... | @@ -243,8 +224,6 @@ public class SZSTerminal { |
| 243 | 224 | ||
| 244 | // pnlcurrent.setBounds(10, 70, 770, 470); | 225 | // pnlcurrent.setBounds(10, 70, 770, 470); |
| 245 | List<Event> lstevent = new ArrayList<Event>(); | 226 | List<Event> lstevent = new ArrayList<Event>(); |
| 246 | |||
| 247 | |||
| 248 | 227 | ||
| 249 | JTabbedPane jtp = new JTabbedPane(); | 228 | JTabbedPane jtp = new JTabbedPane(); |
| 250 | jtp.setFont(new Font("Tahoma", Font.PLAIN, 14)); | 229 | jtp.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
| ... | @@ -273,8 +252,7 @@ public class SZSTerminal { | ... | @@ -273,8 +252,7 @@ public class SZSTerminal { |
| 273 | 252 | ||
| 274 | mainPanel.setLayout(null); | 253 | mainPanel.setLayout(null); |
| 275 | mainFrame.getContentPane().add(mainPanel); | 254 | mainFrame.getContentPane().add(mainPanel); |
| 276 | 255 | ||
| 277 | |||
| 278 | Runnable rTScan = new TScan(); | 256 | Runnable rTScan = new TScan(); |
| 279 | 257 | ||
| 280 | Thread tScan = new Thread(rTScan); | 258 | Thread tScan = new Thread(rTScan); | ... | ... |
| ... | @@ -21,10 +21,16 @@ public class DCalibratorBB implements DCalibrator { | ... | @@ -21,10 +21,16 @@ public class DCalibratorBB implements DCalibrator { |
| 21 | 21 | ||
| 22 | //Run("/home/debian/start-xinput-config.sh"); | 22 | //Run("/home/debian/start-xinput-config.sh"); |
| 23 | 23 | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 24 | public int Run(String cmd) { | 27 | public int Run(String cmd) { |
| 25 | try { | 28 | try { |
| 29 | Vector<String> defaults=getDefContent(); | ||
| 26 | Vector<String> params=cmdExec.Run(cmd); | 30 | Vector<String> params=cmdExec.Run(cmd); |
| 27 | 31 | ||
| 32 | |||
| 33 | |||
| 28 | File file = new File("/etc/X11/xorg.conf.d/99-calibration.conf"); | 34 | File file = new File("/etc/X11/xorg.conf.d/99-calibration.conf"); |
| 29 | 35 | ||
| 30 | if (!file.exists()) { | 36 | if (!file.exists()) { |
| ... | @@ -35,13 +41,17 @@ public class DCalibratorBB implements DCalibrator { | ... | @@ -35,13 +41,17 @@ public class DCalibratorBB implements DCalibrator { |
| 35 | BufferedWriter bw = new BufferedWriter(fw); | 41 | BufferedWriter bw = new BufferedWriter(fw); |
| 36 | 42 | ||
| 37 | bw.write("#Generated by DisplayCalibrator\n"); | 43 | bw.write("#Generated by DisplayCalibrator\n"); |
| 38 | bw.write("\n"); | 44 | |
| 39 | 45 | for (int i=7;i<params.size();i++) { | |
| 40 | for (int i=9;i<params.size();i++) { | 46 | defaults.add(params.get(i)); |
| 41 | 47 | defaults.add("\n"); | |
| 42 | bw.write(params.get(i)); | ||
| 43 | bw.write("\n"); | ||
| 44 | } | 48 | } |
| 49 | |||
| 50 | for (int i=0;i<defaults.size();i++) { | ||
| 51 | bw.write(defaults.get(i)); | ||
| 52 | } | ||
| 53 | |||
| 54 | bw.write("\n"); | ||
| 45 | 55 | ||
| 46 | bw.close(); | 56 | bw.close(); |
| 47 | return Msg.CalibrSucc.getCode(); | 57 | return Msg.CalibrSucc.getCode(); |
| ... | @@ -52,5 +62,14 @@ public class DCalibratorBB implements DCalibrator { | ... | @@ -52,5 +62,14 @@ public class DCalibratorBB implements DCalibrator { |
| 52 | } | 62 | } |
| 53 | } | 63 | } |
| 54 | 64 | ||
| 65 | /* | ||
| 66 | * Содержание файла по умолчанию | ||
| 67 | */ | ||
| 68 | public Vector<String> getDefContent() throws Exception { | ||
| 69 | |||
| 70 | return cmdExec.Run("cat /usr/share/X11/xorg.conf.d/10-evdev.conf"); | ||
| 71 | |||
| 72 | } | ||
| 73 | |||
| 55 | 74 | ||
| 56 | } | 75 | } | ... | ... |
-
Please register or sign in to post a comment