/* Copyright (c) 2011, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of The Linux Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef LOC_API_ADAPTER_H #define LOC_API_ADAPTER_H #include #include #include #include #include #include #include "platform_lib_includes.h" #define MAX_APN_LEN 100 #define MAX_URL_LEN 256 #define smaller_of(a, b) (((a) > (b)) ? (b) : (a)) enum loc_api_adapter_err { LOC_API_ADAPTER_ERR_SUCCESS = 0, LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1, LOC_API_ADAPTER_ERR_UNSUPPORTED = 2, LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4, LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5, LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6, LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7, LOC_API_ADAPTER_ERR_TIMEOUT = 8, LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9, LOC_API_ADAPTER_ERR_ENGINE_DOWN = 100, LOC_API_ADAPTER_ERR_FAILURE, LOC_API_ADAPTER_ERR_UNKNOWN }; enum loc_api_adapter_event_index { LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state LOC_API_ADAPTER_EVENT_MAX }; #define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<