text:
Bungala Solar Project achieves several 'clean energy' firsts in Australia
Aurecon will provide design services for the first two phases of the Bungala Solar project
25 May 2017 - Australia has taken another significant step forward in improving its reliance on clean energy with the recent financial close of the first of two phases of the 300 MWac Bungala Solar Photovoltaic (PV) project near Port Augusta, South Australia.
The project, which is being sold to two of Europe's biggest investors in renewables, the Italian Enel Green Energy and the Dutch Infrastructure Fund, has achieved several industry 'firsts'. One of several large-scale solar projects proposed for South Australia, it will be the first to begin construction. It is also amongst the first large solar farms to participate in Australia's frequency control and ancillary services (FCAS) market, using inverter technology to provide voltage control for the grid.
Once fully operational, the project will generate sufficient energy for approximately 130 000 homes and assist the grid with ancillary services.
Global engineering and infrastructure advisory company Aurecon has been engaged by the EPC contractor Green Light Contractors, subsidiary of Elecnor Australia, to provide design services for Phases One and Two of the solar farm, including preparation of management plans as well as assisting with commissioning of the project.
These phases of the Bungala Solar Project form part of a number of large scale solar farms to be built in Australia in 2018. Next year, six new large scale solar farms in Queensland, five in New South Wales and one in Western Australia are set to be constructed.
"The Bungala Solar Project will support Australia's commitment to a greener economy and create a number of jobs in the Port Augusta region for years to come. The project is being fast-tracked and we will be able to see the tangible results within a short amount of time, with the first electricity to be supplied to the grid by the first quarter of next year, with 220 MWac being fully operational by the third quarter 2018," says Aurecon's Loni Karabesinis, Technical Director for Energy. "Importantly, the Bungala Solar Project will be designed and built battery storage ready and will ensure the region is geared for future population growth," he adds.
"Large scale solar PV is one of the most cost-effective forms of energy in the long term, particularly in regions that have historically relied on coal-fired energy sources. Not only are solar PV projects cost-competitive when compared to new build conventional power stations, but they will be future-proofing the communities that they supply, without having a negative impact on the environment," says Karabesinis.
Renewable energy becoming less dependent on subsidies and government support
In the past, renewable energy technology, skills and expertise often made large scale wind and solar projects cost prohibitive. It was common practice for governments to have to support projects financially or enter into a Public Private Partnership to bring solar projects to fruition. What makes the Bungala Solar PV project a notable achievement is that both Bungala Solar One and Bungala Solar Two are being delivered without financial support from government. Renewable operator, Enel Green Power, and fund management company, Dutch Infrastructure Fund, were key to the financial planning of the project.
"Bungala Solar One is the largest equity and debt financial arrangement in Australia for a solar PV project, which shows what can be achieved when experienced professionals are involved in all aspects of such an ambitious project," adds Karabesinis.
The new policy direction outlined in the 2017-2018 Australian Federal Budget has also marked a distinct move away from the bipartisan market led approach to one of targeted direct intervention in the energy sector. Dr Alex Wonhas, Aurecon's Managing Director, Energy, Resources & Manufacturing, says the growth of solar will become increasingly less dependent on subsidies as new technologies to balance supply and demand – including batteries, improved transmission networks and demand side responses – have now reached a tipping point of being cost competitive with conventional power stations.
"If the Government aims to make these investments without spending unnecessary funds, it will become crucial to obtain 'proven business cases' for each investment that compares this particular investment with all key alternatives," says Wonhas.
With initiatives such as the Bungala Solar PV project successfully underway, the focus will now shift to effective storage and transport of renewable energy.
Building on successful solar partnerships
Aurecon and Green Light Contractors have formed a successful working relationship on a number of solar projects in Australia. The teams recently joined forces to complete the Barcaldine Solar Farm in Queensland under tight deadlines.
Aurecon's breadth of design disciplines across market sectors such as geotechnical investigations, civil, electrical and mechanical engineering, combined with an ability to draw upon its global pool of solar energy and engineering expertise, places the company in the ideal position to help contractors who are working towards the goal of tripling Australia's large-scale solar capacity over the next year. .
"Aurecon is proud to be a part of the transformation of Australia's energy sector and we are honoured to be a part of a project that will add value to the lives of the people in Port Augusta," concludes Karabesinis.
A paradigm shift in energy policy signals 'good' energy
Aurecon's Dr Alex Wonhas discusses the policy direction outlined in the 2017-2018 Australian Federal Budget.
Aurecon helps transform Australia's energy landscape
Australia's energy landscape transformation moves forward with the completion of the Barcaldine Solar Farm in Queensland.


text:
@interface EPSDevicePlugin() <EPSDeviceDelegate>
{
    EPSDevice *epsDevice;

