User Tools

Site Tools


drexel_duct_navigator_gui

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
drexel_duct_navigator_gui [2016/11/07 19:56] – created dwallacedrexel_duct_navigator_gui [2016/11/07 20:04] (current) dwallace
Line 25: Line 25:
   * Xcode. (free software from Mac App store)   * Xcode. (free software from Mac App store)
  
-  * Async UDP Library for cocoa (download link:  https://github.com/robbiehanson/CocoaAsyncSocket )+  * [[https://github.com/robbiehanson/CocoaAsyncSocket|Async UDP Library for cocoa]]
  
 ===== Creating the GUI ===== ===== Creating the GUI =====
  
-First you will need to begin by creating a new xCode Project.  File>new project .  Choose a cocoa application from the options presented.  Then give your project a name and pick a location to save it.+First you will need to begin by creating a new xCode Project.  File->new project .  Choose a cocoa application from the options presented.  Then give your project a name and pick a location to save it.
  
 {{dylanw:newProjectScreen.jpg}}{{dylanw:newProject2.jpg}}\\  {{dylanw:newProjectScreen.jpg}}{{dylanw:newProject2.jpg}}\\ 
Line 96: Line 96:
 **Actions are called when we interact with objects in our GUI.  We need some of them too.  You can create them in the same way, just make sure you select action instead of outlet** **Actions are called when we interact with objects in our GUI.  We need some of them too.  You can create them in the same way, just make sure you select action instead of outlet**
  
-  (IBAction)setSteer:(id)sender;+  (IBAction)setSteer:(id)sender;
  
-  (IBAction)setPow:(id)sender;+  (IBAction)setPow:(id)sender;
  
-  (IBAction)setAuto:(id)sender;+  (IBAction)setAuto:(id)sender;
  
-  (IBAction)setManual:(id)sender;+  (IBAction)setManual:(id)sender;
  
 If you ever want to manually inspect your connections you can do so using the connection inspector in the utilities panel.   If you ever want to manually inspect your connections you can do so using the connection inspector in the utilities panel.  
Line 180: Line 180:
    @synthesize sideRangerBar;    @synthesize sideRangerBar;
    @synthesize sideRangerVal;    @synthesize sideRangerVal;
-    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification{+    
 +  (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
       udpSocket = [[AsyncUdpSocket alloc] initWithDelegate:self];   // allocate memory for the socket and initialize it       udpSocket = [[AsyncUdpSocket alloc] initWithDelegate:self];   // allocate memory for the socket and initialize it
       NSError *error = nil;   // create an NSError object and initialize it to nil       NSError *error = nil;   // create an NSError object and initialize it to nil
- +  
       if (![udpSocket bindToPort:0 error:&error])        // check to make sure binding was successful        if (![udpSocket bindToPort:0 error:&error])        // check to make sure binding was successful 
       {       {
Line 190: Line 191:
     }     }
     [udpSocket receiveWithTimeout:-1 tag:0];       [udpSocket receiveWithTimeout:-1 tag:0];  
-    +  
     NSLog(@"Ready");     NSLog(@"Ready");
-    +  
      }      }
- 
  
 Now a method (function) must be created to send data over UDP so we need to insert Now a method (function) must be created to send data over UDP so we need to insert
Line 328: Line 328:
  
 Finally we must listen for incoming UDP messages and act accordingly.  The asyncUDPSocket library provides us with methods to over ride to do just that.  Finally we must listen for incoming UDP messages and act accordingly.  The asyncUDPSocket library provides us with methods to over ride to do just that. 
- +
   (BOOL)onUdpSocket:(AsyncUdpSocket *)sock   (BOOL)onUdpSocket:(AsyncUdpSocket *)sock
        didReceiveData:(NSData *)data        didReceiveData:(NSData *)data
Line 336: Line 336:
  
 In **AppDelegate.m:** In **AppDelegate.m:**
 +
   (BOOL)onUdpSocket:(AsyncUdpSocket *)sock   (BOOL)onUdpSocket:(AsyncUdpSocket *)sock
        didReceiveData:(NSData *)data        didReceiveData:(NSData *)data
drexel_duct_navigator_gui.1478577399.txt.gz · Last modified: by dwallace