objc

examples/Network/scan/main.m
@interface MyAppDelegate : NXObject <ApplicationDelegate, WirelessDelegate> {
}
@end
@implementation MyAppDelegate
- (void)applicationDidFinishLaunching:(id)application {
(void)application; // Unused parameter
// Initialize the wireless manager
if (wifi == nil) {
NXLog(@"WiFi not supported on this board");
[application terminateWithExitStatus:-1];
return;
}
// Set the delegate for wireless events
[wifi setDelegate:self];
// Start scanning for Wi-Fi networks
[wifi scan];
}
- (void)applicationReceivedSignal:(NXApplicationSignal)signal {
// Handle the received signal
NXLog(@"Application received signal: %d", (int)signal);
// Terminate the application
}
- (void)scanDidDiscoverNetwork:(NXWirelessNetwork *)network {
NXLog(@"Scan: %@", network);
}
- (void)scanDidComplete {
NXLog(@"Scan completed.");
}
@end
int main(int argc, char *argv[]) {
// Initialize the NXApplication framework
return NXApplicationMain(argc, argv, [MyAppDelegate class],
}