blob: e36ef3439caf43ee2bea7712ba7f34a372a6fd7b [file]
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CHPP_WWAN_TYPES_H_
#define CHPP_WWAN_TYPES_H_
// This file was automatically generated by chre_api_to_chpp.py
// Date: 2022-02-03 23:05:30 UTC
// Source: chre_api/include/chre_api/chre/wwan.h @ commit b5a92e457
// DO NOT modify this file directly, as those changes will be lost the next
// time the script is executed
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "chpp/app.h"
#include "chpp/common/common_types.h"
#include "chpp/macros.h"
#include "chre_api/chre/version.h"
#include "chre_api/chre/wwan.h"
#ifdef __cplusplus
extern "C" {
#endif
CHPP_PACKED_START
//! See {@link chreWwanCellIdentityCdma} for details
struct ChppWwanCellIdentityCdma {
int32_t networkId;
int32_t systemId;
int32_t basestationId;
int32_t longitude;
int32_t latitude;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthCdma} for details
struct ChppWwanSignalStrengthCdma {
int32_t dbm;
int32_t ecio;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthEvdo} for details
struct ChppWwanSignalStrengthEvdo {
int32_t dbm;
int32_t ecio;
int32_t signalNoiseRatio;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoCdma} for details
struct ChppWwanCellInfoCdma {
struct ChppWwanCellIdentityCdma cellIdentityCdma;
struct ChppWwanSignalStrengthCdma signalStrengthCdma;
struct ChppWwanSignalStrengthEvdo signalStrengthEvdo;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellIdentityGsm} for details
struct ChppWwanCellIdentityGsm {
int32_t mcc;
int32_t mnc;
int32_t lac;
int32_t cid;
int32_t arfcn;
uint8_t bsic;
uint8_t reserved[3]; // Input ignored; always set to 0
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthGsm} for details
struct ChppWwanSignalStrengthGsm {
int32_t signalStrength;
int32_t bitErrorRate;
int32_t timingAdvance;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoGsm} for details
struct ChppWwanCellInfoGsm {
struct ChppWwanCellIdentityGsm cellIdentityGsm;
struct ChppWwanSignalStrengthGsm signalStrengthGsm;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellIdentityLte} for details
struct ChppWwanCellIdentityLte {
int32_t mcc;
int32_t mnc;
int32_t ci;
int32_t pci;
int32_t tac;
int32_t earfcn;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthLte} for details
struct ChppWwanSignalStrengthLte {
int32_t signalStrength;
int32_t rsrp;
int32_t rsrq;
int32_t rssnr;
int32_t cqi;
int32_t timingAdvance;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoLte} for details
struct ChppWwanCellInfoLte {
struct ChppWwanCellIdentityLte cellIdentityLte;
struct ChppWwanSignalStrengthLte signalStrengthLte;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellIdentityNr} for details
struct ChppWwanCellIdentityNr {
int32_t mcc;
int32_t mnc;
uint32_t nci0;
uint32_t nci1;
int32_t pci;
int32_t tac;
int32_t nrarfcn;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthNr} for details
struct ChppWwanSignalStrengthNr {
int32_t ssRsrp;
int32_t ssRsrq;
int32_t ssSinr;
int32_t csiRsrp;
int32_t csiRsrq;
int32_t csiSinr;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoNr} for details
struct ChppWwanCellInfoNr {
struct ChppWwanCellIdentityNr cellIdentityNr;
struct ChppWwanSignalStrengthNr signalStrengthNr;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellIdentityTdscdma} for details
struct ChppWwanCellIdentityTdscdma {
int32_t mcc;
int32_t mnc;
int32_t lac;
int32_t cid;
int32_t cpid;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthTdscdma} for details
struct ChppWwanSignalStrengthTdscdma {
int32_t rscp;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoTdscdma} for details
struct ChppWwanCellInfoTdscdma {
struct ChppWwanCellIdentityTdscdma cellIdentityTdscdma;
struct ChppWwanSignalStrengthTdscdma signalStrengthTdscdma;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellIdentityWcdma} for details
struct ChppWwanCellIdentityWcdma {
int32_t mcc;
int32_t mnc;
int32_t lac;
int32_t cid;
int32_t psc;
int32_t uarfcn;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanSignalStrengthWcdma} for details
struct ChppWwanSignalStrengthWcdma {
int32_t signalStrength;
int32_t bitErrorRate;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoWcdma} for details
struct ChppWwanCellInfoWcdma {
struct ChppWwanCellIdentityWcdma cellIdentityWcdma;
struct ChppWwanSignalStrengthWcdma signalStrengthWcdma;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoPerRat} for details
union ChppWwanCellInfoPerRat {
struct ChppWwanCellInfoGsm gsm;
struct ChppWwanCellInfoCdma cdma;
struct ChppWwanCellInfoLte lte;
struct ChppWwanCellInfoWcdma wcdma;
struct ChppWwanCellInfoTdscdma tdscdma;
struct ChppWwanCellInfoNr nr;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfo} for details
struct ChppWwanCellInfo {
uint64_t timeStamp;
uint8_t cellInfoType;
uint8_t timeStampType;
uint8_t registered;
uint8_t reserved; // Input ignored; always set to 0
union ChppWwanCellInfoPerRat CellInfo;
} CHPP_PACKED_ATTR;
//! See {@link chreWwanCellInfoResult} for details
struct ChppWwanCellInfoResult {
uint8_t version; // Input ignored; always set to
// CHRE_WWAN_CELL_INFO_RESULT_VERSION
uint8_t errorCode;
uint8_t cellInfoCount;
uint8_t reserved; // Input ignored; always set to 0
uint32_t cookie; // Input ignored; always set to 0
struct ChppOffset
cells; // References cellInfoCount instances of struct ChppOffset
} CHPP_PACKED_ATTR;
//! CHPP app header plus struct ChppWwanCellInfoResultWithHeader
struct ChppWwanCellInfoResultWithHeader {
struct ChppAppHeader header;
struct ChppWwanCellInfoResult payload;
} CHPP_PACKED_ATTR;
CHPP_PACKED_END
// Encoding functions (CHRE --> CHPP)
/**
* Converts from given CHRE structure to serialized CHPP type.
*
* @param in Fully-formed CHRE structure.
* @param out Upon success, will point to a buffer allocated with chppMalloc().
* It is the responsibility of the caller to set the values of the CHPP app
* layer header, and to free the buffer when it is no longer needed via
* chppFree() or CHPP_FREE_AND_NULLIFY().
* @param outSize Upon success, will be set to the size of the output buffer, in
* bytes.
*
* @return true on success, false if memory allocation failed.
*/
bool chppWwanCellInfoResultFromChre(
const struct chreWwanCellInfoResult *in,
struct ChppWwanCellInfoResultWithHeader **out, size_t *outSize);
// Decoding functions (CHPP --> CHRE)
/**
* Converts from serialized CHPP structure to a CHRE type.
*
* @param in Fully-formed CHPP structure.
* @param in Size of the CHPP structure in bytes.
*
* @return If successful, a pointer to a CHRE structure allocated with
* chppMalloc(). If unsuccessful, null. It is the responsibility of the caller
* to free the buffer when it is no longer needed via chppFree() or
* CHPP_FREE_AND_NULLIFY().
*/
struct chreWwanCellInfoResult *chppWwanCellInfoResultToChre(
const struct ChppWwanCellInfoResult *in, size_t inSize);
#ifdef __cplusplus
}
#endif
#endif // CHPP_WWAN_TYPES_H_