//
//  OsdViewController.m
//  iKopter
//
//  Created by Frank Blumenberg on 06.07.10.
//  Copyright 2010 de.frankblumenberg. All rights reserved.
//

#import "OsdViewController.h"
#import "OsdValue.h"

@implementation OsdViewController

@synthesize errorCode;

- (void) viewDidAppear:(BOOL)animated {

  osdValue = [[OsdValue alloc] init];
  osdValue.delegate = self;
}

- (void) viewWillDisappear:(BOOL)animated {
  [osdValue release];
}  


- (void) newValue:(NaviData_t *)data {
  
  NSMutableString* info=[NSMutableString stringWithString:@"INFO\r\n"];
  
  [info appendFormat:@"SatsInUse: %d\r\n",data->SatsInUse];
  [info appendFormat:@"Altimeter: %d\r\n",data->Altimeter];
  [info appendFormat:@"Variometer: %d\r\n",data->Variometer];
  [info appendFormat:@"FlyingTime: %d\r\n",data->FlyingTime];
  [info appendFormat:@"UBat: %d\r\n",data->UBat];
  [info appendFormat:@"Heading: %d\r\n",data->Heading];
  [info appendFormat:@"CompassHeading: %d\r\n",data->CompassHeading];
  [info appendFormat:@"AngleNick: %d\r\n",data->AngleNick];
  [info appendFormat:@"AngleRoll: %d\r\n",data->AngleRoll];
  [info appendFormat:@"RC_Quality: %d\r\n",data->RC_Quality];
  [info appendFormat:@"FCFlags: %d\r\n",data->FCFlags];
  [info appendFormat:@"NCFlags: %d\r\n",data->NCFlags];
  [info appendFormat:@"Errorcode: %d\r\n",data->Errorcode];
  [info appendFormat:@"RC_RSSI: %d\r\n",data->RC_RSSI];
  [info appendFormat:@"Current: %d\r\n",data->Current];
  [info appendFormat:@"UsedCapacity: %d\r\n",data->UsedCapacity];
  
  errorCode.text = info;
  
  rotateX = data->AngleRoll;
  rotateY = data->AngleNick;
}

- (void)drawRect:(CGRect)rect {
  
}


/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/



- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
