text:
#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_api_rpc"

#include <unistd.h>
#include <math.h>
#ifndef USE_GLIB
#include <utils/SystemClock.h>
#endif /* USE_GLIB */
#include <LocApiRpc.h>
#include <LocAdapterBase.h>
#include <loc_api_fixup.h>
#include <loc_api_rpc_glue.h>
#include <log_util.h>
#include <loc_log.h>
#include <loc_api_log.h>
#ifdef USE_GLIB
#include <glib.h>
#endif
#include <librpc.h>
#include <platform_lib_includes.h>

using namespace loc_core;

#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
#define XTRA_BLOCK_SIZE                 (3072)
#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
#define LOC_NI_NOTIF_KEY_ADDRESS           "Address"

/*===========================================================================
FUNCTION    loc_event_cb

DESCRIPTION
   This is the callback function registered by loc_open.

DEPENDENCIES
   N/A

RETURN VALUE
   RPC_LOC_API_SUCCESS

SIDE EFFECTS
   N/A

===========================================================================*/
static int32 loc_event_cb
(
    void*                                user,
    rpc_loc_client_handle_type           client_handle,
    rpc_loc_event_mask_type              loc_event,
    const rpc_loc_event_payload_u_type*  loc_event_payload
)
{
    MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event));
    loc_callback_log(loc_event, loc_event_payload);
    int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload);
    EXIT_LOG(%d, ret_val);
    return ret_val;
}

/*===========================================================================
FUNCTION    loc_eng_rpc_global_cb

DESCRIPTION
   This is the callback function registered by loc_open for RPC global events

DEPENDENCIES
   N/A

RETURN VALUE
   RPC_LOC_API_SUCCESS

SIDE EFFECTS
   N/A

===========================================================================*/
static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event)
{
    MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event));
    ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event);
    EXIT_LOG(%p, VOID_RET);
}

const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll =
    LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
    LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
    LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
    LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
    LOC_API_ADAPTER_BIT_IOCTL_REPORT |
    LOC_API_ADAPTER_BIT_STATUS_REPORT |
    LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
    LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;

const rpc_loc_event_mask_type LocApiRpc::locBits[] =
{
    RPC_LOC_EVENT_PARSED_POSITION_REPORT,
    RPC_LOC_EVENT_SATELLITE_REPORT,
    RPC_LOC_EVENT_NMEA_1HZ_REPORT,
    RPC_LOC_EVENT_NMEA_POSITION_REPORT,
    RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST,
    RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST,
    RPC_LOC_EVENT_LOCATION_SERVER_REQUEST,
    RPC_LOC_EVENT_IOCTL_REPORT,
    RPC_LOC_EVENT_STATUS_REPORT,
    RPC_LOC_EVENT_WPS_NEEDED_REQUEST
};

LocApiRpc*
LocApiRpc::createLocApiRpc(const MsgTask* msgTask,
                     LOC_API_ADAPTER_EVENT_MASK_T exMask,
                     ContextBase* context)
{
    if (NULL == msgTask) {
        return NULL;
    }
    return new LocApiRpc(msgTask, exMask, context);
}

// constructor
LocApiRpc::LocApiRpc(const MsgTask* msgTask,
                     LOC_API_ADAPTER_EVENT_MASK_T exMask,
                     ContextBase* context) :
    LocApiBase(msgTask, exMask, context),
    client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
    dataEnableLastSet(-1)
{
    memset(apnLastSet, 0, sizeof(apnLastSet));
    loc_api_glue_init();
}

LocApiRpc::~LocApiRpc()
{
    close();
}

rpc_loc_event_mask_type
LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask)
{
    rpc_loc_event_mask_type newMask = 0;

    for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) {
        if (mask & bit) {
            newMask |= locBits[i];
            mask ^= bit;
        }
    }

    return newMask;
}

rpc_loc_lock_e_type
LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask)
{
    if (isGpsLockAll(lockMask))
        return RPC_LOC_LOCK_ALL;
    if (isGpsLockMO(lockMask))
        return RPC_LOC_LOCK_MI;
    if (isGpsLockMT(lockMask))
        return RPC_LOC_LOCK_MT;
    if (isGpsLockNone(lockMask))
        return RPC_LOC_LOCK_NONE;
    return (rpc_loc_lock_e_type)lockMask;
}

enum loc_api_adapter_err
LocApiRpc::convertErr(int rpcErr)
{
    switch(rpcErr)
    {
    case RPC_LOC_API_SUCCESS:
        return LOC_API_ADAPTER_ERR_SUCCESS;
    case RPC_LOC_API_GENERAL_FAILURE:
        return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
    case RPC_LOC_API_UNSUPPORTED:
        return LOC_API_ADAPTER_ERR_UNSUPPORTED;
    case RPC_LOC_API_INVALID_HANDLE:
        return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
    case RPC_LOC_API_INVALID_PARAMETER:
        return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
    case RPC_LOC_API_ENGINE_BUSY:
        return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
    case RPC_LOC_API_PHONE_OFFLINE:
        return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
    case RPC_LOC_API_TIMEOUT:
        return LOC_API_ADAPTER_ERR_TIMEOUT;
    case RPC_LOC_API_RPC_MODEM_RESTART:
        return LOC_API_ADAPTER_ERR_ENGINE_DOWN;
    case RPC_LOC_API_RPC_FAILURE:
        return LOC_API_ADAPTER_ERR_FAILURE;
    default:
        return LOC_API_ADAPTER_ERR_UNKNOWN;
    }
}

void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event)
{
    static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX;

    switch (event) {
    case RPC_SUBSYSTEM_RESTART_BEGIN:
        if (RPC_LOC_ENGINE_STATE_OFF != last_state) {
            last_state = RPC_LOC_ENGINE_STATE_OFF;
            handleEngineDownEvent();
        }
        break;
    case RPC_SUBSYSTEM_RESTART_END:
        if (RPC_LOC_ENGINE_STATE_ON != last_state) {
            last_state = RPC_LOC_ENGINE_STATE_ON;
            handleEngineUpEvent();
        }
        break;
    }
}

int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle,
                     rpc_loc_event_mask_type loc_event,
                     const rpc_loc_event_payload_u_type* loc_event_payload)
{
    // Parsed report
    if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
    {
        reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u.
                       parsed_location_report);
    }

    // Satellite report
    if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
    {
        reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report);
    }

    // Status report
    if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
    {
        reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report);
    }

    // NMEA
    if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
    {
        reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
    }
    // XTRA support: supports only XTRA download
    if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST)
    {
        if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
            RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
        {
            requestXtraData();
        } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
                   RPC_LOC_ASSIST_DATA_TIME_REQ)
        {
            requestTime();
        } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
                   RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ)
        {
            requestLocation();
        }
    }

    // AGPS data request
    if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
    {
        ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.
                 loc_server_request);
    }

    // NI notify request
    if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
    {
        NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request);
    }

    return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to
    // cause any issues in RPC thread context
}

enum loc_api_adapter_err
LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask)
{
    enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;

    // RPC does not dynamically update the event mask. And in the
    // case of RPC, all we support are positioning (gps + agps)
    // masks anyways, so we simply mask all of them on always.
    // After doing so the first time in a power cycle, we know there
    // will the following if condition will never be true any more.
    mask = maskAll;

    if (mask != mMask) {
        if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
            close();
        }

        mMask = mask;
        // it is important to cap the mask here, because not all LocApi's
        // can enable the same bits, e.g. foreground and bckground.
        client_handle = loc_open(convertMask(mask),
                                 loc_event_cb,
                                 loc_rpc_global_cb, this);

        if (client_handle < 0) {
            mMask = 0;
            client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
            ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE;
        }
    }

    return ret_val;
}

