Changeset 33 for mymrc

Show
Ignore:
Timestamp:
07/22/07 13:18:09 (5 years ago)
Author:
ciro
Message:

Fixed bugs: Application crash (NullPointerException?) after closing Settings
and About dialog, and when closing the application

Location:
mymrc/trunk/Java-client
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • mymrc/trunk/Java-client/dist/myMRC.jad

    r32 r33  
    11MIDlet-1: myMRC,,org.myMRC.myMRC 
    22MIDlet-Icon: /images/icon.png 
    3 MIDlet-Jar-Size: 80055 
     3MIDlet-Jar-Size: 79683 
    44MIDlet-Jar-URL: myMRC.jar 
    55MIDlet-Name: myMRC 
  • mymrc/trunk/Java-client/src/org/myMRC/control/Controller.java

    r32 r33  
    225225        switch (opcode) { 
    226226            case Opcode.IOP_START: 
    227                 if (!communicator.isAlive()) { 
    228                     this.handle(Opcode.IOP_PARSEFORM, Content.CONT_START); 
    229                 } else { 
    230                     this.handle(Opcode.IOP_PARSEFORM, Content.CONT_START_CONNECTED); 
    231                 } 
    232                  
     227                this.handle(Opcode.IOP_PARSEFORM, Content.CONT_START); 
    233228                break; 
    234229                 
     
    237232                    case Settings.CONN_BLUETOOTH: 
    238233                        this.communicator = BluetoothController.getInstance(); 
     234                        BluetoothController.getInstance().getDevices(); 
    239235                        break; 
    240236                         
     
    302298                 
    303299            case Opcode.IOP_SETTINGS_SAVE: 
    304                 //config.writeSettings(form); 
    305300                try { 
    306301                    config.setFromForm(form); 
     
    322317                 
    323318            case Opcode.IOP_INT_EXIT: 
    324                 if (communicator.isAlive()) { 
     319                if (communicator != null && communicator.isAlive()) { 
    325320                    try { 
    326                     communicator.close(); // FIXME: does it work? 
     321                    communicator.close(); 
    327322                    } catch (IOException ioe) { 
    328323                        ioe.printStackTrace(); 
  • mymrc/trunk/Java-client/src/org/myMRC/events/Content.java

    r32 r33  
    4242            "   <command type=\"back\" label=\"Exit\" opcode=\"0" + Opcode.IOP_INT_EXIT_CONF + "\"/>" + 
    4343            "</form>"; 
    44              
    45     public static final String CONT_START_CONNECTED =  
    46             "<form label=\"myMRC 0.1\">" +  
    47             "   <image file=\"mymrc.png\"/>" + 
    48             "   <string label=\"OH OH! this is deprecated, it shouldn't be displayed\"/>" + 
    49             "   <command label=\"Continue\" opcode=\"0000\"/>" + 
    50             "   <command label=\"Disconnect\" opcode=\"0991\"/>" + 
    51             "   <command label=\"Settings\" opcode=\"0920\"/>" + 
    52             "   <command label=\"About\" opcode=\"0901\"/>" + 
    53             "   <command label=\"Exit\" opcode=\"0998\"/>" + 
    54             "   <command type=\"back\" label=\"Exit\" opcode=\"0998\"/>" + 
    55             "</form>"; 
    5644     
    5745    public static final String CONT_SETTINGS =  
  • mymrc/trunk/Java-client/src/org/myMRC/myMRC.java

    r32 r33  
    4141     */ 
    4242    public void exitMIDlet() { 
    43         try { 
    44             if (InetController.getInstance().isAlive()) { 
    45                 InetController.getInstance().close(); 
    46             } 
    47             if (BluetoothController.getInstance().isAlive()) { 
    48                 BluetoothController.getInstance().close(); 
    49             } 
    50         } catch (IOException ioe) { 
    51             /*  
    52              * well, not much we can do here, exiting anyway, will just keep 
    53              * the socket open for some more time 
    54              */ 
    55         } 
    56          
    57         //InetController.getInstance().destroy(); 
    58          
    5943        Display.getDisplay(this).setCurrent(null); 
    6044        destroyApp(true); 
  • mymrc/trunk/Java-client/src/org/myMRC/net/BluetoothController.java

    r32 r33  
    5151    private BluetoothController() { 
    5252        this.controller = Controller.getInstance(); 
    53         this.getDevices(); 
     53        //this.getDevices(); 
    5454    } 
    5555     
     
    105105     * Scans for available Bluetooth devices. 
    106106     */ 
    107     private void getDevices() { 
     107    public void getDevices() { 
    108108        try { 
    109109            this.local = LocalDevice.getLocalDevice(); 
     
    415415            super.receiver = new Receiver(this, conn.openInputStream()); 
    416416            super.receiver.start(); 
    417             //ostream.write("whoohoo\n".getBytes()); 
    418             //ostream.flush(); 
    419417            super.isAlive = true; 
    420418            super.send(Opcode.OP_HELLO, null); 
    421             //istream = conn.openInputStream(); 
    422             //int size = 197; 
    423             //byte[] b = new byte[size]; 
    424             //istream.read(b, 0, size); 
    425             //controller.handle(Opcode.IOP_PARSELIST, new String(b)); 
     419             
    426420        } catch (IOException ioe) { 
    427421                alert.setString("Connection failed: " + ioe.getMessage()); 
     
    433427        } 
    434428         
    435         //alert.setString("Connected to " + url + "   (conn = " + conn + ")"); 
    436         //controller.setScreen(alert); 
    437429    } 
    438430