    NSString *callbackId;
}

@end

@implementation EPSDevicePlugin

-(void)_init
{
    epsDevice = nil;

    callbackId = nil;
}

#if 0
-(id)init
{
    if ((self = [super init]) != nil)
    {
        [self _init];
    }

    return self;
}

-(CDVPlugin *)initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings
{
    if ((self = [super initWithWebView: theWebView settings: classSettings]) != nil)
    {
        [self _init];
    }

    return self;
}

-(CDVPlugin *)initWithWebView:(UIWebView*)theWebView
{
    if ((self = [super initWithWebView: theWebView]) != nil)
    {
        [self _init];
    }

    return self;
}
#else
- (void)pluginInitialize
{
    [super pluginInitialize];

    [self _init];
}
#endif

///
/// \brief The JavaScript side has started
///
/// This method serves no purpose other than passing a callback ID for passing events back to the JavaScript side.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
-(void)start:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    callbackId = [command.callbackId copy];
}

///
/// \brief The JavaScript side has stopped
///
/// This method indicates there are no more subscribers to any events on the JavaScript side.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
-(void)stop:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    callbackId = nil;
}

///
/// \brief EPSDevice deviceDidConnect delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceConnected' to the JavaScript side.
///
-(void)device:(EPSDevice *)device deviceDidConnect:(EPSDeviceType)type description:(NSString *)description capabilities:(EPSDeviceCapability)capabilities serialNumber:(NSString *)serialNumber error:(NSError *)error
{
#ifdef DEBUG
    NSLog(@"%s: desc=%@", __FUNCTION__, description);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    if (error != nil)
    {
        NSMutableDictionary *eventError;

        eventError = [NSMutableDictionary dictionary];

        eventError[@"code"] = [NSNumber numberWithInt: error.code];

        if (error.localizedDescription != nil)
        {
            eventError[@"description"] = error.localizedDescription;
        }
        else
        {
            eventError[@"description"] = [NSString stringWithFormat: @"ERROR CODE %d", error.code];
        }

        event[@"error"] = eventError;
    }
    else
    {
        NSMutableDictionary *eventData;

        eventData = [NSMutableDictionary dictionary];

        eventData[@"type"] = [NSNumber numberWithInt: type];

        eventData[@"description"] = description;

        eventData[@"capabilities"] = [NSNumber numberWithInt: capabilities];

        if (serialNumber != nil)
        {
            eventData[@"serialNumber"] = serialNumber;
        }

        event[@"data"] = eventData;
    }

    [self fireEvent: @"onEPSDeviceConnected" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice deviceDidConnect delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceConnected' to the JavaScript side.
///
-(void)device:(EPSDevice *)device deviceDidDisconnect:(NSError *)error
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    if (error != nil)
    {
        NSMutableDictionary *eventError;

        eventError = [NSMutableDictionary dictionary];

        eventError[@"code"] = [NSNumber numberWithInt: error.code];

        if (error.localizedDescription != nil)
        {
            eventError[@"description"] = error.localizedDescription;
        }
        else
        {
            eventError[@"description"] = [NSString stringWithFormat: @"ERROR CODE %d", error.code];
        }

        event[@"error"] = eventError;
    }

    [self fireEvent: @"onEPSDeviceDisconnected" callbackId: callbackId data: event];
}

///
/// \brief Start the device connection
///
/// This method is analogous to the startConnection method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_OK.
///
-(void)startConnection:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    if (epsDevice == nil)
    {
        epsDevice = [EPSDevice sharedDevice];

        [epsDevice addDelegate: self];
    }

    BOOL doConnected;

    doConnected = NO;

    if (epsDevice.isConnected)
    {
        doConnected = YES;
    }
    else
    {
        [epsDevice startConnection];
    }

    CDVPluginResult* pluginResult;

    pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];

    if (doConnected)
    {
        [self device: epsDevice deviceDidConnect: epsDevice.deviceType description: epsDevice.deviceDescription capabilities: epsDevice.deviceCapabilities serialNumber: epsDevice.deviceSerialNumber error: nil];
    }
}