enum loc_api_adapter_err
LocApiRpc::close()
{
    if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
        loc_clear(client_handle);
    }

    loc_close(client_handle);
    mMask = 0;
    client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;

    return LOC_API_ADAPTER_ERR_SUCCESS;
}

enum loc_api_adapter_err
LocApiRpc::startFix(const LocPosMode& posMode) {
   LOC_LOGD("LocApiRpc::startFix() called");
   return convertErr(
       loc_start_fix(client_handle)
       );
}

enum loc_api_adapter_err
LocApiRpc::stopFix() {
   LOC_LOGD("LocApiRpc::stopFix() called");
   return convertErr(
       loc_stop_fix(client_handle)
       );
}

enum loc_api_adapter_err
LocApiRpc::setPositionMode(const LocPosMode& posMode)
{
    rpc_loc_ioctl_data_u_type    ioctl_data;
    rpc_loc_fix_criteria_s_type *fix_criteria_ptr =
        &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
    rpc_loc_ioctl_e_type         ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
    rpc_loc_operation_mode_e_type op_mode;
    int                          ret_val;
    const LocPosMode* fixCriteria = &posMode;

    ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
          (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode);

    switch (fixCriteria->mode)
    {
    case LOC_POSITION_MODE_MS_BASED:
        op_mode = RPC_LOC_OPER_MODE_MSB;
        break;
    case LOC_POSITION_MODE_MS_ASSISTED:
        op_mode = RPC_LOC_OPER_MODE_MSA;
        break;
    case LOC_POSITION_MODE_RESERVED_1:
        op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL;
        break;
    case LOC_POSITION_MODE_RESERVED_2:
        op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL;
        break;
    case LOC_POSITION_MODE_RESERVED_3:
        op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
        break;
    case LOC_POSITION_MODE_RESERVED_4:
    case LOC_POSITION_MODE_RESERVED_5:
        op_mode = RPC_LOC_OPER_MODE_MSA;
        fix_criteria_ptr->preferred_response_time  = 0;
        break;
    default:
        op_mode = RPC_LOC_OPER_MODE_STANDALONE;
    }

    fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
                                   RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
    fix_criteria_ptr->min_interval = fixCriteria->min_interval;
    fix_criteria_ptr->preferred_operation_mode = op_mode;

    fix_criteria_ptr->min_interval = fixCriteria->min_interval;
    fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;

    if (fixCriteria->preferred_accuracy > 0) {
        fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy;
        fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
    }
    if (fixCriteria->preferred_time > 0) {
        fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time;
        fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
    }

    switch (fixCriteria->recurrence) {
    case GPS_POSITION_RECURRENCE_SINGLE:
        fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
        break;
    case GPS_POSITION_RECURRENCE_PERIODIC:
    default:
        fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
        break;
    }
    ioctl_data.disc = ioctl_type;

    ret_val = loc_eng_ioctl (client_handle,
                             ioctl_type,
                             &ioctl_data,
                             LOC_IOCTL_DEFAULT_TIMEOUT,
                             NULL /* No output information is expected*/);

    return convertErr(ret_val);
}

enum loc_api_adapter_err
LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
{
    rpc_loc_ioctl_data_u_type        ioctl_data;
    rpc_loc_assist_data_time_s_type *time_info_ptr;
    rpc_loc_ioctl_e_type             ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME;
    int                              ret_val;

    LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);

    time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time;
    time_info_ptr->time_utc = time;
    time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference);
    time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms

    ioctl_data.disc = ioctl_type;

    ret_val = loc_eng_ioctl (client_handle,
                             ioctl_type,
                             &ioctl_data,
                             LOC_IOCTL_DEFAULT_TIMEOUT,
                             NULL /* No output information is expected*/);

    return convertErr(ret_val);
}

enum loc_api_adapter_err
LocApiRpc::injectPosition(double latitude, double longitude, float accuracy)
{
    /* IOCTL data */
    rpc_loc_ioctl_data_u_type ioctl_data;
    rpc_loc_assist_data_pos_s_type *assistance_data_position =
        &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position;
    int                          ret_val;

    /************************************************
     * Fill in latitude, longitude & accuracy
     ************************************************/

    /* This combo is required */
    assistance_data_position->valid_mask =
        RPC_LOC_ASSIST_POS_VALID_LATITUDE |
        RPC_LOC_ASSIST_POS_VALID_LONGITUDE |
        RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR |
        RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL;

    assistance_data_position->latitude = latitude;
    assistance_data_position->longitude = longitude;
    assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */
    assistance_data_position->confidence_horizontal = 63;  /* 63% (1 std dev) assumed */

    /* Log */
    LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n",
             (double) assistance_data_position->latitude,
             (double) assistance_data_position->longitude,
             (double) assistance_data_position->hor_unc_circular);

    ret_val = loc_eng_ioctl( client_handle,
                             RPC_LOC_IOCTL_INJECT_POSITION,
                             &ioctl_data,
                             LOC_IOCTL_DEFAULT_TIMEOUT,
                             NULL /* No output information is expected*/);
    return convertErr(ret_val);
}

enum loc_api_adapter_err
LocApiRpc::informNiResponse(GpsUserResponseType userResponse,
                                   const void* passThroughData)
{
    rpc_loc_ioctl_data_u_type data;
    rpc_loc_ioctl_callback_s_type callback_payload;

    memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back,
           passThroughData, sizeof (rpc_loc_ni_event_s_type));

    rpc_loc_ni_user_resp_e_type resp;
    switch (userResponse)
    {
    case GPS_NI_RESPONSE_ACCEPT:
        data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
            RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
        break;
    case GPS_NI_RESPONSE_DENY:
        data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
            RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
        break;
    case GPS_NI_RESPONSE_NORESP:
    default:
        data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
            RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
        break;
    }

    return convertErr(
        loc_eng_ioctl(client_handle,
                      RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
                      &data,
                      LOC_IOCTL_DEFAULT_TIMEOUT,
                      &callback_payload)
        );
}

enum loc_api_adapter_err
LocApiRpc::setAPN(char* apn, int len, boolean force)
{
    enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
    int size = sizeof(apnLastSet);
    if (force || memcmp(apnLastSet, apn, size)) {
        if (len < size) {
            // size will be not larger than its original value
            size = len + 1;
        }
        memcpy(apnLastSet, apn, size);

        if (!isInSession()) {
            rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
            ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
            ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
            memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);

            rtv = convertErr(
                loc_eng_ioctl (client_handle,
                               RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
                               &ioctl_data,
                               LOC_IOCTL_DEFAULT_TIMEOUT,
                               NULL)
                );
        }
    }
    return rtv;
}

void LocApiRpc::setInSession(bool inSession)
{
    if (!inSession) {
        enableData(dataEnableLastSet, true);
        setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
    }
}

enum loc_api_adapter_err
LocApiRpc::setServer(const char* url, int len)
{
    rpc_loc_ioctl_data_u_type         ioctl_data;
    rpc_loc_server_info_s_type       *server_info_ptr;
    rpc_loc_ioctl_e_type              ioctl_cmd;

    ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
    ioctl_data.disc = ioctl_cmd;
    server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
    server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
    server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
    server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
#if (AMSS_VERSION==3200)
    server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url;
    server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len;
#else
    strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url,
            sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
#endif /* #if (AMSS_VERSION==3200) */
    LOC_LOGD ("loc_eng_set_server, addr = %s\n", url);

    return convertErr(
        loc_eng_ioctl (client_handle,
                       ioctl_cmd,
                       &ioctl_data,
                       LOC_IOCTL_DEFAULT_TIMEOUT,
                       NULL /* No output information is expected*/)
        );
}

