Cadre

422 mots 2 pages
EcrireSurCom.java 1 import gnu.io.CommPortIdentifier; 8 9 public class EcrireSurCom { 10 static Enumeration portList; 11 static CommPortIdentifier portId; 12 static String messageString = "MORAD\t"; 13 static SerialPort serialPort; 14 static OutputStream outputStream; 15 static boolean outputBufferEmptyFlag = false; 16 static byte trameConnexion[] = new byte[4]; 17 static byte trameTension[] = new byte[3]; 18 static byte trameEnvoi[] = new byte[3]; 19 static byte trameDeconnexion[] = new byte[2]; 20 21 22 23 24 //byte[] m = new byte[7]; 25 //b[0] = (byte) (0xFF & (entier >> 8 * 0)); 26 27 // m[0] = (byte) (0xFF & (01110101)) ; 28 29 /** 30 * Method declaration 31 * 32 * 33 * @param args 34 * 35 * @see 36 */ 37 public static void main(String[] args) { 38 39 trameConnexion[0] = (byte) 0x61; 40 trameConnexion[0] = (byte) 0xf2; 41 trameConnexion[1] = (byte) 0x02; 42 trameConnexion[2] = (byte) 0x01; 43 trameConnexion[3] = (byte)((int)trameConnexion[0] ^ (int)trameConnexion[1] ^ (int)trameConnexion[2]); 44 System.out.println(ByteToHex(trameConnexion)); 45 trameTension[0] = (byte) 0x21; 46 trameTension[1] = (byte) 0x81; 47 trameTension[2] = (byte)((int)trameTension[0] ^ (int)trameTension[1]); 48 trameDeconnexion[0] = (byte)0x80; 49 trameDeconnexion[1] = (byte)0x80; 50 boolean portFound = false; 51 String defaultPort = "COM1"; 52 53 if (args.length > 0) { 54 defaultPort = args[0]; 55 } 56 57 portList = CommPortIdentifier.getPortIdentifiers(); 58 59 while (portList.hasMoreElements()) { 60 portId = (CommPortIdentifier) portList.nextElement(); 61 62 if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { 63 64 if (portId.getName().equals(defaultPort)) { 65 System.out.println("Found port " + defaultPort); 66 67 portFound = true; 68 69 try { Page 1

EcrireSurCom.java 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 ; 108 th); 109 110 ength); 111 112 113 114 115 116 117 118 119 120 121 122 closing

en relation

  • Questionnaire parrot
    4726 mots | 19 pages
  • Table de la loi normale de claude blue
    860 mots | 4 pages
  • Tp exo maths
    858 mots | 4 pages
  • Correction exo python
    813 mots | 4 pages
  • Corrigé bts ig
    3364 mots | 14 pages
  • Cours de programmation l3
    7084 mots | 29 pages
  • Courbe de tendance et fonction
    535 mots | 3 pages
  • BOULOM TAF MAISON
    375 mots | 2 pages
  • cgo e4
    1079 mots | 5 pages
  • Agences Gironde
    803 mots | 4 pages
  • Cadre
    463 mots | 2 pages
  • chevelure
    789 mots | 4 pages
  • Gsi terminale
    1115 mots | 5 pages
  • La puissance de pensee
    759 mots | 4 pages