///
/// \brief Stop the device connection
///
/// This method is analogous to the stopConnection method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized. Otherwise, CDVCommandStatus_OK.
///
-(void)stopConnection:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief EPSDevice barcode reader didReceiveData delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBarcodeReaderData' to the JavaScript side.
///
-(void)device:(EPSDevice *)device barcodeReader:(EPSDeviceBarcodeReader *)barcodeReader didReceiveData:(EPSDeviceBarcodeType)type data:(NSString *)data
{
#ifdef DEBUG
    NSLog(@"%s: data=%@", __FUNCTION__, data);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"type"] = [NSNumber numberWithInt: type];

    eventData[@"data"] = data;

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBarcodeReaderData" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice barcode reader didReceiveButtonPress delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBarcodeReaderButtonPress' to the JavaScript side.
///
-(void)device:(EPSDevice *)device barcodeReader:(EPSDeviceBarcodeReader *)barcodeReader didReceiveButtonPress:(EPSDeviceBarcodeReaderButtonType)button
{
#ifdef DEBUG
    NSLog(@"%s: but=%d", __FUNCTION__, button);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"button"] = [NSNumber numberWithInt: button];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBarcodeReaderButtonPress" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice barcode reader didReceiveButtonRelease delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBarcodeReaderButtonRelease' to the JavaScript side.
///
-(void)device:(EPSDevice *)device barcodeReader:(EPSDeviceBarcodeReader *)barcodeReader didReceiveButtonRelease:(EPSDeviceBarcodeReaderButtonType)button
{
#ifdef DEBUG
    NSLog(@"%s: but=%d", __FUNCTION__, button);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"button"] = [NSNumber numberWithInt: button];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBarcodeReaderButtonRelease" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice barcode reader didReceiveError delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBarcodeReaderError' to the JavaScript side.
///
-(void)device:(EPSDevice *)device barcodeReader:(EPSDeviceBarcodeReader *)barcodeReader didReceiveError:(NSError *)error
{
#ifdef DEBUG
    NSLog(@"%s: err=%d", __FUNCTION__, error.code);
#endif

    [barcodeReader disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    if (error != nil)
    {
        NSMutableDictionary *eventError;

        eventError = [NSMutableDictionary dictionary];

        eventError[@"code"] = [NSNumber numberWithInt: error.code];

        if (error.localizedDescription != nil)
        {
            eventError[@"description"] = error.localizedDescription;
        }
        else
        {
            eventError[@"description"] = [NSString stringWithFormat: @"ERROR CODE %d", error.code];
        }

        event[@"error"] = eventError;
    }

    [self fireEvent: @"onEPSDeviceBarcodeReaderError" callbackId: callbackId data: event];
}

///
/// \brief Enables the barcode reader
///
/// This method is analogous to the barcode reader enable method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support barcode input, the barcode reader has not been initialized, or there is an error enabling the barcode reader. Otherwise, CDVCommandStatus_OK.
///
-(void)barcodeEnable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBarcodeReader) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support barcode input"];
    }
    else if (epsDevice.barcodeReader == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device barcode reader not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.barcodeReader enable: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Disable the barcode reader
///
/// This method is analogous to the barcode reader disable method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support barcode input, the barcode reader has not been initialized, or there is an error disabling the barcode reader. Otherwise, CDVCommandStatus_OK.
///
-(void)barcodeDisable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBarcodeReader) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support barcode input"];
    }
    else if (epsDevice.cardReader == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device barcode reader not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.barcodeReader disable: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Start a barcode
///
/// This method is analogous to the barcode reader startScan method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support barcode input, or the barcode reader has not been initialized,. Otherwise, CDVCommandStatus_OK.
///
-(void)barcodeStartScan:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBarcodeReader) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support barcode input"];
    }
    else if (epsDevice.barcodeReader == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device barcode reader not initialized"];
    }
    else
    {
        [epsDevice.barcodeReader startScan];

        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Stop the barcode scan
///
/// This method is analogous to the barcode reader stopScan method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support barcode input, or the barcode reader has not been initialized. Otherwise, CDVCommandStatus_OK.
///
-(void)barcodeStopScan:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBarcodeReader) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support barcode input"];
    }
    else if (epsDevice.barcodeReader == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device barcode reader not initialized"];
    }
    else
    {
        [epsDevice.barcodeReader stopScan];

        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief EPSDevice battery batteryChargeStateDidChange delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBatteryChargeStateChanged' to the JavaScript side.
///
-(void)device:(EPSDevice *)device battery:(EPSDeviceBattery *)battery batteryChargeStateDidChange:(BOOL)charging chargingiOSDevice:(BOOL)chargingiOSDevice chargeLevel:(int)chargeLevel voltage:(float)voltage
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"charging"] = [NSNumber numberWithBool: charging];

    eventData[@"chargingDevice"] = [NSNumber numberWithBool: chargingiOSDevice];

    eventData[@"chargeLevel"] = [NSNumber numberWithInt: chargeLevel];

    eventData[@"voltage"] = [NSNumber numberWithFloat: voltage];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBatteryChargeStateChanged" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice battery batteryChargeLevelDidChange delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBatteryChargeLevelChanged' to the JavaScript side.