enum loc_api_adapter_err
LocApiRpc::setServer(unsigned int ip, int port, LocServerType type)
{
    rpc_loc_ioctl_data_u_type         ioctl_data;
    rpc_loc_server_info_s_type       *server_info_ptr;
    rpc_loc_ioctl_e_type              ioctl_cmd;

    switch (type) {
    case LOC_AGPS_MPC_SERVER:
        ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR;
        break;
    case LOC_AGPS_CUSTOM_PDE_SERVER:
        ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR;
        break;
    default:
        ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
        break;
    }
    ioctl_data.disc = ioctl_cmd;
    server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
    server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4;
    server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
    server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip;
    server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
    LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port);

    return convertErr(
        loc_eng_ioctl (client_handle,
                       ioctl_cmd,
                       &ioctl_data,
                       LOC_IOCTL_DEFAULT_TIMEOUT,
                       NULL /* No output information is expected*/)
        );
}

enum loc_api_adapter_err
LocApiRpc::enableData(int enable, boolean force)
{
    enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
    if (force || dataEnableLastSet != enable) {
        dataEnableLastSet = enable;

        if (!isInSession()) {
            rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};

            ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
            rtv =  convertErr(
                loc_eng_ioctl (client_handle,
                               RPC_LOC_IOCTL_SET_DATA_ENABLE,
                               &ioctl_data,
                               LOC_IOCTL_DEFAULT_TIMEOUT,
                               NULL)
                );
        }
    }
    return rtv;
}

enum loc_api_adapter_err
LocApiRpc::deleteAidingData(GpsAidingData bits)
{
    rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}};
    ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits;

    return convertErr(
        loc_eng_ioctl (client_handle,
                       RPC_LOC_IOCTL_DELETE_ASSIST_DATA,
                       &ioctl_data,
                       LOC_IOCTL_DEFAULT_TIMEOUT,
                       NULL)
        );
}

void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
{
    LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;

    UlpLocation location = {0};
    GpsLocationExtended locationExtended = {0};

    location.size = sizeof(location);
    locationExtended.size = sizeof(locationExtended);
    if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
    {
        // Process the position from final and intermediate reports
        if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS ||
            location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS)
        {
            // Latitude & Longitude
            if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
                (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) &&
                (location_report_ptr->latitude != 0 ||
                 location_report_ptr->longitude != 0))
            {
                location.gpsLocation.flags    |= GPS_LOCATION_HAS_LAT_LONG;
                location.gpsLocation.latitude  = location_report_ptr->latitude;
                location.gpsLocation.longitude = location_report_ptr->longitude;

                // Time stamp (UTC)
                if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
                {
                    location.gpsLocation.timestamp = location_report_ptr->timestamp_utc;
                }

                // Altitude
                if (location_report_ptr->valid_mask &  RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
                {
                    location.gpsLocation.flags    |= GPS_LOCATION_HAS_ALTITUDE;
                    location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid;
                }

                // Speed
                if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL)
                {
                    location.gpsLocation.flags    |= GPS_LOCATION_HAS_SPEED;
                    location.gpsLocation.speed = location_report_ptr->speed_horizontal;
                }

                // Heading
                if (location_report_ptr->valid_mask &  RPC_LOC_POS_VALID_HEADING)
                {
                    location.gpsLocation.flags    |= GPS_LOCATION_HAS_BEARING;
                    location.gpsLocation.bearing = location_report_ptr->heading;
                }

                // Uncertainty (circular)
                if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
                {
                    location.gpsLocation.flags    |= GPS_LOCATION_HAS_ACCURACY;
                    location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular;
                }

                // Technology Mask

                tech_Mask  |= location_report_ptr->technology_mask;
                //Mark the location source as from GNSS
                location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
                location.position_source = ULP_LOCATION_IS_FROM_GNSS;
                if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
                {
                    locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
                    locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level;
                }

                if (location_report_ptr->valid_mask &  RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
                {
                    locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
                    locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
                }

                if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC)
                {
                   locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
                   locationExtended.vert_unc = location_report_ptr->vert_unc;
                }

                if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC)
                {
                   locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
                   locationExtended.speed_unc = location_report_ptr->speed_unc;
                }

                LOC_LOGV("reportPosition: fire callback\n");
                enum loc_sess_status fixStatus =
                    (location_report_ptr->session_status
                     == RPC_LOC_SESS_STATUS_IN_PROGESS ?
                     LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS);
                LocApiBase::reportPosition(location,
                                           locationExtended,
                                           (void*)location_report_ptr,
                                           fixStatus,
                                           tech_Mask);
            }
        }
        else
        {
            LocApiBase::reportPosition(location,
                                       locationExtended,
                                       NULL,
                                       LOC_SESS_FAILURE);
            LOC_LOGV("loc_eng_report_position: ignore position report "
                     "when session status = %d\n",
                     location_report_ptr->session_status);
        }
    }
    else
    {
        LOC_LOGV("loc_eng_report_position: ignore position report "
                 "when session status is not set\n");
    }
}

void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
{
    QtiGnssSvStatus     SvStatus = {0};
    GpsLocationExtended locationExtended = {0};
    locationExtended.size = sizeof(locationExtended);
    int             num_svs_max = 0;
    const rpc_loc_sv_info_s_type *sv_info_ptr;

    if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
    {
        num_svs_max = gnss_report_ptr->sv_count;
        if (num_svs_max > GPS_MAX_SVS)
        {
            num_svs_max = GPS_MAX_SVS;
        }
    }

    if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
    {
        SvStatus.num_svs = 0;

        for (int i = 0; i < num_svs_max; i++)
        {
            sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
            if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
            {
                if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
                {
                    SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo);
                    SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;

                    // We only have the data field to report gps eph and alm mask
                    if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
                        (sv_info_ptr->has_eph == 1))
                    {
                        SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
                    }

                    if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
                        (sv_info_ptr->has_alm == 1))
                    {
                        SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
                    }

                    if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
                        (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
                    {
                        SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
                    }
                }
                // SBAS: GPS RPN: 120-151,
                // In exteneded measurement report, we follow nmea standard, which is from 33-64.
                else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
                {
                    SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
                }
                // Gloness: Slot id: 1-32
                // In extended measurement report, we follow nmea standard, which is 65-96
                else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
                {
                    if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
                        (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
                    {
                        SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
                    }

                    SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
                }
                // Unsupported SV system
                else
                {
                    continue;
                }
            }

            if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
            {
                SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
            }

            if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
            {
                SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
            }

            if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
            {
                SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
            }

            SvStatus.num_svs++;
        }
    }

    if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
        (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
        (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
    {
        locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
        locationExtended.pdop = gnss_report_ptr->position_dop;
        locationExtended.hdop = gnss_report_ptr->horizontal_dop;
        locationExtended.vdop = gnss_report_ptr->vertical_dop;
    }

    if (SvStatus.num_svs >= 0)
    {
        LocApiBase::reportSv(SvStatus,
                             locationExtended,
                             (void*)gnss_report_ptr);
    }
}

void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
{

    if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
        if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
        {
            LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON);
            LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN);
        }
        else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
        {
            LocApiBase::reportStatus(GPS_STATUS_SESSION_END);
            LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF);
        }
        else
        {
            LocApiBase::reportStatus(GPS_STATUS_NONE);
        }
    }

}

void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
{

#if (AMSS_VERSION==3200)
    LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val,
                           nmea_report_ptr->nmea_sentences.nmea_sentences_len);
#else
    LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences,
                           nmea_report_ptr->length);
    LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n",
             nmea_report_ptr->nmea_sentences[3],
             nmea_report_ptr->nmea_sentences[4],
             nmea_report_ptr->nmea_sentences[5]);
#endif /* #if (AMSS_VERSION==3200) */
}

