//
//  PIDF-LO-Client.m
//  NG911
//
//  Created by Mason Silber on 11/5/11.
//  Copyright (c) 2011 Columbia University. All rights reserved.
//

#import "PIDF-LO-Client.h"

@implementation PIDF_LO_Client
@synthesize location;

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

// initialize the PIDF_LO_CLIENT object with a location.

-(id)initWithLocation:(CLLocation *)aLocation
{
    self = [super init];
    if(self)
    {
        location = [aLocation copy];
    }
    
    return self;
}


// returns the XML string with the location that the object was initialized with in initWithLocation:
-(NSString *)constructXML
{
    NSString *xml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
                     "<presence>\n"
                     "<device>\n"
                     "<geopriv>\n"
                     "<location-info>\n"
                     "<gml:pos>"
                     "%f %f"
                     "</gml:pos>"
                     "</location-info>\n"
                     "<usage-rules>\n"
                     "</usage-rules>\n"
                     "</geopriv>\n"
                     "</device>\n"
                     "</presence>",location.coordinate.latitude,location.coordinate.longitude];
    
    return xml;
}

@end