///
-(void)device:(EPSDevice *)device battery:(EPSDeviceBattery *)battery batteryChargeLevelDidChange:(BOOL)charging chargingiOSDevice:(BOOL)chargingiOSDevice chargeLevel:(int)chargeLevel voltage:(float)voltage
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"charging"] = [NSNumber numberWithBool: charging];

    eventData[@"chargingDevice"] = [NSNumber numberWithBool: chargingiOSDevice];

    eventData[@"chargeLevel"] = [NSNumber numberWithInt: chargeLevel];

    eventData[@"voltage"] = [NSNumber numberWithFloat: voltage];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBatteryChargeLevelChanged" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice battery batteryVoltageLevelDidChange delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBatteryVoltageLevelChanged' to the JavaScript side.
///
-(void)device:(EPSDevice *)device battery:(EPSDeviceBattery *)battery batteryVoltageLevelDidChange:(BOOL)charging chargingiOSDevice:(BOOL)chargingiOSDevice chargeLevel:(int)chargeLevel voltage:(float)voltage
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"charging"] = [NSNumber numberWithBool: charging];

    eventData[@"chargingDevice"] = [NSNumber numberWithBool: chargingiOSDevice];

    eventData[@"chargeLevel"] = [NSNumber numberWithInt: chargeLevel];

    eventData[@"voltage"] = [NSNumber numberWithFloat: voltage];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBatteryVoltageLevelChanged" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice battery batteryChargeLevelDidReachFull delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBatteryChargeReachedFull' to the JavaScript side.
///
-(void)device:(EPSDevice *)device battery:(EPSDeviceBattery *)battery batteryChargeLevelDidReachFull:(BOOL)charging chargingiOSDevice:(BOOL)chargingiOSDevice chargeLevel:(int)chargeLevel voltage:(float)voltage
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"charging"] = [NSNumber numberWithBool: charging];

    eventData[@"chargingDevice"] = [NSNumber numberWithBool: chargingiOSDevice];

    eventData[@"chargeLevel"] = [NSNumber numberWithInt: chargeLevel];

    eventData[@"voltage"] = [NSNumber numberWithFloat: voltage];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBatteryChargeReachedFull" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice battery batteryChargeLevelDidReachCritical delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceBatteryChargeReachedCritical' to the JavaScript side.
///
-(void)device:(EPSDevice *)device battery:(EPSDeviceBattery *)battery batteryChargeLevelDidReachCritical:(BOOL)charging chargingiOSDevice:(BOOL)chargingiOSDevice chargeLevel:(int)chargeLevel voltage:(float)voltage
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"charging"] = [NSNumber numberWithBool: charging];

    eventData[@"chargingDevice"] = [NSNumber numberWithBool: chargingiOSDevice];

    eventData[@"chargeLevel"] = [NSNumber numberWithInt: chargeLevel];

    eventData[@"voltage"] = [NSNumber numberWithFloat: voltage];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceBatteryChargeReachedCritical" callbackId: callbackId data: event];
}