enum loc_api_adapter_err
LocApiRpc::setXtraData(char* data, int length)
{
    int     rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
    int     total_parts;
    uint8   part;
    uint16  part_len;
    uint16  len_injected;
    rpc_loc_ioctl_data_u_type            ioctl_data;
    rpc_loc_ioctl_e_type                 ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
    rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;

    LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data);

    predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data;
    predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA;
    predicted_orbits_data_ptr->total_size = length;
    total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1;
    predicted_orbits_data_ptr->total_parts = total_parts;

    len_injected = 0; // O bytes injected
    ioctl_data.disc = ioctl_type;

    // XTRA injection starts with part 1
    for (part = 1; part <= total_parts; part++)
    {
        predicted_orbits_data_ptr->part = part;
        predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE;
        if (XTRA_BLOCK_SIZE > (length - len_injected))
        {
            predicted_orbits_data_ptr->part_len = length - len_injected;
        }
        predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
        predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;

        LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n",
                 predicted_orbits_data_ptr->part,
                 total_parts,
                 predicted_orbits_data_ptr->part_len,
                 len_injected);

        if (part < total_parts)
        {
            // No callback in this case
            rpc_ret_val = loc_ioctl (client_handle,
                                     ioctl_type,
                                     &ioctl_data);

            if (rpc_ret_val != RPC_LOC_API_SUCCESS)
            {
                LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
                break;
            }
            //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor
            usleep(10 * 1000);
        }
        else // part == total_parts
        {
            // Last part injection, will need to wait for callback
            if (!loc_eng_ioctl(client_handle,
                               ioctl_type,
                               &ioctl_data,
                               LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
                               NULL))
            {
                rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
            }
            break; // done with injection
        }

        len_injected += predicted_orbits_data_ptr->part_len;
        LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
    }

    return convertErr(rpc_ret_val);
}

/* Request the Xtra Server Url from the modem */
enum loc_api_adapter_err
LocApiRpc::requestXtraServer()
{
    loc_api_adapter_err           err;
    rpc_loc_ioctl_data_u_type     data;
    rpc_loc_ioctl_callback_s_type callback_data;

    err = convertErr(loc_eng_ioctl(client_handle,
                                   RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE,
                                   &data,
                                   LOC_IOCTL_DEFAULT_TIMEOUT,
                                   &callback_data));

    if (LOC_API_ADAPTER_ERR_SUCCESS != err)
    {
        LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err);
        return err;
    }
    else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status)
    {
        LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status);
        return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
    }
    else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type)
    {
        LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type);
        return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
    }
    else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc)
    {
        LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc);
        return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
    }

    reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
                     predicted_orbits_data_source.servers[0],
                     callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
                     predicted_orbits_data_source.servers[1],
                     callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
                     predicted_orbits_data_source.servers[2],
                     255);

    return LOC_API_ADAPTER_ERR_SUCCESS;
}

enum loc_api_adapter_err
LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
{
    rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
   rpc_loc_ioctl_data_u_type           ioctl_data;

    if (AGPS_TYPE_INVALID == agpsType) {
        rpc_loc_server_open_status_s_type  *conn_open_status_ptr =
            &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;

        // Fill in data
        ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
        conn_open_status_ptr->conn_handle = handle;
        conn_open_status_ptr->open_status = open_status;
#if (AMSS_VERSION==3200)
        conn_open_status_ptr->apn_name = apn; /* requires APN */
#else
        if (is_succ) {
            strlcpy(conn_open_status_ptr->apn_name, apn,
                    sizeof conn_open_status_ptr->apn_name);
        } else {
            conn_open_status_ptr->apn_name[0] = 0;
        }
#endif /* #if (AMSS_VERSION==3200) */

        LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n",
                 log_succ_fail_string(is_succ),
                 apn);
    } else {
        rpc_loc_server_multi_open_status_s_type  *conn_multi_open_status_ptr =
            &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status;

        // Fill in data
        ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS;
        conn_multi_open_status_ptr->conn_handle = handle;
        conn_multi_open_status_ptr->open_status = open_status;
        if (is_succ) {
            strlcpy(conn_multi_open_status_ptr->apn_name, apn,
                    sizeof conn_multi_open_status_ptr->apn_name);
        } else {
            conn_multi_open_status_ptr->apn_name[0] = 0;
        }

        switch(bearer)
        {
        case AGPS_APN_BEARER_IPV4:
            conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
            break;
        case AGPS_APN_BEARER_IPV6:
            conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6;
            break;
        case AGPS_APN_BEARER_IPV4V6:
            conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6;
            break;
        default:
            conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
        }

        LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
                 log_succ_fail_string(is_succ),
                 apn,
                 conn_multi_open_status_ptr->pdp_type);
    }

    // Make the IOCTL call
    return convertErr(
        loc_eng_ioctl(client_handle,
                      ioctl_data.disc,
                      &ioctl_data,
                      LOC_IOCTL_DEFAULT_TIMEOUT,
                      NULL)
        );
}

enum loc_api_adapter_err
LocApiRpc::atlCloseStatus(int handle, int is_succ)
{
    rpc_loc_ioctl_data_u_type           ioctl_data;
    ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;

    rpc_loc_server_close_status_s_type *conn_close_status_ptr =
        &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
    conn_close_status_ptr->conn_handle = handle;
    conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;

    // Make the IOCTL call
    return convertErr(
        loc_eng_ioctl(client_handle,
                      ioctl_data.disc,
                      &ioctl_data,
                      LOC_IOCTL_DEFAULT_TIMEOUT,
                      NULL)
        );
}

void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr)
{
    int connHandle;
    AGpsType agps_type;

    LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)",
             loc_get_event_atl_open_name(server_request_ptr->event));
    switch (server_request_ptr->event)
    {
    case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
        connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle;
        if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type
            == RPC_LOC_SERVER_CONNECTION_LBS) {
            agps_type = AGPS_TYPE_SUPL;
            LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n            type - AGPS_TYPE_SUPL\n            handle - %d", connHandle);
        } else {
            agps_type = AGPS_TYPE_WWAN_ANY;
            LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n            type - AGPS_TYPE_WWAN_ANY\n            handle - %d", connHandle);
        }
        requestATL(connHandle, agps_type);
        break;
    case RPC_LOC_SERVER_REQUEST_OPEN:
        connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
        LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n            handle - %d", connHandle);
        requestATL(connHandle, AGPS_TYPE_INVALID);
        break;
    case RPC_LOC_SERVER_REQUEST_CLOSE:
        connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
        LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n            handle - %d", connHandle);
        releaseATL(connHandle);
        break;
    default:
        LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event);
   }
}

