This is my first program and I really don't have any experience with any language other than HTML and JavaScript. It needs to communicate with a serial device, but after reading online a while I haven't found any good way to go about this. I need my program to connect to /dev/tty.Icon322\ Control and then send it AT+CSQ. It will then return something like this:
I then need to set the 14 to an int called RSSI. Once I can do this, then I can do other things such as SIM PIN and initiate a data connection to have internet with AT+CGACT=1,1 ect.
So far everything works without any errors or warnings, here is what I have so far:
Code:
+CSQ: 14,0
OK
So far everything works without any errors or warnings, here is what I have so far:
Code:
- (IBAction)getSignalStrength:(id)sender{
/*
Here comes the hard part, this is where it checks the signal from the device.
*/
int RSSI = ;//The signal that is retrieved.
int calculatedSignal = RSSI * 2 - 113;
[signalStrength setIntValue:(int)calculatedSignal];
fivebars = [NSImage imageNamed:@"fivebars.png"];
fourbars = [NSImage imageNamed:@"fourbars.png"];
threebars = [NSImage imageNamed:@"threebars.png"];
twobars = [NSImage imageNamed:@"twobars.png"];
onebar = [NSImage imageNamed:@"onebar.png"];
if (calculatedSignal < -106) {
[imageView setImage:(NSImage *)onebar];
}
else if (calculatedSignal < -98) {
[imageView setImage:(NSImage *)twobars];
}
else if (calculatedSignal < -90) {
[imageView setImage:(NSImage *)threebars];
}
else if (calculatedSignal < -82) {
[imageView setImage:(NSImage *)fourbars];
}
else if (calculatedSignal > -82) {
[imageView setImage:(NSImage *)fivebars];
}
}