///
/// \brief Enables the device battery functionality
///
/// This method is analogous to the battery enable method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support battery, the battery has not been initialized, or there is an error enabling the battery. Otherwise, CDVCommandStatus_OK.
///
-(void)batteryEnable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif
    BOOL doBattery;

    doBattery = NO;

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBatteryCanChargeiOSDevice) == 0 &&
             (epsDevice.deviceCapabilities & EPSDeviceCapabilityBatteryStatus) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support battery"];
    }
    else if (epsDevice.battery == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device battery not initialized"];
    }
    else if (epsDevice.battery.isEnabled)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];

        doBattery = YES;
    }
    else
    {
        NSError *err;

        if ([epsDevice.battery enable: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];

    if (doBattery)
    {
        [self device: epsDevice battery: epsDevice.battery batteryVoltageLevelDidChange: epsDevice.battery.isCharging chargingiOSDevice: epsDevice.battery.isChargingiOSDevice chargeLevel: epsDevice.battery.chargeLevel voltage: epsDevice.battery.voltage];
    }
}

///
/// \brief Disable the devices battery functionality
///
/// This method is analogous to the battery disable method in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support battery, the battery has not been initialized, or there is an error disabling the battery. Otherwise, CDVCommandStatus_OK.
///
-(void)batteryDisable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBatteryCanChargeiOSDevice) == 0 &&
             (epsDevice.deviceCapabilities & EPSDeviceCapabilityBatteryStatus) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support battery"];
    }
    else if (epsDevice.battery == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device battery not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.battery disable: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Enables charging the device
///
/// This method is analogous to the battery enableChargeiOSDevice in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support charging the iOS device, the battery has not been initialized, or there is an error enabling charging the iOS device. Otherwise, CDVCommandStatus_OK.
///
-(void)batteryEnableChargeDevice:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBatteryCanChargeiOSDevice) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support battery charge iOS device"];
    }
    else if (epsDevice.battery == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device battery not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.battery enableChargeiOSDevice: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Disables charging the device
///
/// This method is analogous to the battery disableChargeiOSDevice in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support charging the iOS device, the battery has not been initialized, or there is an error disabling charging the iOS device. Otherwise, CDVCommandStatus_OK.
///
-(void)batteryDisableChargeDevice:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityBatteryCanChargeiOSDevice) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support battery charge iOS device"];
    }
    else if (epsDevice.battery == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device battery not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.battery disableChargeiOSDevice: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief EPSDevice card reader didReceiveSwipedInput delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceCardReaderSwipedInput' to the JavaScript side.
///
-(void)device:(EPSDevice *)device cardReader:(EPSDeviceCardReader *)cardReader didReceiveSwipedInput:(NSString *)raw uses:(EPSDeviceCardDataUse)uses track1:(EPSDeviceCardDataTrack *)track1 track2:(EPSDeviceCardDataTrack *)track2 track3:(EPSDeviceCardDataTrack *)track3
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    [cardReader disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"raw"] = raw;

    eventData[@"uses"] = [NSNumber numberWithInt: uses];

    NSMutableDictionary *eventTrack;

    if (track1 != nil)
    {
        eventTrack = [NSMutableDictionary dictionary];

        eventTrack[@"status"] = [NSNumber numberWithInt: track1.status];

        if (track1.data != nil)
        {
            eventTrack[@"data"] = track1.data;

            if (uses & EPSDeviceCardDataUseClearParts)
            {
                EPSDeviceCardDataFinancialTrack1 *t1;

                if ((t1 = [[EPSDeviceCardDataFinancialTrack1 alloc] initWithTrackData: track1]).dataNoSentinels != nil)
                {
                    eventTrack[@"dataNoSentinels"] = t1.dataNoSentinels;
                }
            }
        }

        if (track1.encryptedData != nil)
        {
            eventTrack[@"encryptedData"] = track1.encryptedData;
        }

        if (track1.keySerialNumber != nil)
        {
            eventTrack[@"keySerialNumber"] = track1.keySerialNumber;
        }

        eventTrack[@"encryptedFormat"] = [NSNumber numberWithInt: track1.encryptedFormat];

        eventData[@"track1"] = eventTrack;
    }

    if (track2 != nil)
    {
        eventTrack = [NSMutableDictionary dictionary];

        eventTrack[@"status"] = [NSNumber numberWithInt: track2.status];

        if (track2.data != nil)
        {
            eventTrack[@"data"] = track2.data;

            if (uses & EPSDeviceCardDataUseClearParts)
            {
                EPSDeviceCardDataFinancialTrack2 *t2;

                if ((t2 = [[EPSDeviceCardDataFinancialTrack2 alloc] initWithTrackData: track2]).dataNoSentinels != nil)
                {
                    eventTrack[@"dataNoSentinels"] = t2.dataNoSentinels;
                }
            }
        }

        if (track2.encryptedData != nil)
        {
            eventTrack[@"encryptedData"] = track2.encryptedData;
        }

        if (track2.keySerialNumber != nil)
        {
            eventTrack[@"keySerialNumber"] = track2.keySerialNumber;
        }

        eventTrack[@"encryptedFormat"] = [NSNumber numberWithInt: track2.encryptedFormat];

        eventData[@"track2"] = eventTrack;
    }

    if (track3 != nil)
    {
        eventTrack = [NSMutableDictionary dictionary];

        eventTrack[@"status"] = [NSNumber numberWithInt: track3.status];

        if (track3.data != nil)
        {
            eventTrack[@"data"] = track3.data;
        }

        if (track3.encryptedData != nil)
        {
            eventTrack[@"encryptedData"] = track3.encryptedData;
        }

        if (track3.keySerialNumber != nil)
        {
            eventTrack[@"keySerialNumber"] = track3.keySerialNumber;
        }

        eventTrack[@"encryptedFormat"] = [NSNumber numberWithInt: track3.encryptedFormat];

        eventData[@"track3"] = eventTrack;
    }

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceCardReaderSwipedInput" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice card reader didReceiveManualInput delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceCardReaderManualInput' to the JavaScript side.
///
-(void)device:(EPSDevice *)device cardReader:(EPSDeviceCardReader *)cardReader didReceiveManualInput:(NSString *)raw uses:(EPSDeviceCardDataUse)uses manual:(EPSDeviceCardDataManual *)manual
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    [cardReader disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"raw"] = raw;

    eventData[@"uses"] = [NSNumber numberWithInt: uses];

    NSMutableDictionary *eventTrack;

    if (manual != nil)
    {
        eventTrack = [NSMutableDictionary dictionary];

        eventTrack[@"status"] = [NSNumber numberWithInt: manual.status];

        if (manual.accountNumber != nil)
        {
            eventTrack[@"accountNumber"] = manual.accountNumber;
        }

        if (manual.expirationDate != nil)
        {
            eventTrack[@"expirationDate"] = manual.expirationDate;
        }

        eventTrack[@"securityCodeStatus"] = [NSNumber numberWithInt: manual.securityCodeStatus];

        if (manual.securityCode != nil)
        {
        eventTrack[@"securityCode"] = manual.securityCode;
        }

        if (manual.encryptedData != nil)
        {
            eventTrack[@"encryptedData"] = manual.encryptedData;
        }

        if (manual.keySerialNumber != nil)
        {
            eventTrack[@"keySerialNumber"] = manual.keySerialNumber;
        }

        eventTrack[@"encryptedFormat"] = [NSNumber numberWithInt: manual.encryptedFormat];

        eventData[@"manual"] = eventTrack;
    }

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceCardReaderManualInput" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice card reader didReceiveCancelEntry delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceCardReaderCancelEntry' to the JavaScript side.
///
-(void)device:(EPSDevice *)device cardReader:(EPSDeviceCardReader *)cardReader didReceiveCancelEntry:(NSError *)reason
{
#ifdef DEBUG
    NSLog(@"%s: reason=%d", __FUNCTION__, reason.code);
#endif

    [cardReader disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"reason"] = [NSNumber numberWithInt: reason.code];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDeviceCardReaderCancelEntry" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice card reader didReceiveError delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDeviceCardReaderError' to the JavaScript side.
///
-(void)device:(EPSDevice *)device cardReader:(EPSDeviceCardReader *)cardReader didReceiveError:(NSError *)error
{
#ifdef DEBUG
    NSLog(@"%s: err=%d", __FUNCTION__, error.code);
#endif

    [cardReader disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    if (error != nil)
    {
        NSMutableDictionary *eventError;

        eventError = [NSMutableDictionary dictionary];

        eventError[@"code"] = [NSNumber numberWithInt: error.code];

        if (error.localizedDescription != nil)
        {
            eventError[@"description"] = error.localizedDescription;
        }
        else
        {
            eventError[@"description"] = [NSString stringWithFormat: @"ERROR CODE %d", error.code];
        }

        event[@"error"] = eventError;
    }

    [self fireEvent: @"onEPSDeviceCardReaderError" callbackId: callbackId data: event];
}

///
/// \brief Enables card reader
///
/// This method is analogous to the card reader enable in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support the card reader, the card reader has not been initialized, or there is an error enabling the card reader. Otherwise, CDVCommandStatus_OK.
///
-(void)cardReaderEnable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilitySwipeCardReader) == 0 &&
             (epsDevice.deviceCapabilities & EPSDeviceCapabilityManualCardEntry) == 0 &&
             (epsDevice.deviceCapabilities & EPSDeviceCapabilityContactlessCardReader) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support card input"];
    }
    else if (epsDevice.cardReader == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device card reader not initialized"];
    }
    else
    {
        NSString *prompt;

        prompt = (epsDevice.deviceCapabilities & EPSDeviceCapabilityManualCardEntry) ? @"Swipe or key card" : @"Swipe card";

        BOOL allowManual;

        allowManual = NO;

        BOOL allowTrack1;

        allowTrack1 = YES;

        BOOL allowTrack2;

        allowTrack2 = YES;

        for (int i = 0; i < command.arguments.count; i++)
        {
            switch (i)
            {
                case 0:
                    if ([command.arguments[i] isKindOfClass: [NSString class]])
                    {
                        prompt = (NSString *)command.arguments[i];
                    }
                    break;

                case 1:
                    if ([command.arguments[i] isKindOfClass: [NSNumber class]])
                    {
                        allowManual = ((NSNumber *)command.arguments[i]).boolValue;
                    }
                    break;

                case 2:
                    if ([command.arguments[i] isKindOfClass: [NSNumber class]])
                    {
                        allowTrack1 = ((NSNumber *)command.arguments[i]).boolValue;
                    }
                    break;

                case 3:
                    if ([command.arguments[i] isKindOfClass: [NSNumber class]])
                    {
                        allowTrack2 = ((NSNumber *)command.arguments[i]).boolValue;
                    }
                    break;

                default:
                    break;
            }
        }

        NSError *err;

        if ([epsDevice.cardReader enableWithOptions: prompt allowManual: allowManual allowTrack1: allowTrack1 allowTrack2: allowTrack2 error: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Disables card reader
///
/// This method is analogous to the card reader disable in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support the card reader, the card reader has not been initialized, or there is an error disabling the card reader. Otherwise, CDVCommandStatus_OK.
///
-(void)cardReaderDisable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilitySwipeCardReader) == 0 &&
             (epsDevice.deviceCapabilities & EPSDeviceCapabilityManualCardEntry) == 0 &&
             (epsDevice.deviceCapabilities & EPSDeviceCapabilityContactlessCardReader) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support card input"];
    }
    else if (epsDevice.cardReader == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device card reader not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.cardReader disable: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief EPSDevice PIN pad didReceiveInput delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDevicePinPadInput' to the JavaScript side.
///
-(void)device:(EPSDevice *)device pinPad:(EPSDevicePinPad *)pinPad didReceiveInput:(NSString *)pinBlock keySerialNumber:(NSString *)keySerialNumber
{
#ifdef DEBUG
    NSLog(@"%s:", __FUNCTION__);
#endif

    [pinPad disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"pinBlock"] = pinBlock;

    eventData[@"keySerialNumber"] = keySerialNumber;

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDevicePinPadInput" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice PIN pad didReceiveCancelEntry delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDevicePinPadCancelEntry' to the JavaScript side.
///
-(void)device:(EPSDevice *)device pinPad:(EPSDevicePinPad *)pinPad didReceiveCancelEntry:(NSError *)reason
{
#ifdef DEBUG
    NSLog(@"%s: reason=%d", __FUNCTION__, reason.code);
#endif

    [pinPad disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    NSMutableDictionary *eventData;

    eventData = [NSMutableDictionary dictionary];

    eventData[@"reason"] = [NSNumber numberWithInt: reason.code];

    event[@"data"] = eventData;

    [self fireEvent: @"onEPSDevicePinPadCancelEntry" callbackId: callbackId data: event];
}

///
/// \brief EPSDevice PIN pad didReceiveError delegate method
///
/// For more information, see the EPSDevice framework documentation.
///
/// This method send a 'onEPSDevicePinPadError' to the JavaScript side.
///
-(void)device:(EPSDevice *)device pinPad:(EPSDevicePinPad *)pinPad didReceiveError:(NSError *)error
{
#ifdef DEBUG
    NSLog(@"%s: err=%d", __FUNCTION__, error.code);
#endif

    [pinPad disable: nil];

    NSMutableDictionary *event;

    event = [NSMutableDictionary dictionary];

    if (error != nil)
    {
        NSMutableDictionary *eventError;

        eventError = [NSMutableDictionary dictionary];

        eventError[@"code"] = [NSNumber numberWithInt: error.code];

        if (error.localizedDescription != nil)
        {
            eventError[@"description"] = error.localizedDescription;
        }
        else
        {
            eventError[@"description"] = [NSString stringWithFormat: @"ERROR CODE %d", error.code];
        }

        event[@"error"] = eventError;
    }

    [self fireEvent: @"onEPSDevicePinPadError" callbackId: callbackId data: event];
}

///
/// \brief Enables PIN input
///
/// This method is analogous to the PIN pad enable in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support PIN input, the PIN pad has not been initialized, or there is an error enabling the PIN Pad. Otherwise, CDVCommandStatus_OK.
///
-(void)pinPadEnable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityPinPad) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support PIN input"];
    }
    else if (epsDevice.pinPad == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device PIN pad not initialized"];
    }
    else
    {
        NSString *prompt;

        prompt = @"Enter PIN";

        NSString *account;

        account = nil;

        for (int i = 0; i < command.arguments.count; i++)
        {
            switch (i)
            {
                case 0:
                    if ([command.arguments[i] isKindOfClass: [NSString class]])
                    {
                        prompt = (NSString *)command.arguments[i];
                    }
                    break;

                case 1:
                    if ([command.arguments[i] isKindOfClass: [NSString class]])
                    {
                        account = (NSString *)command.arguments[i];
                    }
                    break;

                default:
                    break;
            }
        }

        NSError *err;

        if ([epsDevice.pinPad enableWithOptions: prompt accountNumber: account error: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}

///
/// \brief Disables PIN input
///
/// This method is analogous to the PIN pad disable in the EPSDevice framework. For more information, see the EPSDevice framework documentation.
///
/// \param command The CDVInvokedUrlCommand object containing information and parameters from the JavaScript side.
///
/// \return CDVCommandStatus_ERROR if the device has not been initialized, the device does not support PIN input, the PIN pad has not been initialized, or there is an error disabling the PIN Pad. Otherwise, CDVCommandStatus_OK.
///
-(void)pinPadDisable:(CDVInvokedUrlCommand*)command
{
#ifdef DEBUG
    NSLog(@"%s: argc=%d cbid=%@", __FUNCTION__, command.arguments.count, command.callbackId);
#endif

    CDVPluginResult* pluginResult;

    if (epsDevice == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device not initialized"];
    }
    else if ((epsDevice.deviceCapabilities & EPSDeviceCapabilityPinPad) == 0)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device does not support card input"];
    }
    else if (epsDevice.pinPad == nil)
    {
        pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @"EPS device card reader not initialized"];
    }
    else
    {
        NSError *err;

        if ([epsDevice.pinPad disable: &err])
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
        }
        else if (err != nil && err.localizedDescription != nil)
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: err.localizedDescription];
        }
        else
        {
            pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: [NSString stringWithFormat: @"ERROR CODE %d", err.code]];
        }
    }

    [self.commandDelegate sendPluginResult: pluginResult callbackId: command.callbackId];
}
@end