void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req)
{
    GpsNiNotification notif = {0};

    switch (ni_req->event)
    {
    case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
    {
        const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req =
            &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
        LOC_LOGI("VX Notification");
        notif.ni_type = GPS_NI_TYPE_VOICE;
        // Requestor ID
        hexcode(notif.requestor_id, sizeof notif.requestor_id,
                vx_req->requester_id.requester_id,
                vx_req->requester_id.requester_id_length);
        notif.text_encoding = 0; // No text and no encoding
        notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme);
        NIEventFillVerfiyType(notif, vx_req->notification_priv_type);
    }
        break;

    case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
    {
        const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req =
            &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
        LOC_LOGI("UMTS CP Notification\n");
        notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE;         // Stores notification text
#if (AMSS_VERSION==3200)
        hexcode(notif.text, sizeof notif.text,
                umts_cp_req->notification_text.notification_text_val,
                umts_cp_req->notification_length);
        hexcode(notif.requestor_id, sizeof notif.requestor_id,
                umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
                umts_cp_req->requestor_id.string_len);
#else
        hexcode(notif.text, sizeof notif.text,
                umts_cp_req->notification_text,
                umts_cp_req->notification_length);
        hexcode(notif.requestor_id, sizeof notif.requestor_id,
                umts_cp_req->requestor_id.requestor_id_string,
                umts_cp_req->requestor_id.string_len);
#endif
        notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme);
        notif.requestor_id_encoding = notif.text_encoding;
        NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type);

        // LCS address (using extras field)
        if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0)
        {
            // Copy LCS Address into notif.extras in the format: Address = 012345
            strlcat(notif.extras, LOC_NI_NOTIF_KEY_ADDRESS, sizeof notif.extras);
            strlcat(notif.extras, " = ", sizeof notif.extras);
            int addr_len = 0;
            const char *address_source = NULL;

#if (AMSS_VERSION==3200)
            address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
#else
            address_source = umts_cp_req->ext_client_address_data.ext_client_address;
#endif /* #if (AMSS_VERSION==3200) */

            char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
            addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source,
                                     umts_cp_req->ext_client_address_data.ext_client_address_len);

            // The address is ASCII string
            if (addr_len)
            {
                strlcat(notif.extras, lcs_addr, sizeof notif.extras);
            }
        }
    }
        break;

    case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
    {
        const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req =
            &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
        LOC_LOGI("SUPL Notification\n");
        notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;

        if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
        {
#if (AMSS_VERSION==3200)
            hexcode(notif.text, sizeof notif.text,
                    supl_req->client_name.client_name_string.client_name_string_val,   /* buffer */
                    supl_req->client_name.string_len                                   /* length */
            );
#else
            hexcode(notif.text, sizeof notif.text,
                            supl_req->client_name.client_name_string,   /* buffer */
                            supl_req->client_name.string_len            /* length */
            );
#endif /* #if (AMSS_VERSION==3200) */
            LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
        }
        else {
            LOC_LOGV("SUPL NI: client_name not present.");
        }

        // Requestor ID
        if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
        {
#if (AMSS_VERSION==3200)
            hexcode(notif.requestor_id, sizeof notif.requestor_id,
                    supl_req->requestor_id.requestor_id_string.requestor_id_string_val,  /* buffer */
                    supl_req->requestor_id.string_len                                    /* length */
                );
#else
            hexcode(notif.requestor_id, sizeof notif.requestor_id,
                    supl_req->requestor_id.requestor_id_string,  /* buffer */
                    supl_req->requestor_id.string_len            /* length */
                );
#endif /* #if (AMSS_VERSION==3200) */
            LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
        }
        else {
            LOC_LOGV("SUPL NI: requestor_id not present.");
        }

        // Encoding type
        if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
        {
            notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme);
            notif.requestor_id_encoding = notif.text_encoding;
        }
        else {
            notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
        }

        NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
    }
        break;

    default:
        LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
        return;
    }

    // this copy will get freed in loc_eng_ni when loc_ni_respond() is called
    rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy));
    memcpy(copy, ni_req, sizeof(*copy));
    requestNiNotify(notif, (const void*)copy);
}

int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification &notif,
                                rpc_loc_ni_notify_verify_e_type notif_priv)
{
   switch (notif_priv)
   {
   case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
       notif.notify_flags = 0;
       notif.default_response = GPS_NI_RESPONSE_NORESP;
       return 1;
   case RPC_LOC_NI_USER_NOTIFY_ONLY:
       notif.notify_flags = GPS_NI_NEED_NOTIFY;
       notif.default_response = GPS_NI_RESPONSE_NORESP;
       return 1;
   case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP:
       notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
       notif.default_response = GPS_NI_RESPONSE_ACCEPT;
       return 1;
   case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP:
       notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
       notif.default_response = GPS_NI_RESPONSE_DENY;
       return 1;
   case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
       notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE;
       notif.default_response = GPS_NI_RESPONSE_NORESP;
       return 1;
   default:
      return 0;
   }
}

enum loc_api_adapter_err
LocApiRpc::setSUPLVersion(uint32_t version)
{
   rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}};
   ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version;
   return convertErr(
       loc_eng_ioctl (client_handle,
                      RPC_LOC_IOCTL_SET_SUPL_VERSION,
                      &ioctl_data,
                      LOC_IOCTL_DEFAULT_TIMEOUT,
                      NULL)
       );
}

GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
{
   switch (loc_encoding)
   {
   case RPC_LOC_NI_SUPL_UTF8:
       return GPS_ENC_SUPL_UTF8;
   case RPC_LOC_NI_SUPL_UCS2:
       return GPS_ENC_SUPL_UCS2;
   case RPC_LOC_NI_SUPL_GSM_DEFAULT:
      return GPS_ENC_SUPL_GSM_DEFAULT;
   case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
      return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
   default:
       return GPS_ENC_UNKNOWN;
   }
}

LocApiBase* getLocApi(const MsgTask* msgTask,
                      LOC_API_ADAPTER_EVENT_MASK_T exMask,
                      ContextBase *context) {
    return new LocApiRpc(msgTask, exMask, context);
}

/*Values for lock
  1 = Do not lock any position sessions
  2 = Lock MI position sessions
  3 = Lock MT position sessions
  4 = Lock all position sessions
*/
int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask)
{
    rpc_loc_ioctl_data_u_type    ioctl_data;
    boolean ret_val;
    LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask);
    ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask);
    ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
    ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
                            RPC_LOC_IOCTL_SET_ENGINE_LOCK,
                            &ioctl_data,
                            LOC_IOCTL_DEFAULT_TIMEOUT,
                            NULL /* No output information is expected*/);

    LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val);
    return (ret_val == TRUE ? 0 : -1);
}

/*
  Returns
  Current value of GPS lock on success
  -1 on failure
*/
int LocApiRpc :: getGpsLock()
{
    rpc_loc_ioctl_data_u_type    ioctl_data;
    rpc_loc_ioctl_callback_s_type callback_payload;
    boolean ret_val;
    int ret=0;
    LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
    ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
                            RPC_LOC_IOCTL_GET_ENGINE_LOCK,
                            &ioctl_data,
                            LOC_IOCTL_DEFAULT_TIMEOUT,
                            &callback_payload);
    if(ret_val == TRUE) {
        ret = (int)callback_payload.data.engine_lock;
        LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret);
    }
    else {
        LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__);
        ret = -1;
    }
    LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
    return ret;
}


Setting "Login as Current User" options via CMD switches and/or GPO settings refuse to take.
I'm having the hardest time getting the Horizon client (4.10) to install with the the Login as current user option available and set as default.
If I manually install the client and select the options it works fine, but if I use the install CMD switches the options are missing.
I've left out the Connection server URL in this example for security reasons.
Here is the GPO settings.
My next plan of action is the set the client to install with out the desktop shortcut, and make a GPO to push the shortcut with the "-logInAsCurrentUser true" switch, but I'd rather not have to do that.


LIVE, Thursday, Nov. 8 at 9 p.m. LIVE, looks at the dead and dying broadcast TV audience, the Baby Boomers leading the pack. Broadcasting itself is still going thorough the cultural gauntlet and the marketing and advertising world is preying on them as never before. Join us live at our regular dive.


GAINESVILLE, Ga. — The Heart Center of Northeast Georgia Medical Center (NGMC) has a new cardiologist. Ryan T. Whitney, MD, FACC, joined the practice today and is accepting patients at the Braselton, Buford and Commerce locations.
Learn more about Dr. Whitney, make an appointment and get driving directions by visiting www.heartngmc.org or calling 770-534-2020.


text:
Q: How to send sound of certain applications over chat programs (win OS) I have 5 requirements:

*

*I want to send sounds that are output of other programs over voice chat programs(e.g. TeamSpeak, Skype etc.)

*I only want to send the sounds of certain programs. Not all my system sounds

*I must still be able to talk to them (mice input should still be used).

*I still want to hear the sounds of what I send.

*It must be a software solution.