redpajama_set_name: RedPajamaGithub


text:
Voices from People's Climate March
From the November-December 2015 issue of News & Letters
Chicago—Hundreds of people joined the People's Climate March here on Oct. 14. It was one of 170 events in 47 states demanding serious action to stem climate change as the world's nation-states prepare for their climate talks in Paris starting Nov. 30. Nationwide, many thousands of people participated, including 1,000 each in Seattle and Miami.
Photo by Franklin Dmitryev for News & Letters
The rallying cry was "Climate Justice!" Unlike many climate change protests of the past, this one featured a strong presence of Black, Latin@, Asian people and workers.
Climate justice was understood by many to include opposing environmental racism, exploitation of workers and many other forms of injustice. As always, there were many young people.
WORKERS ARE CLIMATE ACTIVISTS
The march stopped midway at the Haymarket Memorial, the site of the May 1886 rally for the eight-hour workday that became symbolic of both the repression of the labor movement and May Day as a revolutionary labor holiday. There, one of the speakers was Adriana Alvarez, a McDonald's worker from Cicero, who said: "We have to worry about our children's health and our own health, but we can't afford healthcare and health insurance with the wages we make. That's why low-wage working families and people of color have to do something about this."
Marchers stopped traffic so the march could proceed safely. Photo by Franklin Dmitryev for News & Letters.
Participants held a broad range of views about what is needed to achieve climate justice. While some marchers praised President Obama's executive actions to reduce carbon emissions, many others stressed the need for a much deeper transformation of the economy, and often of the whole society. Here is what some of the marchers told N&L:
A disability rights activist: Climate change and pollution are causing more disabilities that we can prevent. I see it in people I work with in the inner cities, the number of kids with breathing problems, asthma, seizure disorders, things that are related to toxins. There are still kids who have lead poisoning from paint. It's ridiculous that this year we still have this problem.
Speakers and crowd when the march stopped at the Haymarket Monument. Photo by Franklin Dmitryev for News & Letters.
A woman from Oregon: In Oregon we have all kinds of fires and very little rain, and that's usually not the case. Our state is burning up. The Paris summit is about to happen. I'm here to make them listen to the people who want to be heard.
Brandon N.: We're messing up the planet with fossil fuels. The poor are harmed the most. Pollution brings things like asthma. I have asthma myself. My mom thought it was partially because the world was getting more polluted. The wealthiest people are the ones who benefit the most from consuming fossil fuels.
A youth: It's going to be difficult to reverse the really unequal status quo. We aren't just facing climate issues because we haven't figured out how to use alternative energy. People have significant interests in using coal and profiting off the things that ruin the planet. Right now most things in our society are determined by the priorities of the people who are profiting off of things. We need to be prioritizing what is best for most people. We should restructure the economy, our political system, all of our public institutions, and stop privatization.
Many are still trying to work it out, but feel that there is something deeply wrong with a society that is trapped in growth for growth's sake, and that is still built around fracking, mining and burning oil, coal and natural gas, decades after science showed how catastrophic that is likely to be for humanity. Pretty much everyone agreed that the oil and coal companies and others who profit from fossil fuels are the enemy—implicitly going deeper than the official slogan, "To change everything, we need everyone."
—Franklin Dmitryev
This entry was posted in Articles and tagged Adriana Alvarez, Asian Infrastructure Investment Bank, Black, climate change, climate justice, Climate Talks, environmental justice, global warming, Latino, McDonald's, people of color, People's Climate March, youth. Bookmark the permalink.
← The Raza wants theory
Defend Maati Monjib →

redpajama_set_name: RedPajamaCommonCrawl