My scenario:
I am playing LoL/DoTA/CoD/BF (whichever makes you happy), I am on Teamspeak with some friends. Something happens and I want to play a fitting sound (e.g from http://www.myinstants.com/). So I want to send the sound from my browser over the chat.
What I tried:
I installed CheVolume (http://www.chevolume.com/Infos.aspx). This is for handling output devices, not sound input.
I set Stereo Mix as my default communication device. This works mostly, but then I also send my game sounds over chat.
I have installed VB-AUDIO (http://vb-audio.pagesperso-orange.fr/Voicemeeter/). It can be useful, but it is not what I want. I get similar results as using Stereo Mix.
I installed Jack (http://jackaudio.org/) shame to say it is to technical for me.
I tryed using Virtual Audio Cable (http://software.muzychenko.net/eng/vac.htm). Again, this only enables me to send all my system sounds.

A: but Voicemeeter allows to do that:

*

*Exactly : See User Manual Case study #1

*it is possible only if the application allow settings its playback device, then you will be able to route an application Voicemeeter virtual input or physical input through a VB-CABLE (Voicemeeter Banana version is better for that since it provide more I/O)
3,4,5: of course.

redpajama_set_name: RedPajamaStackExchange


text:
U.S. Third Circuit
Parties Agreement Not Executory and Thus Not Subject to Rejection
By FindLaw Staff on June 01, 2010 3:26 PM
In In re: Exide Technologies, No. 081872, the Third Circuit faced a challenge to the district court's affirmance of the Bankruptcy Court's grant of the debtor's motion to reject an agreement to sell substantially all of its industrial battery business, on the ground that the agreement was an executory contract, subject to rejection under 11 U.S.C. section 365(a), and that rejection terminated the debtor's obligations under it.
As stated in the decision: "The Bankruptcy Court here failed to properly measure whether either party had substantially performed. Our inspection of the record, however, reveals that the inferences are clear that EnerSys has substantially performed. Applying Hadden's balancing test, EnerSys's performance rendered outweighs its performance remaining and the extent to which the parties have benefitted is substantial. Specifically, EnerSys has substantially performed by paying the full $135 million purchase price and operating under the Agreement for over ten years."
Thus, in vacating the judgment and remanding the matter, the court held that the agreement is not an executory contract because it does not contain at least one ongoing material obligation for the other party, and because the agreement is not an executory contract, the debtor cannot reject it.
Related Resource:
Full text of In re: Exide Technologies

redpajama_set_name: RedPajamaCommonCrawl


Discussion in 'Site Feedback, Suggestions & Support' started by In the name of Zod, Jul 20, 2010.
Is there a list of enabled BBCodes?
For blogs to have the color bbcode enabled.
edit: Can't get the font tag/code to work. What is that for?


Founded on May 9, 1996 it started as a builder of medium and heavy-duty metal structures for industrial erection and maintenance jobs.
Zamitt is in a co-operation with one of the most excellent companies in the Turn key Projects in Libya ( Euro Mec).
Electric arc furnace steel plants accessories.
Material handling and dedusting systems .


text:
Pop Culture Passionistas
The Princess of Montpensier Seduces American Audiences
Photo by Etienne George, Paradis Films
A collaboration between Picktainment/PopCulturePassionistas
This weekend an epic French film is opening in select theaters in New York and Los Angeles. The Princess of Montpensier is based on the short story by Madame de La Fayette, and tells the tale of a young, aristocratic woman forced to marry in the shadow of the Wars of Religion. At a recent press conference director Bertrand Tavernier and star Gaspard Ulliel talked about developing the project, the appeal of the characters and finding the perfect leading lady.
Tavernier explained that when he signed on to the film, there was already a script in place — but not for long. ""I don't think we kept one line out of it… It was not appalling. It was interesting but I think the look at the princess was not good. The writer was describing her as a femme fatale in a film noir and for me that was the opposite."
The fact that Tavernier was not familiar with the original short story by the 17th century writer Madame de La Fayette, allowed him to interpret the title character, the Princess Marie de Montpensier, as he saw fit. He divulged, "I read first the screenplay, then the short story and I had absolutely not the same interpretation. I saw her as a victim not somebody who wanted to seduce the men. If I have that, I have a very ordinary character."
He continued, "If I have somebody who is trying to survive, trying to be faithful to her husband, who falls in love with her, which was not expected. And then when she meets men, the men are seduced by her – by her beauty, by her intelligence, her wit. But she doesn't try to seduce them. She's pleased maybe to be looked at but she never tries to seduce. Then I have a character which is very interesting and very complex."
Casting an actress who embodied all of those qualities was not an easy task. Travenier discussed the first of his issues. "It was a challenge because Marie had to be beautiful, stunningly beautiful. But also she had to look good in period costume, which not everybody's good in that. For instance, you have a great actress Sigourney Weaver, when she played the Queen of Spain, she looked completely disguised… So I had to have somebody who didn't look disguised in costume."
The director also had to discover a multi-faceted talent. He remarked, "I had to find somebody who had all the colors of the part — the sensuality but also the teenager, the fact that she's a very young girl, who likes to flirt, who is trying to make fun of her teacher, like a young kid in school. And in the next minute, she becomes class conscious and aristocratic. And she goes from being a wounded woman to somebody who is full of pride to somebody who is ready to make love now with de Guise. And she's fighting against that."
He ultimately cast French actress, Mélanie Thierry. He described the qualities that helped her land the role. "To have all of those colors, all those kinds of emotion, and Melanie was incredible because she goes from one to the other and you never see the homework. You never see the transition. Really she was like flying from an emotion to another."
Tavernier had nothing but praise for his young starlet, saying, "I know actors. And I love actors. And she's one of the best I've ever worked with. She was confronted to a dialogue, which was complicated and she was making it organic. She told me first that she had been intimidated because she went to see me at the beginning and I have spent many moments with her, she said, 'Bertram, I must tell you I have no education but I want to learn. So I want to read the screenplay with you. I will tell you the words I do not understand. I will tell you the expressions I do not understand. And she was like Marie. She was exactly like Marie. She wanted to learn."
Tavernier also spoke highly of the rest of his cast, including Ulliel who plays Marie's love interest Henri de Guise. He noted, "None of the actors, never made any mistake in that dialogue. I don't remember one shot which I had to redo because they had forgotten an adjective. Never… They are possessed by the dialogue. And everything becomes completely organic."
Ulliel revealed what drew him to the role of the Henri. "I like this character because I was able to show different things from what I've shown in other films. And also the physical appearance, the look, was different from my previous parts in other movies, too. And it was a mixture of physical scenes, like action scenes, and at the same time some more complex and deeper emotional scenes."
He also gave high marks to the script. He added, "I also really liked the whole story because I think it had so much strong themes, really modern in some way and actual, that would have some resonances with present time."
Ulliel was also excited to be working with a large ensemble cast of his peers. "I also was thrilled with the idea of working such a big group of young actors. Because I started quite young in this industry and I always tended to be working with people that were older than me and that's the first experience for me where I was really able to spend a lot of time on a set with people around my age."
The actor had one other co-star, that became very important to him — his trusty steed. He confessed, "I'm really thankful to the horse himself, because he was so well trained and so easy to ride. In fact those horses are especially trained for cinema and they always tend to be ridden by actors. And actually you could just whistle and this horse would stop. I was just so impressed by those horses. So I think the horse made it a bit easy for me."
Unfortunately Ulliel isn't having as easy a time transitioning into mainstream Hollywood films. In 2007 he starred in the Silence of the Lambs prequel Hannibal Rising, playing a younger version of Anthony Hopkins Oscar-winning Hannibal Lecter role. But his star did not immediately soar in the U.S.
He denied rumors that he'll appear in the post apocalyptic trilogy The Hunger Games. But there's no doubt the handsome and talented star will find fame in Hollywood before long.
The Princess of Montpensier opens on Friday, April 15 in an exclusive Los Angeles theatrical engagement at Laemmle's Royal Theatre, as well as in New York. On April 20 the film will be available via Sundance Selects' video on demand platform. The movie will expand into theaters across the U.S. on April 29. For more information visit the official The Princess of Montpensier website.
Posted by Pop Culture Passionistas at 2:00 AM
Labels: Interviews, Movies
We're huge pop culture fans. In fact, you could say it's our passion. Our whole family's creative. Guess it's a dominant gene. Growing up, we developed a love of TV, movies, music, and food as well as a fascination with celebrity. When we're not absorbing the entertainment world, we're writing and producing videos about pop culture people, places, and things. This blog is where all our passions collide. Enjoy! Amy & Nancy Harrington NOTE: In order to avoid sibling rivalry issues, and keep people guessing, the Pop Culture Passionistas always speak in the royal we.
Archives August 2015 (16) July 2015 (1) June 2015 (1) May 2015 (1) March 2015 (1) February 2015 (1) November 2014 (1) October 2014 (4) September 2014 (3) August 2014 (2) July 2014 (9) June 2014 (1) May 2014 (1) April 2014 (4) March 2014 (3) February 2014 (6) January 2014 (6) November 2013 (2) October 2013 (3) September 2013 (6) August 2013 (6) June 2013 (9) May 2013 (22) April 2013 (19) March 2013 (20) February 2013 (23) January 2013 (31) December 2012 (19) November 2012 (24) October 2012 (29) September 2012 (22) August 2012 (31) July 2012 (27) June 2012 (32) May 2012 (30) April 2012 (30) March 2012 (33) February 2012 (25) January 2012 (26) December 2011 (16) November 2011 (23) October 2011 (27) September 2011 (30) August 2011 (27) July 2011 (39) June 2011 (39) May 2011 (44) April 2011 (38) March 2011 (55) February 2011 (44) January 2011 (47) December 2010 (51) November 2010 (48) October 2010 (56) September 2010 (69) August 2010 (62) July 2010 (55) June 2010 (58) May 2010 (51) April 2010 (59) March 2010 (62) February 2010 (35) January 2010 (28) December 2009 (24) November 2009 (31) October 2009 (23) September 2009 (7) August 2009 (1) July 2009 (1) June 2009 (3) May 2009 (3) April 2009 (3) March 2009 (2) February 2009 (2) January 2009 (4) December 2008 (1) November 2008 (1) October 2008 (1) September 2008 (1) August 2008 (7) July 2008 (3) June 2008 (4) May 2008 (2)
TV (1128)
Reality TV (412)
Red Carpet Interviews (60)
Then and Now (21)
Award Shows (16)


text:
On November 30th, 2020, the Governor of New York signed into law a new postmortem provision which for the first time will add a postmortem right to the state's law, lasting 40 years after death. This new law also addresses the unlawful dissemination and publication of "sexually explicit...
New York Reintroduces Much Improved Postmortem Right of Publicity Bill
During its usual off-season, the New York legislature is revisiting its multi-year efforts to add new sections to its civil rights law and in particular to add a postmortem provision to state law. This latest version would add two sections to NY's Civil Rights Law, what it dubs a new "...
New York Trial Court Allows Right of Publicity Case to Proceed Against TV Docudrama
Once again a New York court has allowed Christopher Porco (hereinafter "Chris") and his mother,...
New York Legislative Session Ends With No Vote on Right of Publicity Bill
The New York legislature closed its session without taking up the proposed right of publicity and privacy bill.
In final hours, New York Makes Last Minute Changes to Right of Publicity Bill
Apparently dropping around midnight Sunday, the New York legislature made a set of last-minute changes to the proposed right of publicity bill. The...
Letters and Statements of Opposition Filed Against Proposed New York Right of Publicity Bills
I sent a letter to members of the New York legislature and their staff today opposing the proposed right of publicity...
New York Assembly Revises Right of Publicity Bill to Match Flawed Senate Version
Today, the New York Assembly introduced an amended version of its proposed right of publicity bill. It is virtually identical (with only minor changes) to the senate...
New York Reintroduces Right of Publicity Bill with Dueling Versions
Last week the New York Senate introduced a substantially revised version of a right of publicity bill, S5959. There are many promising...
DJ Khaled Sues Over Use of His Son's Name
Last week Khaled M. Khaled, known popularly as DJ Khaled, and the company ATK Entertainment filed a ...
New York Legislature Deluged with Letters Opposing Right Of Publicity Bill
Dozens of letters opposing the recently reintroduced and amended version of a right of publicity bill in New York have already been submitted to members of the New York legislature. Letters so far include ones by:...


text:
parentingthecore
A Parent's Thoughts on Education in the Era of Reform
Chris Christie Has A Bridge To Sell Us
As you may have heard (my phone's notifications certainly blew up yesterday when this announcement came out), Governor Chris Christie of New Jersey, in a bid to rescue his floudering-before-it-begins presidential run, announced that after five years of shoving the Common Core State Standards down our throats, he is joining the bandwagon of parents across the country, and now proudly shouting:"No More Common Core!" See, e.g., ABC's coverage of his announcement.
It is a heck of a sound bite, and will bring him some momentum in the 24-hour news cycle. However, it is a sham. His announcement changes nothing. Because along with his announcement, as we here in New Jersey have come to expect, he included some fine print:
Meanwhile, Christie said that the state will continue using a new standardized test [i.e., the Partnership for Assessment of Readiness for College and Career (PARCC) test] that was developed to measure how students were doing with the Common Core.
So Christie is "rejecting" Common Core but still requiring kids to take PARCC, a test developed to measure their achievement of the Common Core. Additionally, teacher and school evaluations throughout the state will still be based (10% this year, and as of now, 20% next year, and 30% in years to follow) on kids' scores on those Common Core-aligned tests. Placement decisions for children will still be predicated on their "achievement" of the Common Core standards, evaluations for teachers will still be predicated on their students' "achievement" of the Common Core standards, and schools will still be labeled as "failing" based on their students' alleged "failure" to achieve those Common Core standards — all as measured by PARCC.
Christie's announcement changes nothing, and shame on the media for lapping it up so naively. Christie's so-called rejection of Common Core is simply a sound bite for him to take on the road to Iowa and New Hampshire while our NJ public school kids continue to deal with a language arts curriculum that doesn't teach them to consider texts and ideas within their broader historical context.
The irony is that Christie's faux-announcement proves what so many of us have been saying all along: curriculum and education these days aren't standards-driven, they're test driven. The one thing this announcement does provide is a lesson in the convoluted logic of politics. So in that sad, cynical sense, at least Christie is providing our kids with a lesson in practical civics, which many of their schools no longer teach.
However, as long as the Common Core-aligned PARCC test continues to be the barometer to allegedly measure our schools, teachers, and children's efficacy, Christie's announcement is worth even less than the paper his speech was written on. If you believe otherwise, then man, I've got a bridge to sell you…
Sarah Blaine / Parenting the Core	Common Core, Education, Standardized Testing, Uncategorized	9 Comments May 29, 2015 May 29, 2015 2 Minutes
Testing and the Re-Segregation of Public Ed
Today, I was part of a full house at the New Jersey Senate Education Committee as it considered bills and a resolution relating to the PARCC (Partnership for Assessment of Readiness for College and Career) tests. Along with many other grassroots parent activists, I am frustrated by the Senate Committee Chair's unwillingness to set down all of the much stronger PARCC bills passed by the New Jersey State Assembly for a vote in her committee. Rather, only one of the four bills, prohibiting PARCC-style testing for grades K-2, was set down for a vote by her Committee. Senator Ruiz also offered a substantially watered down replacement bill for the Assembly bill to notify parents of standardized testing. Senator Ruiz's version of the bill, for example, fails to require that parents be notified of information as basic as what use local districts will make of standardized tests administered to their children (e.g., will the tests factor into student placement into gifted and talent programs or remedial education, etc.).
So instead, I focused my efforts on the two bills introduced by my terrific local state senator, Senator Nia Gill. Senator Gill introduced two bills: one to require local districts to publish their PARCC opt-out numbers within 10 days of completing test administration, and the other to explicitly prohibit New Jersey Education Commissioner David Hespe from withholding state aid from districts with high PARCC refusal rates.
The text of my full testimony is below. In it, I address the elephant in the room: the use of standardized test scores as a proxy to encourage resegregation of school districts by class and, to the extent that class and race are unfortunately still correlated in this country, race.
My testimony:
My name is Sarah Blaine. I am here today to in particular support Senator Nia Gill's bills, S2884 and S2881. No one is paying me to be here today: in fact, I took a day off work to attend this hearing. I have two children, a kindergartener and a fourth grader, in the Montclair Public Schools. Both of them only get one shot at their educations.
When I saw changes in my older daughter's curriculum as a result of Common Core, I sat down to read the standards. I'm an attorney now, but before law school I taught high school English. Given that I would have loved some standards (or, heck, books) as a new teacher in a rural community with few resources, I started out on the assumption that national standards were probably a good idea.
But then I watched what was happening in my daughter's classroom change. As PARCC loomed, homework became more test-prep focused, with multiple choice questions and written paragraphs that had to follow strict formulas. I learned that my older daughter's school had reduced the number of elective periods. Social studies education virtually disappeared. Science became reading the textbook and filling in blanks, instead of labs and hands on experimentation. My 4th grader has not had a single field trip this year — and as far as I know, none are scheduled. I realized that I was seeing a predictable result of high-stakes testing in action: my daughter's school was narrowing the curriculum to increase the time available for test prep.
In Montclair, as across the country, test scores are closely correlated with the socio-economics of the populations tested. Although Montclair is consistently characterized in the press as "affluent," according to NJDOE statistics, over 20% of our total school population is economically disadvantaged. Montclair has two NCLB focus schools not because those schools are lousy — they're not — but because we are one of the few NJ towns with an economically and racially diverse enough school population to demonstrate an achievement gap. This has driven an increased emphasis on test prep, which benefits no one.
Last December my spunky 4th grader testified directly to our Board about why "PARCC stinks" based on how test-prep was taking over her classroom. I can tell you this much: after that speech, which went viral and led to her live appearance on national television, I have no doubt, without any need for PARCC results, that when the time comes my child will be college and career ready. Of course, I already knew that: her parents' advanced degrees, race, and socio-economic status make that a virtual certainty. If you policymakers want more children to succeed, you need to spend your time implementing equitable economic and housing policies to ensure that all citizens have the chance to join a robust and secure middle class.
The Montclair Public Schools administration worked hard to implement — and, indeed, cheerlead for — PARCC. However, locally I wasn't alone in my concerns about the effect that PARCC was having on our schools: more than 42% of Montclair children refused PARCC. However, we Montclair taxpayers were not even able to obtain that statistic from the school district without a fight. That is why I support Senator Gill's bill to ensure that taxpayers are afforded access to the testing numbers.
Recently, Education Commissioner Hespe — and Governor Christie — began explicitly threatening to withhold state funding from school districts with high PARCC refusal rates. That threat is unacceptable, as the school district has no way to compel me or any other parent to allow our children to sit for these tests. To be clear, I don't say no because my child is anxious or scared.
Rather, I say no to PARCC because I see, as a parent, the destructive effect that annual testing and high-stakes uses of annual results are having on the quality of education offered in our state's traditionally high-quality public schools. I see that aggregate test scores are used — be it by real estate agents or home buyers — as proxies for socio-economic status, with the effect of further re-segregating our communities. I see it, and I get it, because I, too, looked at those test scores and school rankings when we were choosing the New Jersey community in which we wanted to raise our children. But then I realized that I didn't want my children growing up in the same narrow bubble that characterized my childhood in Short Hills — and instead of moving to the town with the highest test scores, we moved to Montclair.
If more New Jersey towns were integrated like Montclair, all of our children would learn a little more compassion, a little more wisdom, a little more humility, a little more sense of what's possible, a little less fear of those not like them, and a little more awareness of how the accidents of birth can and do affect children's futures. But politically, that will never fly, so you continue to test children and communities into submission, instead of choosing the tough — and admittedly expensive — policies that might actually work. Then, when parents like me say no, Commissioner Hespe tries to threaten us into submission. And so I support Senator Gill's bill to prevent Commissioner Hespe from withholding funds from districts like Montclair, where the parents have had the courage to say no to the destructive effects of high-stakes annual tests.
I ask you to support these bills because democracy cannot function effectively if it is predicated on failure to inform the citizenry of what is happening in our public schools. I ask you to support these bills because democracy cannot function effectively if it is predicated on empty threats from state-level bureaucrats meant to intimidate parents and communities. Our children deserve better. Thank you.
Sarah Blaine / Parenting the Core	Education, Education Justice, Local Issues, Standardized Testing, Uncategorized	4 Comments May 18, 2015 May 18, 2015 5 Minutes
Parenting The Core
Follow parentingthecore on WordPress.com
Curmudgucation
Education Opportunity Network
Jersey Jazzman
Living in Dialogue
Mercedes Schneider's EduBlog
Mother Crusader
Russ on Reading
School Finance 101
Teacher Biz Blog
Teachers' Letters to Bill Gates
The Washington Post's Answer Sheet Blog by Valerie Strauss
Pearson's Wrong Answer


"Winning is in their blood. Among other things."
Andy Samberg and Murray Miller explore the world of professional cycling in this sports mockumentary. The setting is the sordid, fictional 1982 Tour de France--notable as the only time in race history when virtually all of the competitors were doping, inadvertently creating a truly level playing field. John Cena, Daveed Diggs, Orlando Bloom and Freddie Highmore co-star.
Tour de Pharmacy is currently available to watch and stream, download, buy on demand at Amazon Prime, Amazon, Google Play, iTunes, YouTube VOD online.


text:
Q: how to set value in abstract class c# I'm trying assign value AbstractArAdjustmentLine list property but getting error

Object reference not set

Below are the 2 classes generated through dll, I can't change the class structure.
public class ArAdjustmentCreate : AbstractArAdjustment
{
    public ArAdjustmentCreate(string controlId = null);
    public override void WriteXml(ref IaXmlWriter xml);
}

public abstract class AbstractArAdjustment: AbstractFunction
{
    public List<AbstractArAdjustmentLine> Lines;
    public DateTime? GlPostingDate;
    public DateTime TransactionDate;
    public string CustomerId;
}

public abstract class AbstractArAdjustmentLine : IXmlObject
{
    public string WarehouseId;
    public string EmployeeId;
    protected AbstractArAdjustmentLine();
}

// Creating instance of ArAdjustmentCreate
ArAdjustmentCreate arAdjustmentCreate = new ArAdjustmentCreate()
            {
                CustomerId = "23",
                TransactionDate = DateTime.Now,
                GlPostingDate = DateTime.Now,
            };

AbstractArAdjustmentLine arAdjustmentLine = null;
arAdjustmentLine.WarehouseId = "788"; // getting error Object reference not set
arAdjustmentLine.EmployeeId = "100";
arAdjustmentCreate.Lines.Add(arAdjustmentLine);

How to set value in AbstractArAdjustmentLine abstract class?

A: You set AbstractArAdjustmentLine arAdjustmentLine = null;, probably because you realized you can't instantiate an abstract class, but you need an instance to set the properties. The only practical way you can use an abstract class is by inheriting in a subtype:
abstract class A { }
class B : A { }

// Works:
A a = new B();

// Works:
B b = new B();

// Does not work:
A c = new A();

See null keyword and abstract in the docs, and What is a NullReferenceException, and how do I fix it? from this site.