Merge "Use enumerator for AudioFocusChange"
diff --git a/automotive/can/1.0/default/libnl++/Android.bp b/automotive/can/1.0/default/libnl++/Android.bp
index 4042b16..90e1002 100644
--- a/automotive/can/1.0/default/libnl++/Android.bp
+++ b/automotive/can/1.0/default/libnl++/Android.bp
@@ -25,6 +25,7 @@
"protocols/generic/Generic.cpp",
"protocols/generic/GenericMessageBase.cpp",
"protocols/generic/Unknown.cpp",
+ "protocols/generic/families/Nl80211.cpp",
"protocols/route/Link.cpp",
"protocols/route/Route.cpp",
"protocols/route/structs.cpp",
diff --git a/automotive/can/1.0/default/libnl++/printer.cpp b/automotive/can/1.0/default/libnl++/printer.cpp
index e6cada2..f08897e 100644
--- a/automotive/can/1.0/default/libnl++/printer.cpp
+++ b/automotive/can/1.0/default/libnl++/printer.cpp
@@ -51,24 +51,24 @@
printFlag(NLM_F_DUMP_FILTERED, "DUMP_FILTERED");
switch (genre) {
- case protocols::MessageGenre::UNKNOWN:
+ case protocols::MessageGenre::Unknown:
break;
- case protocols::MessageGenre::GET:
+ case protocols::MessageGenre::Get:
printFlag(NLM_F_DUMP, "DUMP"); // ROOT | MATCH
printFlag(NLM_F_ROOT, "ROOT");
printFlag(NLM_F_MATCH, "MATCH");
printFlag(NLM_F_ATOMIC, "ATOMIC");
break;
- case protocols::MessageGenre::NEW:
+ case protocols::MessageGenre::New:
printFlag(NLM_F_REPLACE, "REPLACE");
printFlag(NLM_F_EXCL, "EXCL");
printFlag(NLM_F_CREATE, "CREATE");
printFlag(NLM_F_APPEND, "APPEND");
break;
- case protocols::MessageGenre::DELETE:
+ case protocols::MessageGenre::Delete:
printFlag(NLM_F_NONREC, "NONREC");
break;
- case protocols::MessageGenre::ACK:
+ case protocols::MessageGenre::Ack:
printFlag(NLM_F_CAPPED, "CAPPED");
printFlag(NLM_F_ACK_TLVS, "ACK_TLVS");
break;
@@ -99,11 +99,25 @@
static void toStream(std::stringstream& ss, const Buffer<nlattr> attr,
const protocols::AttributeMap& attrMap) {
using DataType = protocols::AttributeDefinition::DataType;
+ using Flags = protocols::AttributeDefinition::Flags;
const auto attrtype = attrMap[attr->nla_type];
- ss << attrtype.name << ": ";
+ ss << attrtype.name;
+
+ if (attrtype.dataType == DataType::Flag && attr.data<uint8_t>().getRaw().len() == 0) return;
+ ss << ": ";
+
+ if (attrtype.flags == Flags::Verbose) {
+ const auto raw = attr.data<uint8_t>();
+ ss << "{len=" << raw.getRaw().len();
+ ss << ", crc=" << std::hex << std::setw(4) << crc16(raw) << std::dec;
+ ss << "}";
+ return;
+ }
+
switch (attrtype.dataType) {
case DataType::Raw:
+ case DataType::Flag:
toStream(ss, attr.data<uint8_t>());
break;
case DataType::Nested: {
@@ -117,13 +131,19 @@
ss << '}';
break;
}
+ case DataType::StringNul:
case DataType::String: {
const auto str = attr.data<char>().getRaw();
- ss << '"' << printableOnly({str.ptr(), str.len()}) << '"';
+ auto len = str.len();
+ if (attrtype.dataType == DataType::StringNul && len > 0 && str.ptr()[len - 1] == '\0') {
+ len--;
+ }
+
+ ss << '"' << printableOnly({str.ptr(), len}) << '"';
break;
}
case DataType::Uint:
- ss << attr.data<uint32_t>().copyFirst();
+ ss << attr.data<uint64_t>().copyFirst();
break;
case DataType::Struct: {
const auto structToStream =
@@ -147,10 +167,12 @@
}
protocols::NetlinkProtocol& protocolDescr = *protocolMaybe;
- const auto msgDescMaybe = protocolDescr.getMessageDescriptor(hdr->nlmsg_type);
+ auto msgDescMaybe = protocolDescr.getMessageDescriptor(hdr->nlmsg_type);
const auto msgDetails =
protocols::MessageDescriptor::getMessageDetails(msgDescMaybe, hdr->nlmsg_type);
+ if (msgDescMaybe.has_value()) msgDescMaybe->get().track(hdr);
+
ss << "nlmsg{" << protocolDescr.getName() << " ";
ss << "hdr={";
diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp
index c93d865..aaf24a5 100644
--- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp
@@ -56,15 +56,17 @@
MessageDescriptor::MessageDetails MessageDescriptor::getMessageDetails(nlmsgtype_t msgtype) const {
const auto it = mMessageDetails.find(msgtype);
- if (it == mMessageDetails.end()) return {std::to_string(msgtype), MessageGenre::UNKNOWN};
+ if (it == mMessageDetails.end()) return {std::to_string(msgtype), MessageGenre::Unknown};
return it->second;
}
MessageDescriptor::MessageDetails MessageDescriptor::getMessageDetails(
- const std::optional<std::reference_wrapper<const MessageDescriptor>>& msgDescMaybe,
+ const std::optional<std::reference_wrapper<MessageDescriptor>>& msgDescMaybe,
nlmsgtype_t msgtype) {
if (msgDescMaybe.has_value()) return msgDescMaybe->get().getMessageDetails(msgtype);
- return {std::to_string(msgtype), protocols::MessageGenre::UNKNOWN};
+ return {std::to_string(msgtype), protocols::MessageGenre::Unknown};
}
+void MessageDescriptor::track(const Buffer<nlmsghdr> /* hdr */) {}
+
} // namespace android::nl::protocols
diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
index bd0e60f..8bed5e7 100644
--- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
+++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
@@ -54,17 +54,64 @@
*/
struct AttributeDefinition {
enum class DataType : uint8_t {
+ /**
+ * Binary blob (or attribute of unknown type).
+ */
Raw,
+
+ /**
+ * Nested attribute (with or without NLA_F_NESTED).
+ */
Nested,
+
+ /**
+ * Non-null terminated string.
+ *
+ * The length of the string is determined by the size of an attribute.
+ */
String,
+
+ /**
+ * Null terminated string.
+ */
+ StringNul,
+
+ /**
+ * Unsigned integer of size 8, 16, 32 or 64 bits.
+ */
Uint,
+
+ /**
+ * Structure which printer is defined in ops ToStream variant.
+ */
Struct,
+
+ /**
+ * Flag attribute.
+ *
+ * The attribute doesn't have any contents. The flag is set when the attribute is present,
+ * it's not when it's absent from attribute list.
+ */
+ Flag,
+ };
+ enum class Flags : uint8_t {
+ Verbose = (1 << 0),
};
using ToStream = std::function<void(std::stringstream& ss, const Buffer<nlattr> attr)>;
std::string name;
DataType dataType = DataType::Raw;
std::variant<AttributeMap, ToStream> ops = AttributeMap{};
+
+ /**
+ * Attribute flags.
+ *
+ * It's not really a bitmask flag set (since you are not supposed to compare enum class by
+ * bitmask), but std::set<Flags> bumps compile time from 16s to 3m. Let's leave it as-is for
+ * now and revisit if we get some flags that can be used in pairs. When it happens, review all
+ * uses of the flags field to include the "&" operator and not "==".
+ */
+ Flags flags = {};
};
/**
@@ -74,11 +121,11 @@
* section in linux/netlink.h.
*/
enum class MessageGenre {
- UNKNOWN,
- GET,
- NEW,
- DELETE,
- ACK,
+ Unknown,
+ Get,
+ New,
+ Delete,
+ Ack,
};
/**
@@ -103,8 +150,15 @@
MessageDetails getMessageDetails(nlmsgtype_t msgtype) const;
virtual void dataToStream(std::stringstream& ss, const Buffer<nlmsghdr> hdr) const = 0;
+ /**
+ * Message tracking for stateful protocols (such as NETLINK_GENERIC).
+ *
+ * \param hdr Message to track
+ */
+ virtual void track(const Buffer<nlmsghdr> hdr);
+
static MessageDetails getMessageDetails(
- const std::optional<std::reference_wrapper<const MessageDescriptor>>& msgDescMaybe,
+ const std::optional<std::reference_wrapper<MessageDescriptor>>& msgDescMaybe,
nlmsgtype_t msgtype);
protected:
diff --git a/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.cpp b/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.cpp
index cd2e8c6..16208ab 100644
--- a/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.cpp
@@ -32,7 +32,7 @@
return mName;
}
-const std::optional<std::reference_wrapper<const MessageDescriptor>>
+const std::optional<std::reference_wrapper<MessageDescriptor>>
NetlinkProtocol::getMessageDescriptor(nlmsgtype_t nlmsg_type) {
if (mMessageDescrs.count(nlmsg_type) == 0) return std::nullopt;
return *mMessageDescrs.find(nlmsg_type)->second;
@@ -41,7 +41,7 @@
NetlinkProtocol::MessageDescriptorMap NetlinkProtocol::toMap(
const NetlinkProtocol::MessageDescriptorList& descrs, int protocol) {
MessageDescriptorMap map;
- for (const auto& descr : descrs) {
+ for (auto& descr : descrs) {
for (const auto& [mtype, mdet] : descr->getMessageDetailsMap()) {
map.emplace(mtype, descr);
}
diff --git a/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.h b/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.h
index c969547..b173b91 100644
--- a/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.h
+++ b/automotive/can/1.0/default/libnl++/protocols/NetlinkProtocol.h
@@ -40,17 +40,17 @@
const std::string& getName() const;
- virtual const std::optional<std::reference_wrapper<const MessageDescriptor>>
- getMessageDescriptor(nlmsgtype_t nlmsg_type);
+ virtual const std::optional<std::reference_wrapper<MessageDescriptor>> getMessageDescriptor(
+ nlmsgtype_t nlmsg_type);
protected:
- typedef std::vector<std::shared_ptr<const MessageDescriptor>> MessageDescriptorList;
+ typedef std::vector<std::shared_ptr<MessageDescriptor>> MessageDescriptorList;
NetlinkProtocol(int protocol, const std::string& name,
const MessageDescriptorList&& messageDescrs);
private:
- typedef std::map<nlmsgtype_t, std::shared_ptr<const MessageDescriptor>> MessageDescriptorMap;
+ typedef std::map<nlmsgtype_t, std::shared_ptr<MessageDescriptor>> MessageDescriptorMap;
const int mProtocol;
const std::string mName;
diff --git a/automotive/can/1.0/default/libnl++/protocols/common/Empty.cpp b/automotive/can/1.0/default/libnl++/protocols/common/Empty.cpp
index 8a672d3..4b509c9 100644
--- a/automotive/can/1.0/default/libnl++/protocols/common/Empty.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/common/Empty.cpp
@@ -20,9 +20,9 @@
// clang-format off
Empty::Empty() : MessageDefinition<char>("nlmsg", {
- {NLMSG_NOOP, {"NOOP", MessageGenre::UNKNOWN}},
- {NLMSG_DONE, {"DONE", MessageGenre::UNKNOWN}},
- {NLMSG_OVERRUN, {"OVERRUN", MessageGenre::UNKNOWN}},
+ {NLMSG_NOOP, {"NOOP", MessageGenre::Unknown}},
+ {NLMSG_DONE, {"DONE", MessageGenre::Unknown}},
+ {NLMSG_OVERRUN, {"OVERRUN", MessageGenre::Unknown}},
}) {}
// clang-format on
diff --git a/automotive/can/1.0/default/libnl++/protocols/common/Error.cpp b/automotive/can/1.0/default/libnl++/protocols/common/Error.cpp
index 44708a3..77451ed 100644
--- a/automotive/can/1.0/default/libnl++/protocols/common/Error.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/common/Error.cpp
@@ -20,13 +20,15 @@
#include <libnl++/printer.h>
+#include <map>
+
namespace android::nl::protocols::base {
using DataType = AttributeDefinition::DataType;
// clang-format off
Error::Error(int protocol) : MessageDefinition<nlmsgerr>("nlmsg", {
- {NLMSG_ERROR, {"ERROR", MessageGenre::ACK}},
+ {NLMSG_ERROR, {"ERROR", MessageGenre::Ack}},
}, {
{NLMSGERR_ATTR_MSG, {"MSG", DataType::String}},
{NLMSGERR_ATTR_OFFS, {"OFFS", DataType::Uint}},
@@ -34,9 +36,156 @@
}), mProtocol(protocol) {}
// clang-format on
+std::map<int, std::string> errnoNames{
+ {EPERM, "EPERM"}, // Operation not permitted
+ {ENOENT, "ENOENT"}, // No such file or directory
+ {ESRCH, "ESRCH"}, // No such process
+ {EINTR, "EINTR"}, // Interrupted system call
+ {EIO, "EIO"}, // I/O error
+ {ENXIO, "ENXIO"}, // No such device or address
+ {E2BIG, "E2BIG"}, // Argument list too long
+ {ENOEXEC, "ENOEXEC"}, // Exec format error
+ {EBADF, "EBADF"}, // Bad file number
+ {ECHILD, "ECHILD"}, // No child processes
+ {EAGAIN, "EAGAIN"}, // Try again
+ {ENOMEM, "ENOMEM"}, // Out of memory
+ {EACCES, "EACCES"}, // Permission denied
+ {EFAULT, "EFAULT"}, // Bad address
+ {ENOTBLK, "ENOTBLK"}, // Block device required
+ {EBUSY, "EBUSY"}, // Device or resource busy
+ {EEXIST, "EEXIST"}, // File exists
+ {EXDEV, "EXDEV"}, // Cross-device link
+ {ENODEV, "ENODEV"}, // No such device
+ {ENOTDIR, "ENOTDIR"}, // Not a directory
+ {EISDIR, "EISDIR"}, // Is a directory
+ {EINVAL, "EINVAL"}, // Invalid argument
+ {ENFILE, "ENFILE"}, // File table overflow
+ {EMFILE, "EMFILE"}, // Too many open files
+ {ENOTTY, "ENOTTY"}, // Not a typewriter
+ {ETXTBSY, "ETXTBSY"}, // Text file busy
+ {EFBIG, "EFBIG"}, // File too large
+ {ENOSPC, "ENOSPC"}, // No space left on device
+ {ESPIPE, "ESPIPE"}, // Illegal seek
+ {EROFS, "EROFS"}, // Read-only file system
+ {EMLINK, "EMLINK"}, // Too many links
+ {EPIPE, "EPIPE"}, // Broken pipe
+ {EDOM, "EDOM"}, // Math argument out of domain of func
+ {ERANGE, "ERANGE"}, // Math result not representable
+ {EDEADLK, "EDEADLK"}, // Resource deadlock would occur
+ {ENAMETOOLONG, "ENAMETOOLONG"}, // File name too long
+ {ENOLCK, "ENOLCK"}, // No record locks available
+ {ENOSYS, "ENOSYS"}, // Invalid system call number
+ {ENOTEMPTY, "ENOTEMPTY"}, // Directory not empty
+ {ELOOP, "ELOOP"}, // Too many symbolic links encountered
+ {ENOMSG, "ENOMSG"}, // No message of desired type
+ {EIDRM, "EIDRM"}, // Identifier removed
+ {ECHRNG, "ECHRNG"}, // Channel number out of range
+ {EL2NSYNC, "EL2NSYNC"}, // Level 2 not synchronized
+ {EL3HLT, "EL3HLT"}, // Level 3 halted
+ {EL3RST, "EL3RST"}, // Level 3 reset
+ {ELNRNG, "ELNRNG"}, // Link number out of range
+ {EUNATCH, "EUNATCH"}, // Protocol driver not attached
+ {ENOCSI, "ENOCSI"}, // No CSI structure available
+ {EL2HLT, "EL2HLT"}, // Level 2 halted
+ {EBADE, "EBADE"}, // Invalid exchange
+ {EBADR, "EBADR"}, // Invalid request descriptor
+ {EXFULL, "EXFULL"}, // Exchange full
+ {ENOANO, "ENOANO"}, // No anode
+ {EBADRQC, "EBADRQC"}, // Invalid request code
+ {EBADSLT, "EBADSLT"}, // Invalid slot
+ {EBFONT, "EBFONT"}, // Bad font file format
+ {ENOSTR, "ENOSTR"}, // Device not a stream
+ {ENODATA, "ENODATA"}, // No data available
+ {ETIME, "ETIME"}, // Timer expired
+ {ENOSR, "ENOSR"}, // Out of streams resources
+ {ENONET, "ENONET"}, // Machine is not on the network
+ {ENOPKG, "ENOPKG"}, // Package not installed
+ {EREMOTE, "EREMOTE"}, // Object is remote
+ {ENOLINK, "ENOLINK"}, // Link has been severed
+ {EADV, "EADV"}, // Advertise error
+ {ESRMNT, "ESRMNT"}, // Srmount error
+ {ECOMM, "ECOMM"}, // Communication error on send
+ {EPROTO, "EPROTO"}, // Protocol error
+ {EMULTIHOP, "EMULTIHOP"}, // Multihop attempted
+ {EDOTDOT, "EDOTDOT"}, // RFS specific error
+ {EBADMSG, "EBADMSG"}, // Not a data message
+ {EOVERFLOW, "EOVERFLOW"}, // Value too large for defined data type
+ {ENOTUNIQ, "ENOTUNIQ"}, // Name not unique on network
+ {EBADFD, "EBADFD"}, // File descriptor in bad state
+ {EREMCHG, "EREMCHG"}, // Remote address changed
+ {ELIBACC, "ELIBACC"}, // Can not access a needed shared library
+ {ELIBBAD, "ELIBBAD"}, // Accessing a corrupted shared library
+ {ELIBSCN, "ELIBSCN"}, // .lib section in a.out corrupted
+ {ELIBMAX, "ELIBMAX"}, // Attempting to link in too many shared libraries
+ {ELIBEXEC, "ELIBEXEC"}, // Cannot exec a shared library directly
+ {EILSEQ, "EILSEQ"}, // Illegal byte sequence
+ {ERESTART, "ERESTART"}, // Interrupted system call should be restarted
+ {ESTRPIPE, "ESTRPIPE"}, // Streams pipe error
+ {EUSERS, "EUSERS"}, // Too many users
+ {ENOTSOCK, "ENOTSOCK"}, // Socket operation on non-socket
+ {EDESTADDRREQ, "EDESTADDRREQ"}, // Destination address required
+ {EMSGSIZE, "EMSGSIZE"}, // Message too long
+ {EPROTOTYPE, "EPROTOTYPE"}, // Protocol wrong type for socket
+ {ENOPROTOOPT, "ENOPROTOOPT"}, // Protocol not available
+ {EPROTONOSUPPORT, "EPROTONOSUPPORT"}, // Protocol not supported
+ {ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT"}, // Socket type not supported
+ {EOPNOTSUPP, "EOPNOTSUPP"}, // Operation not supported on transport endpoint
+ {EPFNOSUPPORT, "EPFNOSUPPORT"}, // Protocol family not supported
+ {EAFNOSUPPORT, "EAFNOSUPPORT"}, // Address family not supported by protocol
+ {EADDRINUSE, "EADDRINUSE"}, // Address already in use
+ {EADDRNOTAVAIL, "EADDRNOTAVAIL"}, // Cannot assign requested address
+ {ENETDOWN, "ENETDOWN"}, // Network is down
+ {ENETUNREACH, "ENETUNREACH"}, // Network is unreachable
+ {ENETRESET, "ENETRESET"}, // Network dropped connection because of reset
+ {ECONNABORTED, "ECONNABORTED"}, // Software caused connection abort
+ {ECONNRESET, "ECONNRESET"}, // Connection reset by peer
+ {ENOBUFS, "ENOBUFS"}, // No buffer space available
+ {EISCONN, "EISCONN"}, // Transport endpoint is already connected
+ {ENOTCONN, "ENOTCONN"}, // Transport endpoint is not connected
+ {ESHUTDOWN, "ESHUTDOWN"}, // Cannot send after transport endpoint shutdown
+ {ETOOMANYREFS, "ETOOMANYREFS"}, // Too many references: cannot splice
+ {ETIMEDOUT, "ETIMEDOUT"}, // Connection timed out
+ {ECONNREFUSED, "ECONNREFUSED"}, // Connection refused
+ {EHOSTDOWN, "EHOSTDOWN"}, // Host is down
+ {EHOSTUNREACH, "EHOSTUNREACH"}, // No route to host
+ {EALREADY, "EALREADY"}, // Operation already in progress
+ {EINPROGRESS, "EINPROGRESS"}, // Operation now in progress
+ {ESTALE, "ESTALE"}, // Stale file handle
+ {EUCLEAN, "EUCLEAN"}, // Structure needs cleaning
+ {ENOTNAM, "ENOTNAM"}, // Not a XENIX named type file
+ {ENAVAIL, "ENAVAIL"}, // No XENIX semaphores available
+ {EISNAM, "EISNAM"}, // Is a named type file
+ {EREMOTEIO, "EREMOTEIO"}, // Remote I/O error
+ {EDQUOT, "EDQUOT"}, // Quota exceeded
+ {ENOMEDIUM, "ENOMEDIUM"}, // No medium found
+ {EMEDIUMTYPE, "EMEDIUMTYPE"}, // Wrong medium type
+ {ECANCELED, "ECANCELED"}, // Operation Canceled
+ {ENOKEY, "ENOKEY"}, // Required key not available
+ {EKEYEXPIRED, "EKEYEXPIRED"}, // Key has expired
+ {EKEYREVOKED, "EKEYREVOKED"}, // Key has been revoked
+ {EKEYREJECTED, "EKEYREJECTED"}, // Key was rejected by service
+ {EOWNERDEAD, "EOWNERDEAD"}, // Owner died
+ {ENOTRECOVERABLE, "ENOTRECOVERABLE"}, // State not recoverable
+ {ERFKILL, "ERFKILL"}, // Operation not possible due to RF-kill
+ {EHWPOISON, "EHWPOISON"}, // Memory page has hardware error
+
+ // Duplicates: EWOULDBLOCK (Operation would block), EDEADLOCK
+};
+
void Error::toStream(std::stringstream& ss, const nlmsgerr& data) const {
- ss << "nlmsgerr{error=" << data.error
- << ", msg=" << toString({&data.msg, sizeof(data.msg)}, mProtocol, false) << "}";
+ ss << "nlmsgerr{";
+ if (data.error == 0) {
+ ss << "ACK";
+ } else {
+ ss << "error=";
+ const auto nameIt = errnoNames.find(-data.error);
+ if (nameIt == errnoNames.end()) {
+ ss << data.error;
+ } else {
+ ss << nameIt->second;
+ }
+ }
+ ss << ", msg=" << toString({&data.msg, sizeof(data.msg)}, mProtocol, false) << "}";
}
} // namespace android::nl::protocols::base
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp
index a3c6736..1e1ad12 100644
--- a/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp
@@ -16,12 +16,19 @@
#include "Ctrl.h"
+#include "families/Nl80211.h"
+
+#include <libnl++/Message.h>
+
namespace android::nl::protocols::generic {
using DataType = AttributeDefinition::DataType;
+using Flags = AttributeDefinition::Flags;
// clang-format off
-Ctrl::Ctrl() : GenericMessageBase(GENL_ID_CTRL, "ID_CTRL", {
+Ctrl::Ctrl(Generic::FamilyRegister& familyRegister)
+ : GenericMessageBase(GENL_ID_CTRL, "ID_CTRL",
+{
{CTRL_CMD_NEWFAMILY, "NEWFAMILY"},
{CTRL_CMD_DELFAMILY, "DELFAMILY"},
{CTRL_CMD_GETFAMILY, "GETFAMILY"},
@@ -33,7 +40,7 @@
{CTRL_CMD_GETMCAST_GRP, "GETMCAST_GRP"},
}, {
{CTRL_ATTR_FAMILY_ID, {"FAMILY_ID", DataType::Uint}},
- {CTRL_ATTR_FAMILY_NAME, {"FAMILY_NAME", DataType::String}},
+ {CTRL_ATTR_FAMILY_NAME, {"FAMILY_NAME", DataType::StringNul}},
{CTRL_ATTR_VERSION, {"VERSION", DataType::Uint}},
{CTRL_ATTR_HDRSIZE, {"HDRSIZE", DataType::Uint}},
{CTRL_ATTR_MAXATTR, {"MAXATTR", DataType::Uint}},
@@ -42,14 +49,31 @@
{CTRL_ATTR_OP_ID, {"ID", DataType::Uint}},
{CTRL_ATTR_OP_FLAGS, {"FLAGS", DataType::Uint}},
}}},
- }}},
+ }, Flags::Verbose}},
{CTRL_ATTR_MCAST_GROUPS, {"MCAST_GROUPS", DataType::Nested, AttributeMap{
{std::nullopt, {"GRP", DataType::Nested, AttributeMap{
- {CTRL_ATTR_MCAST_GRP_NAME, {"NAME", DataType::String}},
+ {CTRL_ATTR_MCAST_GRP_NAME, {"NAME", DataType::StringNul}},
{CTRL_ATTR_MCAST_GRP_ID, {"ID", DataType::Uint}},
}}},
}}},
-}) {}
+}), mFamilyRegister(familyRegister) {}
// clang-format on
+void Ctrl::track(const Buffer<nlmsghdr> hdr) {
+ const auto msgMaybe = Message<genlmsghdr>::parse(hdr, {GENL_ID_CTRL});
+ if (!msgMaybe.has_value()) return;
+ const auto msg = *msgMaybe;
+
+ if (msg->cmd != CTRL_CMD_NEWFAMILY) return;
+ const auto familyId = msg.attributes.get<uint16_t>(CTRL_ATTR_FAMILY_ID);
+ const auto familyName = msg.attributes.get<std::string>(CTRL_ATTR_FAMILY_NAME);
+
+ /* For now, we support just a single family. But if you add more, please define proper
+ * abstraction and not hardcode every name and class here.
+ */
+ if (familyName == "nl80211") {
+ mFamilyRegister[familyId] = std::make_shared<families::Nl80211>(familyId);
+ }
+}
+
} // namespace android::nl::protocols::generic
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.h b/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.h
index 6af87a8..b13df02 100644
--- a/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.h
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.h
@@ -16,13 +16,19 @@
#pragma once
+#include "Generic.h"
#include "GenericMessageBase.h"
namespace android::nl::protocols::generic {
class Ctrl : public GenericMessageBase {
public:
- Ctrl();
+ Ctrl(Generic::FamilyRegister& familyRegister);
+
+ void track(const Buffer<nlmsghdr> hdr) override;
+
+ private:
+ Generic::FamilyRegister& mFamilyRegister;
};
} // namespace android::nl::protocols::generic
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/Generic.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/Generic.cpp
index 1a24914..5e34a1f 100644
--- a/automotive/can/1.0/default/libnl++/protocols/generic/Generic.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/Generic.cpp
@@ -21,11 +21,12 @@
namespace android::nl::protocols::generic {
-Generic::Generic() : NetlinkProtocol(NETLINK_GENERIC, "GENERIC", {std::make_shared<Ctrl>()}) {}
+Generic::Generic()
+ : NetlinkProtocol(NETLINK_GENERIC, "GENERIC", {std::make_shared<Ctrl>(mFamilyRegister)}) {}
-const std::optional<std::reference_wrapper<const MessageDescriptor>> Generic::getMessageDescriptor(
+const std::optional<std::reference_wrapper<MessageDescriptor>> Generic::getMessageDescriptor(
nlmsgtype_t nlmsg_type) {
- const auto desc = NetlinkProtocol::getMessageDescriptor(nlmsg_type);
+ auto desc = NetlinkProtocol::getMessageDescriptor(nlmsg_type);
if (desc.has_value()) return desc;
auto it = mFamilyRegister.find(nlmsg_type);
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/Generic.h b/automotive/can/1.0/default/libnl++/protocols/generic/Generic.h
index 593c92d..2cdd584 100644
--- a/automotive/can/1.0/default/libnl++/protocols/generic/Generic.h
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/Generic.h
@@ -25,13 +25,15 @@
*/
class Generic : public NetlinkProtocol {
public:
+ typedef std::map<nlmsgtype_t, std::shared_ptr<MessageDescriptor>> FamilyRegister;
+
Generic();
- const std::optional<std::reference_wrapper<const MessageDescriptor>> getMessageDescriptor(
+ const std::optional<std::reference_wrapper<MessageDescriptor>> getMessageDescriptor(
nlmsgtype_t nlmsg_type);
private:
- std::map<nlmsgtype_t, std::shared_ptr<const MessageDescriptor>> mFamilyRegister;
+ FamilyRegister mFamilyRegister;
};
} // namespace android::nl::protocols::generic
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp
index 134638e..b7b811b 100644
--- a/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp
@@ -22,16 +22,27 @@
nlmsgtype_t msgtype, const std::string&& msgname,
const std::initializer_list<GenericCommandNameMap::value_type> commandNames,
const std::initializer_list<AttributeMap::value_type> attrTypes)
- : MessageDefinition<genlmsghdr>(msgname, {{msgtype, {msgname, MessageGenre::UNKNOWN}}},
+ : MessageDefinition<genlmsghdr>(msgname, {{msgtype, {msgname, MessageGenre::Unknown}}},
attrTypes),
mCommandNames(commandNames) {}
void GenericMessageBase::toStream(std::stringstream& ss, const genlmsghdr& data) const {
+ const auto commandNameIt = mCommandNames.find(data.cmd);
+ const auto commandName = (commandNameIt == mCommandNames.end())
+ ? std::nullopt
+ : std::optional<std::string>(commandNameIt->second);
+
+ if (commandName.has_value() && data.version == 1 && data.reserved == 0) {
+ // short version
+ ss << *commandName;
+ return;
+ }
+
ss << "genlmsghdr{";
- if (mCommandNames.count(data.cmd) == 0) {
+ if (commandName.has_value()) {
ss << "cmd=" << unsigned(data.cmd);
} else {
- ss << "cmd=" << mCommandNames.find(data.cmd)->second;
+ ss << "cmd=" << *commandName;
}
ss << ", version=" << unsigned(data.version);
if (data.reserved != 0) ss << ", reserved=" << data.reserved;
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/families/Nl80211.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/families/Nl80211.cpp
new file mode 100644
index 0000000..23ec66f
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/families/Nl80211.cpp
@@ -0,0 +1,1009 @@
+/*
+ * 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.
+ */
+
+#include "Nl80211.h"
+
+#include "../../structs.h"
+#include "common.h"
+
+#include <linux/nl80211.h>
+
+#include <iomanip>
+
+namespace android::nl::protocols::generic::families {
+
+/**
+ * Reduce verbosity of printed Information Elements.
+ */
+static constexpr bool kCompactIE = true;
+
+enum {
+ // broken compatibility in Aug 2020
+ NL80211_ATTR_CNTDWN_OFFS_BEACON = NL80211_ATTR_CSA_C_OFF_BEACON,
+ NL80211_ATTR_CNTDWN_OFFS_PRESP = NL80211_ATTR_CSA_C_OFF_PRESP,
+
+ // new fields not available in current Android
+ NL80211_ATTR_FILS_DISCOVERY = NL80211_ATTR_HE_6GHZ_CAPABILITY + 1,
+ NL80211_ATTR_UNSOL_BCAST_PROBE_RESP,
+ NL80211_ATTR_S1G_CAPABILITY,
+ NL80211_ATTR_S1G_CAPABILITY_MASK,
+
+ NL80211_FREQUENCY_ATTR_1MHZ = NL80211_FREQUENCY_ATTR_OFFSET + 1,
+ NL80211_FREQUENCY_ATTR_2MHZ,
+ NL80211_FREQUENCY_ATTR_4MHZ,
+ NL80211_FREQUENCY_ATTR_8MHZ,
+ NL80211_FREQUENCY_ATTR_16MHZ,
+};
+
+enum ieee80211_eid {
+ WLAN_EID_SSID = 0,
+};
+
+using DataType = AttributeDefinition::DataType;
+using Flags = AttributeDefinition::Flags;
+
+static void informationElementsToStream(std::stringstream& ss, const Buffer<nlattr> attr);
+static void nl80211_pattern_supportToStream(std::stringstream& ss, const Buffer<nlattr> attr);
+
+static const AttributeMap iftypes{
+ {NL80211_IFTYPE_UNSPECIFIED, {"UNSPECIFIED", DataType::Flag}},
+ {NL80211_IFTYPE_ADHOC, {"ADHOC", DataType::Flag}},
+ {NL80211_IFTYPE_STATION, {"STATION", DataType::Flag}},
+ {NL80211_IFTYPE_AP, {"AP", DataType::Flag}},
+ {NL80211_IFTYPE_AP_VLAN, {"AP_VLAN", DataType::Flag}},
+ {NL80211_IFTYPE_WDS, {"WDS", DataType::Flag}},
+ {NL80211_IFTYPE_MONITOR, {"MONITOR", DataType::Flag}},
+ {NL80211_IFTYPE_MESH_POINT, {"MESH_POINT", DataType::Flag}},
+ {NL80211_IFTYPE_P2P_CLIENT, {"P2P_CLIENT", DataType::Flag}},
+ {NL80211_IFTYPE_P2P_GO, {"P2P_GO", DataType::Flag}},
+ {NL80211_IFTYPE_P2P_DEVICE, {"P2P_DEVICE", DataType::Flag}},
+ {NL80211_IFTYPE_OCB, {"OCB", DataType::Flag}},
+ {NL80211_IFTYPE_NAN, {"NAN", DataType::Flag}},
+};
+
+// clang-format off
+Nl80211::Nl80211(nlmsgtype_t familyId) : GenericMessageBase(familyId, "nl80211", {
+ /* Script to generate the (initial) top-level list from linux/nl80211.h:
+ * sed -e 's/^ NL80211_CMD_\(.*\),$/ {NL80211_CMD_\1, "\1"},/g'
+ */
+ {NL80211_CMD_UNSPEC, "UNSPEC"},
+
+ {NL80211_CMD_GET_WIPHY, "GET_WIPHY"},
+ {NL80211_CMD_SET_WIPHY, "SET_WIPHY"},
+ {NL80211_CMD_NEW_WIPHY, "NEW_WIPHY"},
+ {NL80211_CMD_DEL_WIPHY, "DEL_WIPHY"},
+
+ {NL80211_CMD_GET_INTERFACE, "GET_INTERFACE"},
+ {NL80211_CMD_SET_INTERFACE, "SET_INTERFACE"},
+ {NL80211_CMD_NEW_INTERFACE, "NEW_INTERFACE"},
+ {NL80211_CMD_DEL_INTERFACE, "DEL_INTERFACE"},
+
+ {NL80211_CMD_GET_KEY, "GET_KEY"},
+ {NL80211_CMD_SET_KEY, "SET_KEY"},
+ {NL80211_CMD_NEW_KEY, "NEW_KEY"},
+ {NL80211_CMD_DEL_KEY, "DEL_KEY"},
+
+ {NL80211_CMD_GET_BEACON, "GET_BEACON"},
+ {NL80211_CMD_SET_BEACON, "SET_BEACON"},
+ {NL80211_CMD_START_AP, "START_AP"},
+ {NL80211_CMD_STOP_AP, "STOP_AP"},
+
+ {NL80211_CMD_GET_STATION, "GET_STATION"},
+ {NL80211_CMD_SET_STATION, "SET_STATION"},
+ {NL80211_CMD_NEW_STATION, "NEW_STATION"},
+ {NL80211_CMD_DEL_STATION, "DEL_STATION"},
+
+ {NL80211_CMD_GET_MPATH, "GET_MPATH"},
+ {NL80211_CMD_SET_MPATH, "SET_MPATH"},
+ {NL80211_CMD_NEW_MPATH, "NEW_MPATH"},
+ {NL80211_CMD_DEL_MPATH, "DEL_MPATH"},
+
+ {NL80211_CMD_SET_BSS, "SET_BSS"},
+
+ {NL80211_CMD_SET_REG, "SET_REG"},
+ {NL80211_CMD_REQ_SET_REG, "REQ_SET_REG"},
+
+ {NL80211_CMD_GET_MESH_CONFIG, "GET_MESH_CONFIG"},
+ {NL80211_CMD_SET_MESH_CONFIG, "SET_MESH_CONFIG"},
+
+ {NL80211_CMD_SET_MGMT_EXTRA_IE, "SET_MGMT_EXTRA_IE"},
+
+ {NL80211_CMD_GET_REG, "GET_REG"},
+
+ {NL80211_CMD_GET_SCAN, "GET_SCAN"},
+ {NL80211_CMD_TRIGGER_SCAN, "TRIGGER_SCAN"},
+ {NL80211_CMD_NEW_SCAN_RESULTS, "NEW_SCAN_RESULTS"},
+ {NL80211_CMD_SCAN_ABORTED, "SCAN_ABORTED"},
+
+ {NL80211_CMD_REG_CHANGE, "REG_CHANGE"},
+
+ {NL80211_CMD_AUTHENTICATE, "AUTHENTICATE"},
+ {NL80211_CMD_ASSOCIATE, "ASSOCIATE"},
+ {NL80211_CMD_DEAUTHENTICATE, "DEAUTHENTICATE"},
+ {NL80211_CMD_DISASSOCIATE, "DISASSOCIATE"},
+
+ {NL80211_CMD_MICHAEL_MIC_FAILURE, "MICHAEL_MIC_FAILURE"},
+
+ {NL80211_CMD_REG_BEACON_HINT, "REG_BEACON_HINT"},
+
+ {NL80211_CMD_JOIN_IBSS, "JOIN_IBSS"},
+ {NL80211_CMD_LEAVE_IBSS, "LEAVE_IBSS"},
+
+ {NL80211_CMD_TESTMODE, "TESTMODE"},
+
+ {NL80211_CMD_CONNECT, "CONNECT"},
+ {NL80211_CMD_ROAM, "ROAM"},
+ {NL80211_CMD_DISCONNECT, "DISCONNECT"},
+
+ {NL80211_CMD_SET_WIPHY_NETNS, "SET_WIPHY_NETNS"},
+
+ {NL80211_CMD_GET_SURVEY, "GET_SURVEY"},
+ {NL80211_CMD_NEW_SURVEY_RESULTS, "NEW_SURVEY_RESULTS"},
+
+ {NL80211_CMD_SET_PMKSA, "SET_PMKSA"},
+ {NL80211_CMD_DEL_PMKSA, "DEL_PMKSA"},
+ {NL80211_CMD_FLUSH_PMKSA, "FLUSH_PMKSA"},
+
+ {NL80211_CMD_REMAIN_ON_CHANNEL, "REMAIN_ON_CHANNEL"},
+ {NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, "CANCEL_REMAIN_ON_CHANNEL"},
+
+ {NL80211_CMD_SET_TX_BITRATE_MASK, "SET_TX_BITRATE_MASK"},
+
+ {NL80211_CMD_REGISTER_FRAME, "REGISTER_FRAME"},
+ {NL80211_CMD_FRAME, "FRAME"},
+ {NL80211_CMD_FRAME_TX_STATUS, "FRAME_TX_STATUS"},
+
+ {NL80211_CMD_SET_POWER_SAVE, "SET_POWER_SAVE"},
+ {NL80211_CMD_GET_POWER_SAVE, "GET_POWER_SAVE"},
+
+ {NL80211_CMD_SET_CQM, "SET_CQM"},
+ {NL80211_CMD_NOTIFY_CQM, "NOTIFY_CQM"},
+
+ {NL80211_CMD_SET_CHANNEL, "SET_CHANNEL"},
+ {NL80211_CMD_SET_WDS_PEER, "SET_WDS_PEER"},
+
+ {NL80211_CMD_FRAME_WAIT_CANCEL, "FRAME_WAIT_CANCEL"},
+
+ {NL80211_CMD_JOIN_MESH, "JOIN_MESH"},
+ {NL80211_CMD_LEAVE_MESH, "LEAVE_MESH"},
+
+ {NL80211_CMD_UNPROT_DEAUTHENTICATE, "UNPROT_DEAUTHENTICATE"},
+ {NL80211_CMD_UNPROT_DISASSOCIATE, "UNPROT_DISASSOCIATE"},
+
+ {NL80211_CMD_NEW_PEER_CANDIDATE, "NEW_PEER_CANDIDATE"},
+
+ {NL80211_CMD_GET_WOWLAN, "GET_WOWLAN"},
+ {NL80211_CMD_SET_WOWLAN, "SET_WOWLAN"},
+
+ {NL80211_CMD_START_SCHED_SCAN, "START_SCHED_SCAN"},
+ {NL80211_CMD_STOP_SCHED_SCAN, "STOP_SCHED_SCAN"},
+ {NL80211_CMD_SCHED_SCAN_RESULTS, "SCHED_SCAN_RESULTS"},
+ {NL80211_CMD_SCHED_SCAN_STOPPED, "SCHED_SCAN_STOPPED"},
+
+ {NL80211_CMD_SET_REKEY_OFFLOAD, "SET_REKEY_OFFLOAD"},
+
+ {NL80211_CMD_PMKSA_CANDIDATE, "PMKSA_CANDIDATE"},
+
+ {NL80211_CMD_TDLS_OPER, "TDLS_OPER"},
+ {NL80211_CMD_TDLS_MGMT, "TDLS_MGMT"},
+
+ {NL80211_CMD_UNEXPECTED_FRAME, "UNEXPECTED_FRAME"},
+
+ {NL80211_CMD_PROBE_CLIENT, "PROBE_CLIENT"},
+
+ {NL80211_CMD_REGISTER_BEACONS, "REGISTER_BEACONS"},
+
+ {NL80211_CMD_UNEXPECTED_4ADDR_FRAME, "UNEXPECTED_4ADDR_FRAME"},
+
+ {NL80211_CMD_SET_NOACK_MAP, "SET_NOACK_MAP"},
+
+ {NL80211_CMD_CH_SWITCH_NOTIFY, "CH_SWITCH_NOTIFY"},
+
+ {NL80211_CMD_START_P2P_DEVICE, "START_P2P_DEVICE"},
+ {NL80211_CMD_STOP_P2P_DEVICE, "STOP_P2P_DEVICE"},
+
+ {NL80211_CMD_CONN_FAILED, "CONN_FAILED"},
+
+ {NL80211_CMD_SET_MCAST_RATE, "SET_MCAST_RATE"},
+
+ {NL80211_CMD_SET_MAC_ACL, "SET_MAC_ACL"},
+
+ {NL80211_CMD_RADAR_DETECT, "RADAR_DETECT"},
+
+ {NL80211_CMD_GET_PROTOCOL_FEATURES, "GET_PROTOCOL_FEATURES"},
+
+ {NL80211_CMD_UPDATE_FT_IES, "UPDATE_FT_IES"},
+ {NL80211_CMD_FT_EVENT, "FT_EVENT"},
+
+ {NL80211_CMD_CRIT_PROTOCOL_START, "CRIT_PROTOCOL_START"},
+ {NL80211_CMD_CRIT_PROTOCOL_STOP, "CRIT_PROTOCOL_STOP"},
+
+ {NL80211_CMD_GET_COALESCE, "GET_COALESCE"},
+ {NL80211_CMD_SET_COALESCE, "SET_COALESCE"},
+
+ {NL80211_CMD_CHANNEL_SWITCH, "CHANNEL_SWITCH"},
+
+ {NL80211_CMD_VENDOR, "VENDOR"},
+
+ {NL80211_CMD_SET_QOS_MAP, "SET_QOS_MAP"},
+
+ {NL80211_CMD_ADD_TX_TS, "ADD_TX_TS"},
+ {NL80211_CMD_DEL_TX_TS, "DEL_TX_TS"},
+
+ {NL80211_CMD_GET_MPP, "GET_MPP"},
+
+ {NL80211_CMD_JOIN_OCB, "JOIN_OCB"},
+ {NL80211_CMD_LEAVE_OCB, "LEAVE_OCB"},
+
+ {NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, "CH_SWITCH_STARTED_NOTIFY"},
+
+ {NL80211_CMD_TDLS_CHANNEL_SWITCH, "TDLS_CHANNEL_SWITCH"},
+ {NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH, "TDLS_CANCEL_CHANNEL_SWITCH"},
+
+ {NL80211_CMD_WIPHY_REG_CHANGE, "WIPHY_REG_CHANGE"},
+
+ {NL80211_CMD_ABORT_SCAN, "ABORT_SCAN"},
+
+ {NL80211_CMD_START_NAN, "START_NAN"},
+ {NL80211_CMD_STOP_NAN, "STOP_NAN"},
+ {NL80211_CMD_ADD_NAN_FUNCTION, "ADD_NAN_FUNCTION"},
+ {NL80211_CMD_DEL_NAN_FUNCTION, "DEL_NAN_FUNCTION"},
+ {NL80211_CMD_CHANGE_NAN_CONFIG, "CHANGE_NAN_CONFIG"},
+ {NL80211_CMD_NAN_MATCH, "NAN_MATCH"},
+
+ {NL80211_CMD_SET_MULTICAST_TO_UNICAST, "SET_MULTICAST_TO_UNICAST"},
+
+ {NL80211_CMD_UPDATE_CONNECT_PARAMS, "UPDATE_CONNECT_PARAMS"},
+
+ {NL80211_CMD_SET_PMK, "SET_PMK"},
+ {NL80211_CMD_DEL_PMK, "DEL_PMK"},
+
+ {NL80211_CMD_PORT_AUTHORIZED, "PORT_AUTHORIZED"},
+
+ {NL80211_CMD_RELOAD_REGDB, "RELOAD_REGDB"},
+
+ {NL80211_CMD_EXTERNAL_AUTH, "EXTERNAL_AUTH"},
+
+ {NL80211_CMD_STA_OPMODE_CHANGED, "STA_OPMODE_CHANGED"},
+
+ {NL80211_CMD_CONTROL_PORT_FRAME, "CONTROL_PORT_FRAME"},
+
+ {NL80211_CMD_GET_FTM_RESPONDER_STATS, "GET_FTM_RESPONDER_STATS"},
+
+ {NL80211_CMD_PEER_MEASUREMENT_START, "PEER_MEASUREMENT_START"},
+ {NL80211_CMD_PEER_MEASUREMENT_RESULT, "PEER_MEASUREMENT_RESULT"},
+ {NL80211_CMD_PEER_MEASUREMENT_COMPLETE, "PEER_MEASUREMENT_COMPLETE"},
+
+ {NL80211_CMD_NOTIFY_RADAR, "NOTIFY_RADAR"},
+
+ {NL80211_CMD_UPDATE_OWE_INFO, "UPDATE_OWE_INFO"},
+
+ {NL80211_CMD_PROBE_MESH_LINK, "PROBE_MESH_LINK"},
+
+ {NL80211_CMD_SET_TID_CONFIG, "SET_TID_CONFIG"},
+
+ {NL80211_CMD_UNPROT_BEACON, "UNPROT_BEACON"},
+
+ {NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS, "CONTROL_PORT_FRAME_TX_STATUS"},
+}, {
+ /* Script to generate the (initial) top-level list from linux/nl80211.h:
+ * sed -e 's/^\tNL80211_ATTR_\(.*\),$/ {NL80211_ATTR_\1, {"\1"}},/g'
+ */
+ {NL80211_ATTR_UNSPEC, {"UNSPEC"}},
+
+ {NL80211_ATTR_WIPHY, {"WIPHY", DataType::Uint}},
+ {NL80211_ATTR_WIPHY_NAME, {"WIPHY_NAME", DataType::StringNul}},
+
+ {NL80211_ATTR_IFINDEX, {"IFINDEX", DataType::Uint}},
+ {NL80211_ATTR_IFNAME, {"IFNAME", DataType::StringNul}},
+ {NL80211_ATTR_IFTYPE, {"IFTYPE", DataType::Uint}},
+
+ {NL80211_ATTR_MAC, {"MAC", DataType::Raw}},
+
+ {NL80211_ATTR_KEY_DATA, {"KEY_DATA"}},
+ {NL80211_ATTR_KEY_IDX, {"KEY_IDX"}},
+ {NL80211_ATTR_KEY_CIPHER, {"KEY_CIPHER"}},
+ {NL80211_ATTR_KEY_SEQ, {"KEY_SEQ"}},
+ {NL80211_ATTR_KEY_DEFAULT, {"KEY_DEFAULT"}},
+
+ {NL80211_ATTR_BEACON_INTERVAL, {"BEACON_INTERVAL"}},
+ {NL80211_ATTR_DTIM_PERIOD, {"DTIM_PERIOD"}},
+ {NL80211_ATTR_BEACON_HEAD, {"BEACON_HEAD"}},
+ {NL80211_ATTR_BEACON_TAIL, {"BEACON_TAIL"}},
+
+ {NL80211_ATTR_STA_AID, {"STA_AID"}},
+ {NL80211_ATTR_STA_FLAGS, {"STA_FLAGS"}},
+ {NL80211_ATTR_STA_LISTEN_INTERVAL, {"STA_LISTEN_INTERVAL"}},
+ {NL80211_ATTR_STA_SUPPORTED_RATES, {"STA_SUPPORTED_RATES"}},
+ {NL80211_ATTR_STA_VLAN, {"STA_VLAN"}},
+ {NL80211_ATTR_STA_INFO, {"STA_INFO"}},
+
+ {NL80211_ATTR_WIPHY_BANDS, {"WIPHY_BANDS", DataType::Nested, AttributeMap{
+ {std::nullopt, {"BAND", DataType::Nested, AttributeMap{
+ {NL80211_BAND_ATTR_FREQS, {"FREQS", DataType::Nested, AttributeMap{
+ {std::nullopt, {"FQ", DataType::Nested, AttributeMap{
+ {NL80211_FREQUENCY_ATTR_FREQ, {"FREQ", DataType::Uint}},
+ {NL80211_FREQUENCY_ATTR_DISABLED, {"DISABLED", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_NO_IR, {"NO_IR", DataType::Flag}},
+ {__NL80211_FREQUENCY_ATTR_NO_IBSS, {"_NO_IBSS", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_RADAR, {"RADAR", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_MAX_TX_POWER, {"MAX_TX_POWER", DataType::Uint}},
+ {NL80211_FREQUENCY_ATTR_DFS_STATE, {"DFS_STATE", DataType::Uint}},
+ {NL80211_FREQUENCY_ATTR_DFS_TIME, {"DFS_TIME", DataType::Uint}},
+ {NL80211_FREQUENCY_ATTR_NO_HT40_MINUS, {"NO_HT40_MINUS", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_NO_HT40_PLUS, {"NO_HT40_PLUS", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_NO_80MHZ, {"NO_80MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_NO_160MHZ, {"NO_160MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, {"DFS_CAC_TIME", DataType::Uint}},
+ {NL80211_FREQUENCY_ATTR_INDOOR_ONLY, {"INDOOR_ONLY", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_IR_CONCURRENT, {"IR_CONCURRENT", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_NO_20MHZ, {"NO_20MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_NO_10MHZ, {"NO_10MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_WMM, {"WMM"}},
+ {NL80211_FREQUENCY_ATTR_NO_HE, {"NO_HE", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_OFFSET, {"OFFSET", DataType::Uint}},
+ {NL80211_FREQUENCY_ATTR_1MHZ, {"1MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_2MHZ, {"2MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_4MHZ, {"4MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_8MHZ, {"8MHZ", DataType::Flag}},
+ {NL80211_FREQUENCY_ATTR_16MHZ, {"16MHZ", DataType::Flag}},
+ }}},
+ }, Flags::Verbose}},
+ {NL80211_BAND_ATTR_RATES, {"RATES", DataType::Nested, AttributeMap{
+ {std::nullopt, {"RATE", DataType::Nested, AttributeMap{
+ {NL80211_BITRATE_ATTR_RATE, {"RATE", DataType::Uint}},
+ {NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE,
+ {"2GHZ_SHORTPREAMBLE", DataType::Flag}},
+ }}},
+ }}},
+
+ {NL80211_BAND_ATTR_HT_MCS_SET, {"HT_MCS_SET"}}, // struct ieee80211_mcs_info
+ {NL80211_BAND_ATTR_HT_CAPA, {"HT_CAPA", DataType::Uint}},
+ {NL80211_BAND_ATTR_HT_AMPDU_FACTOR, {"HT_AMPDU_FACTOR", DataType::Uint}},
+ {NL80211_BAND_ATTR_HT_AMPDU_DENSITY, {"HT_AMPDU_DENSITY", DataType::Uint}},
+
+ {NL80211_BAND_ATTR_VHT_MCS_SET, {"VHT_MCS_SET"}}, // struct ieee80211_vht_mcs_info
+ {NL80211_BAND_ATTR_VHT_CAPA, {"VHT_CAPA", DataType::Uint}},
+ {NL80211_BAND_ATTR_IFTYPE_DATA, {"IFTYPE_DATA"}},
+
+ {NL80211_BAND_ATTR_EDMG_CHANNELS, {"EDMG_CHANNELS"}},
+ {NL80211_BAND_ATTR_EDMG_BW_CONFIG, {"EDMG_BW_CONFIG"}},
+ }}},
+ }, Flags::Verbose}},
+
+ {NL80211_ATTR_MNTR_FLAGS, {"MNTR_FLAGS"}},
+
+ {NL80211_ATTR_MESH_ID, {"MESH_ID"}},
+ {NL80211_ATTR_STA_PLINK_ACTION, {"STA_PLINK_ACTION"}},
+ {NL80211_ATTR_MPATH_NEXT_HOP, {"MPATH_NEXT_HOP"}},
+ {NL80211_ATTR_MPATH_INFO, {"MPATH_INFO"}},
+
+ {NL80211_ATTR_BSS_CTS_PROT, {"BSS_CTS_PROT"}},
+ {NL80211_ATTR_BSS_SHORT_PREAMBLE, {"BSS_SHORT_PREAMBLE"}},
+ {NL80211_ATTR_BSS_SHORT_SLOT_TIME, {"BSS_SHORT_SLOT_TIME"}},
+
+ {NL80211_ATTR_HT_CAPABILITY, {"HT_CAPABILITY"}},
+
+ {NL80211_ATTR_SUPPORTED_IFTYPES, {"SUPPORTED_IFTYPES", DataType::Nested, iftypes}},
+
+ {NL80211_ATTR_REG_ALPHA2, {"REG_ALPHA2"}},
+ {NL80211_ATTR_REG_RULES, {"REG_RULES"}},
+
+ {NL80211_ATTR_MESH_CONFIG, {"MESH_CONFIG"}},
+
+ {NL80211_ATTR_BSS_BASIC_RATES, {"BSS_BASIC_RATES"}},
+
+ {NL80211_ATTR_WIPHY_TXQ_PARAMS, {"WIPHY_TXQ_PARAMS"}},
+ {NL80211_ATTR_WIPHY_FREQ, {"WIPHY_FREQ"}},
+ {NL80211_ATTR_WIPHY_CHANNEL_TYPE, {"WIPHY_CHANNEL_TYPE"}},
+
+ {NL80211_ATTR_KEY_DEFAULT_MGMT, {"KEY_DEFAULT_MGMT"}},
+
+ {NL80211_ATTR_MGMT_SUBTYPE, {"MGMT_SUBTYPE"}},
+ {NL80211_ATTR_IE, {"IE"}},
+
+ {NL80211_ATTR_MAX_NUM_SCAN_SSIDS, {"MAX_NUM_SCAN_SSIDS", DataType::Uint}},
+
+ {NL80211_ATTR_SCAN_FREQUENCIES, {"SCAN_FREQUENCIES", DataType::Nested, AttributeMap{
+ {std::nullopt, {"FQ", DataType::Uint}},
+ }, Flags::Verbose}},
+ {NL80211_ATTR_SCAN_SSIDS, {"SCAN_SSIDS", DataType::Nested, AttributeMap{
+ {std::nullopt, {"SSID", DataType::String}},
+ }}},
+ {NL80211_ATTR_GENERATION, {"GENERATION", DataType::Uint}},
+ {NL80211_ATTR_BSS, {"BSS", DataType::Nested, AttributeMap{
+ {NL80211_BSS_BSSID, {"BSSID", DataType::Raw}},
+ {NL80211_BSS_FREQUENCY, {"FREQUENCY", DataType::Uint}},
+ {NL80211_BSS_TSF, {"TSF", DataType::Uint}},
+ {NL80211_BSS_BEACON_INTERVAL, {"BEACON_INTERVAL", DataType::Uint}},
+ {NL80211_BSS_CAPABILITY, {"CAPABILITY", DataType::Uint}},
+ {NL80211_BSS_INFORMATION_ELEMENTS, {"INFORMATION_ELEMENTS",
+ DataType::Struct, informationElementsToStream}},
+ {NL80211_BSS_SIGNAL_MBM, {"SIGNAL_MBM", DataType::Uint}},
+ {NL80211_BSS_SIGNAL_UNSPEC, {"SIGNAL_UNSPEC", DataType::Uint}},
+ {NL80211_BSS_STATUS, {"STATUS", DataType::Uint}}, // enum nl80211_bss_status
+ {NL80211_BSS_SEEN_MS_AGO, {"SEEN_MS_AGO", DataType::Uint}},
+ {NL80211_BSS_BEACON_IES, {"BEACON_IES", DataType::Struct, informationElementsToStream}},
+ {NL80211_BSS_CHAN_WIDTH, {"CHAN_WIDTH", DataType::Uint}},
+ {NL80211_BSS_BEACON_TSF, {"BEACON_TSF", DataType::Uint}},
+ {NL80211_BSS_PRESP_DATA, {"PRESP_DATA", DataType::Flag}},
+ {NL80211_BSS_LAST_SEEN_BOOTTIME, {"LAST_SEEN_BOOTTIME", DataType::Uint}},
+ {NL80211_BSS_PAD, {"PAD"}},
+ {NL80211_BSS_PARENT_TSF, {"PARENT_TSF"}},
+ {NL80211_BSS_PARENT_BSSID, {"PARENT_BSSID"}},
+ {NL80211_BSS_CHAIN_SIGNAL, {"CHAIN_SIGNAL", DataType::Nested, AttributeMap{
+ {std::nullopt, {"SIG", DataType::Uint}},
+ }}},
+ {NL80211_BSS_FREQUENCY_OFFSET, {"FREQUENCY_OFFSET"}},
+ }}},
+
+ {NL80211_ATTR_REG_INITIATOR, {"REG_INITIATOR"}},
+ {NL80211_ATTR_REG_TYPE, {"REG_TYPE"}},
+
+ {NL80211_ATTR_SUPPORTED_COMMANDS, {"SUPPORTED_COMMANDS", DataType::Nested,AttributeMap{
+ {std::nullopt, {"CMD", DataType::Uint}}, // enum nl80211_commands
+ }}},
+
+ {NL80211_ATTR_FRAME, {"FRAME"}},
+ {NL80211_ATTR_SSID, {"SSID"}},
+ {NL80211_ATTR_AUTH_TYPE, {"AUTH_TYPE"}},
+ {NL80211_ATTR_REASON_CODE, {"REASON_CODE"}},
+
+ {NL80211_ATTR_KEY_TYPE, {"KEY_TYPE"}},
+
+ {NL80211_ATTR_MAX_SCAN_IE_LEN, {"MAX_SCAN_IE_LEN", DataType::Uint}},
+ {NL80211_ATTR_CIPHER_SUITES, {"CIPHER_SUITES", DataType::Struct, arrayToStream<int32_t>}},
+
+ {NL80211_ATTR_FREQ_BEFORE, {"FREQ_BEFORE"}},
+ {NL80211_ATTR_FREQ_AFTER, {"FREQ_AFTER"}},
+
+ {NL80211_ATTR_FREQ_FIXED, {"FREQ_FIXED"}},
+
+ {NL80211_ATTR_WIPHY_RETRY_SHORT, {"WIPHY_RETRY_SHORT", DataType::Uint}},
+ {NL80211_ATTR_WIPHY_RETRY_LONG, {"WIPHY_RETRY_LONG", DataType::Uint}},
+ {NL80211_ATTR_WIPHY_FRAG_THRESHOLD, {"WIPHY_FRAG_THRESHOLD", DataType::Uint}},
+ {NL80211_ATTR_WIPHY_RTS_THRESHOLD, {"WIPHY_RTS_THRESHOLD", DataType::Uint}},
+
+ {NL80211_ATTR_TIMED_OUT, {"TIMED_OUT"}},
+
+ {NL80211_ATTR_USE_MFP, {"USE_MFP"}},
+
+ {NL80211_ATTR_STA_FLAGS2, {"STA_FLAGS2"}},
+
+ {NL80211_ATTR_CONTROL_PORT, {"CONTROL_PORT"}},
+
+ {NL80211_ATTR_TESTDATA, {"TESTDATA"}},
+
+ {NL80211_ATTR_PRIVACY, {"PRIVACY"}},
+
+ {NL80211_ATTR_DISCONNECTED_BY_AP, {"DISCONNECTED_BY_AP"}},
+ {NL80211_ATTR_STATUS_CODE, {"STATUS_CODE"}},
+
+ {NL80211_ATTR_CIPHER_SUITES_PAIRWISE, {"CIPHER_SUITES_PAIRWISE"}},
+ {NL80211_ATTR_CIPHER_SUITE_GROUP, {"CIPHER_SUITE_GROUP"}},
+ {NL80211_ATTR_WPA_VERSIONS, {"WPA_VERSIONS"}},
+ {NL80211_ATTR_AKM_SUITES, {"AKM_SUITES"}},
+
+ {NL80211_ATTR_REQ_IE, {"REQ_IE"}},
+ {NL80211_ATTR_RESP_IE, {"RESP_IE"}},
+
+ {NL80211_ATTR_PREV_BSSID, {"PREV_BSSID"}},
+
+ {NL80211_ATTR_KEY, {"KEY"}},
+ {NL80211_ATTR_KEYS, {"KEYS"}},
+
+ {NL80211_ATTR_PID, {"PID"}},
+
+ {NL80211_ATTR_4ADDR, {"4ADDR"}},
+
+ {NL80211_ATTR_SURVEY_INFO, {"SURVEY_INFO"}},
+
+ {NL80211_ATTR_PMKID, {"PMKID"}},
+ {NL80211_ATTR_MAX_NUM_PMKIDS, {"MAX_NUM_PMKIDS", DataType::Uint}},
+
+ {NL80211_ATTR_DURATION, {"DURATION"}},
+
+ {NL80211_ATTR_COOKIE, {"COOKIE"}},
+
+ {NL80211_ATTR_WIPHY_COVERAGE_CLASS, {"WIPHY_COVERAGE_CLASS", DataType::Uint}},
+
+ {NL80211_ATTR_TX_RATES, {"TX_RATES"}},
+
+ {NL80211_ATTR_FRAME_MATCH, {"FRAME_MATCH"}},
+
+ {NL80211_ATTR_ACK, {"ACK"}},
+
+ {NL80211_ATTR_PS_STATE, {"PS_STATE"}},
+
+ {NL80211_ATTR_CQM, {"CQM"}},
+
+ {NL80211_ATTR_LOCAL_STATE_CHANGE, {"LOCAL_STATE_CHANGE"}},
+
+ {NL80211_ATTR_AP_ISOLATE, {"AP_ISOLATE"}},
+
+ {NL80211_ATTR_WIPHY_TX_POWER_SETTING, {"WIPHY_TX_POWER_SETTING"}},
+ {NL80211_ATTR_WIPHY_TX_POWER_LEVEL, {"WIPHY_TX_POWER_LEVEL"}},
+
+ {NL80211_ATTR_TX_FRAME_TYPES, {"TX_FRAME_TYPES", DataType::Nested, AttributeMap{
+ {std::nullopt, {"TFT", DataType::Nested, AttributeMap{
+ {NL80211_ATTR_FRAME_TYPE, {"FRAME_TYPE", DataType::Uint}},
+ }}},
+ }, Flags::Verbose}},
+ {NL80211_ATTR_RX_FRAME_TYPES, {"RX_FRAME_TYPES", DataType::Nested, AttributeMap{
+ {std::nullopt, {"RFT", DataType::Nested, AttributeMap{
+ {NL80211_ATTR_FRAME_TYPE, {"FRAME_TYPE", DataType::Uint}},
+ }}},
+ }, Flags::Verbose}},
+
+ {NL80211_ATTR_FRAME_TYPE, {"FRAME_TYPE", DataType::Uint}},
+
+ {NL80211_ATTR_CONTROL_PORT_ETHERTYPE, {"CONTROL_PORT_ETHERTYPE"}},
+ {NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, {"CONTROL_PORT_NO_ENCRYPT"}},
+
+ {NL80211_ATTR_SUPPORT_IBSS_RSN, {"SUPPORT_IBSS_RSN"}},
+
+ {NL80211_ATTR_WIPHY_ANTENNA_TX, {"WIPHY_ANTENNA_TX"}},
+ {NL80211_ATTR_WIPHY_ANTENNA_RX, {"WIPHY_ANTENNA_RX"}},
+
+ {NL80211_ATTR_MCAST_RATE, {"MCAST_RATE"}},
+
+ {NL80211_ATTR_OFFCHANNEL_TX_OK, {"OFFCHANNEL_TX_OK", DataType::Flag}},
+
+ {NL80211_ATTR_BSS_HT_OPMODE, {"BSS_HT_OPMODE"}},
+
+ {NL80211_ATTR_KEY_DEFAULT_TYPES, {"KEY_DEFAULT_TYPES"}},
+
+ {NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
+ {"MAX_REMAIN_ON_CHANNEL_DURATION", DataType::Uint}},
+
+ {NL80211_ATTR_MESH_SETUP, {"MESH_SETUP"}},
+
+ {NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, {"WIPHY_ANTENNA_AVAIL_TX", DataType::Uint}},
+ {NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, {"WIPHY_ANTENNA_AVAIL_RX", DataType::Uint}},
+
+ {NL80211_ATTR_SUPPORT_MESH_AUTH, {"SUPPORT_MESH_AUTH"}},
+ {NL80211_ATTR_STA_PLINK_STATE, {"STA_PLINK_STATE"}},
+
+ {NL80211_ATTR_WOWLAN_TRIGGERS, {"WOWLAN_TRIGGERS"}},
+ {NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
+ {"WOWLAN_TRIGGERS_SUPPORTED", DataType::Nested, AttributeMap{
+ {NL80211_WOWLAN_TRIG_ANY, {"ANY", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_DISCONNECT, {"DISCONNECT", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_MAGIC_PKT, {"MAGIC_PKT", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_PKT_PATTERN,
+ {"PKT_PATTERN", DataType::Struct, nl80211_pattern_supportToStream}},
+ {NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED, {"GTK_REKEY_SUPPORTED", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE, {"GTK_REKEY_FAILURE", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, {"EAP_IDENT_REQUEST", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, {"4WAY_HANDSHAKE", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_RFKILL_RELEASE, {"RFKILL_RELEASE", DataType::Flag}},
+ {NL80211_WOWLAN_TRIG_TCP_CONNECTION, {"TCP_CONNECTION", DataType::Nested, AttributeMap{
+ {NL80211_WOWLAN_TCP_SRC_IPV4, {"SRC_IPV4"}},
+ {NL80211_WOWLAN_TCP_DST_IPV4, {"DST_IPV4"}},
+ {NL80211_WOWLAN_TCP_DST_MAC, {"DST_MAC"}},
+ {NL80211_WOWLAN_TCP_SRC_PORT, {"SRC_PORT", DataType::Uint}},
+ {NL80211_WOWLAN_TCP_DST_PORT, {"DST_PORT", DataType::Uint}},
+ {NL80211_WOWLAN_TCP_DATA_PAYLOAD, {"DATA_PAYLOAD"}},
+ {NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ, {"DATA_PAYLOAD_SEQ"}},
+ {NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN, {"DATA_PAYLOAD_TOKEN"}},
+ {NL80211_WOWLAN_TCP_DATA_INTERVAL, {"DATA_INTERVAL", DataType::Uint}},
+ {NL80211_WOWLAN_TCP_WAKE_PAYLOAD, {"WAKE_PAYLOAD"}},
+ {NL80211_WOWLAN_TCP_WAKE_MASK, {"WAKE_MASK"}},
+ }}},
+ {NL80211_WOWLAN_TRIG_NET_DETECT, {"NET_DETECT", DataType::Uint}},
+
+ /* Not in WOWLAN_TRIGGERS_SUPPORTED:
+ * - NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211
+ * - NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN
+ * - NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023
+ * - NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN
+ * - NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH
+ * - NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST
+ * - NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS
+ * - NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS
+ */
+ }}},
+
+ {NL80211_ATTR_SCHED_SCAN_INTERVAL, {"SCHED_SCAN_INTERVAL"}},
+
+ {NL80211_ATTR_INTERFACE_COMBINATIONS, {"INTERFACE_COMBINATIONS", DataType::Nested, AttributeMap{
+ {std::nullopt, {"IC", DataType::Nested, AttributeMap{
+ {NL80211_IFACE_COMB_UNSPEC, {"UNSPEC"}},
+ {NL80211_IFACE_COMB_LIMITS, {"LIMITS", DataType::Nested, AttributeMap{
+ {std::nullopt, {"LT", DataType::Nested, AttributeMap{
+ {NL80211_IFACE_LIMIT_UNSPEC, {"UNSPEC"}},
+ {NL80211_IFACE_LIMIT_MAX, {"MAX", DataType::Uint}},
+ {NL80211_IFACE_LIMIT_TYPES, {"TYPES", DataType::Nested, iftypes}},
+ }}},
+ }}},
+ {NL80211_IFACE_COMB_MAXNUM, {"MAXNUM", DataType::Uint}},
+ {NL80211_IFACE_COMB_STA_AP_BI_MATCH, {"STA_AP_BI_MATCH", DataType::Flag}},
+ {NL80211_IFACE_COMB_NUM_CHANNELS, {"NUM_CHANNELS", DataType::Uint}},
+ {NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, {"RADAR_DETECT_WIDTHS", DataType::Uint}},
+ {NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, {"RADAR_DETECT_REGIONS", DataType::Uint}},
+ {NL80211_IFACE_COMB_BI_MIN_GCD, {"BI_MIN_GCD"}},
+ }}},
+ }, Flags::Verbose}},
+ {NL80211_ATTR_SOFTWARE_IFTYPES, {"SOFTWARE_IFTYPES", DataType::Nested, iftypes}},
+
+ {NL80211_ATTR_REKEY_DATA, {"REKEY_DATA"}},
+
+ {NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, {"MAX_NUM_SCHED_SCAN_SSIDS", DataType::Uint}},
+ {NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, {"MAX_SCHED_SCAN_IE_LEN", DataType::Uint}},
+
+ {NL80211_ATTR_SCAN_SUPP_RATES, {"SCAN_SUPP_RATES"}},
+
+ {NL80211_ATTR_HIDDEN_SSID, {"HIDDEN_SSID"}},
+
+ {NL80211_ATTR_IE_PROBE_RESP, {"IE_PROBE_RESP"}},
+ {NL80211_ATTR_IE_ASSOC_RESP, {"IE_ASSOC_RESP"}},
+
+ {NL80211_ATTR_STA_WME, {"STA_WME"}},
+ {NL80211_ATTR_SUPPORT_AP_UAPSD, {"SUPPORT_AP_UAPSD"}},
+
+ {NL80211_ATTR_ROAM_SUPPORT, {"ROAM_SUPPORT", DataType::Flag}},
+
+ {NL80211_ATTR_SCHED_SCAN_MATCH, {"SCHED_SCAN_MATCH"}},
+ {NL80211_ATTR_MAX_MATCH_SETS, {"MAX_MATCH_SETS", DataType::Uint}},
+
+ {NL80211_ATTR_PMKSA_CANDIDATE, {"PMKSA_CANDIDATE"}},
+
+ {NL80211_ATTR_TX_NO_CCK_RATE, {"TX_NO_CCK_RATE"}},
+
+ {NL80211_ATTR_TDLS_ACTION, {"TDLS_ACTION"}},
+ {NL80211_ATTR_TDLS_DIALOG_TOKEN, {"TDLS_DIALOG_TOKEN"}},
+ {NL80211_ATTR_TDLS_OPERATION, {"TDLS_OPERATION"}},
+ {NL80211_ATTR_TDLS_SUPPORT, {"TDLS_SUPPORT", DataType::Flag}},
+ {NL80211_ATTR_TDLS_EXTERNAL_SETUP, {"TDLS_EXTERNAL_SETUP", DataType::Flag}},
+
+ {NL80211_ATTR_DEVICE_AP_SME, {"DEVICE_AP_SME", DataType::Uint}},
+
+ {NL80211_ATTR_DONT_WAIT_FOR_ACK, {"DONT_WAIT_FOR_ACK"}},
+
+ {NL80211_ATTR_FEATURE_FLAGS, {"FEATURE_FLAGS", DataType::Uint}},
+
+ {NL80211_ATTR_PROBE_RESP_OFFLOAD, {"PROBE_RESP_OFFLOAD", DataType::Uint}},
+
+ {NL80211_ATTR_PROBE_RESP, {"PROBE_RESP"}},
+
+ {NL80211_ATTR_DFS_REGION, {"DFS_REGION"}},
+
+ {NL80211_ATTR_DISABLE_HT, {"DISABLE_HT"}},
+ {NL80211_ATTR_HT_CAPABILITY_MASK, {"HT_CAPABILITY_MASK"}},
+
+ {NL80211_ATTR_NOACK_MAP, {"NOACK_MAP"}},
+
+ {NL80211_ATTR_INACTIVITY_TIMEOUT, {"INACTIVITY_TIMEOUT"}},
+
+ {NL80211_ATTR_RX_SIGNAL_DBM, {"RX_SIGNAL_DBM"}},
+
+ {NL80211_ATTR_BG_SCAN_PERIOD, {"BG_SCAN_PERIOD"}},
+
+ {NL80211_ATTR_WDEV, {"WDEV", DataType::Uint}},
+
+ {NL80211_ATTR_USER_REG_HINT_TYPE, {"USER_REG_HINT_TYPE"}},
+
+ {NL80211_ATTR_CONN_FAILED_REASON, {"CONN_FAILED_REASON"}},
+
+ {NL80211_ATTR_AUTH_DATA, {"AUTH_DATA"}},
+
+ {NL80211_ATTR_VHT_CAPABILITY, {"VHT_CAPABILITY"}},
+
+ {NL80211_ATTR_SCAN_FLAGS, {"SCAN_FLAGS", DataType::Uint}},
+
+ {NL80211_ATTR_CHANNEL_WIDTH, {"CHANNEL_WIDTH"}},
+ {NL80211_ATTR_CENTER_FREQ1, {"CENTER_FREQ1"}},
+ {NL80211_ATTR_CENTER_FREQ2, {"CENTER_FREQ2"}},
+
+ {NL80211_ATTR_P2P_CTWINDOW, {"P2P_CTWINDOW"}},
+ {NL80211_ATTR_P2P_OPPPS, {"P2P_OPPPS"}},
+
+ {NL80211_ATTR_LOCAL_MESH_POWER_MODE, {"LOCAL_MESH_POWER_MODE"}},
+
+ {NL80211_ATTR_ACL_POLICY, {"ACL_POLICY"}},
+
+ {NL80211_ATTR_MAC_ADDRS, {"MAC_ADDRS"}},
+
+ {NL80211_ATTR_MAC_ACL_MAX, {"MAC_ACL_MAX", DataType::Uint}},
+
+ {NL80211_ATTR_RADAR_EVENT, {"RADAR_EVENT"}},
+
+ {NL80211_ATTR_EXT_CAPA, {"EXT_CAPA"}},
+ {NL80211_ATTR_EXT_CAPA_MASK, {"EXT_CAPA_MASK"}},
+
+ {NL80211_ATTR_STA_CAPABILITY, {"STA_CAPABILITY"}},
+ {NL80211_ATTR_STA_EXT_CAPABILITY, {"STA_EXT_CAPABILITY"}},
+
+ {NL80211_ATTR_PROTOCOL_FEATURES, {"PROTOCOL_FEATURES", DataType::Uint}},
+ {NL80211_ATTR_SPLIT_WIPHY_DUMP, {"SPLIT_WIPHY_DUMP", DataType::Flag}},
+
+ {NL80211_ATTR_DISABLE_VHT, {"DISABLE_VHT", DataType::Flag}},
+ {NL80211_ATTR_VHT_CAPABILITY_MASK, {"VHT_CAPABILITY_MASK"}},
+
+ {NL80211_ATTR_MDID, {"MDID"}},
+ {NL80211_ATTR_IE_RIC, {"IE_RIC"}},
+
+ {NL80211_ATTR_CRIT_PROT_ID, {"CRIT_PROT_ID"}},
+ {NL80211_ATTR_MAX_CRIT_PROT_DURATION, {"MAX_CRIT_PROT_DURATION"}},
+
+ {NL80211_ATTR_PEER_AID, {"PEER_AID"}},
+
+ {NL80211_ATTR_COALESCE_RULE, {"COALESCE_RULE"}},
+
+ {NL80211_ATTR_CH_SWITCH_COUNT, {"CH_SWITCH_COUNT"}},
+ {NL80211_ATTR_CH_SWITCH_BLOCK_TX, {"CH_SWITCH_BLOCK_TX"}},
+ {NL80211_ATTR_CSA_IES, {"CSA_IES"}},
+ {NL80211_ATTR_CNTDWN_OFFS_BEACON, {"CNTDWN_OFFS_BEACON"}},
+ {NL80211_ATTR_CNTDWN_OFFS_PRESP, {"CNTDWN_OFFS_PRESP"}},
+
+ {NL80211_ATTR_RXMGMT_FLAGS, {"RXMGMT_FLAGS"}},
+
+ {NL80211_ATTR_STA_SUPPORTED_CHANNELS, {"STA_SUPPORTED_CHANNELS"}},
+
+ {NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES, {"STA_SUPPORTED_OPER_CLASSES"}},
+
+ {NL80211_ATTR_HANDLE_DFS, {"HANDLE_DFS"}},
+
+ {NL80211_ATTR_SUPPORT_5_MHZ, {"SUPPORT_5_MHZ"}},
+ {NL80211_ATTR_SUPPORT_10_MHZ, {"SUPPORT_10_MHZ"}},
+
+ {NL80211_ATTR_OPMODE_NOTIF, {"OPMODE_NOTIF"}},
+
+ {NL80211_ATTR_VENDOR_ID, {"VENDOR_ID"}},
+ {NL80211_ATTR_VENDOR_SUBCMD, {"VENDOR_SUBCMD"}},
+ {NL80211_ATTR_VENDOR_DATA, {"VENDOR_DATA", DataType::Raw, AttributeMap{}, Flags::Verbose}},
+ {NL80211_ATTR_VENDOR_EVENTS, {"VENDOR_EVENTS", DataType::Nested, AttributeMap{},
+ Flags::Verbose}},
+
+ {NL80211_ATTR_QOS_MAP, {"QOS_MAP"}},
+
+ {NL80211_ATTR_MAC_HINT, {"MAC_HINT"}},
+ {NL80211_ATTR_WIPHY_FREQ_HINT, {"WIPHY_FREQ_HINT"}},
+
+ {NL80211_ATTR_MAX_AP_ASSOC_STA, {"MAX_AP_ASSOC_STA"}},
+
+ {NL80211_ATTR_TDLS_PEER_CAPABILITY, {"TDLS_PEER_CAPABILITY"}},
+
+ {NL80211_ATTR_SOCKET_OWNER, {"SOCKET_OWNER"}},
+
+ {NL80211_ATTR_CSA_C_OFFSETS_TX, {"CSA_C_OFFSETS_TX"}},
+ {NL80211_ATTR_MAX_CSA_COUNTERS, {"MAX_CSA_COUNTERS"}},
+
+ {NL80211_ATTR_TDLS_INITIATOR, {"TDLS_INITIATOR"}},
+
+ {NL80211_ATTR_USE_RRM, {"USE_RRM"}},
+
+ {NL80211_ATTR_WIPHY_DYN_ACK, {"WIPHY_DYN_ACK"}},
+
+ {NL80211_ATTR_TSID, {"TSID"}},
+ {NL80211_ATTR_USER_PRIO, {"USER_PRIO"}},
+ {NL80211_ATTR_ADMITTED_TIME, {"ADMITTED_TIME"}},
+
+ {NL80211_ATTR_SMPS_MODE, {"SMPS_MODE"}},
+
+ {NL80211_ATTR_OPER_CLASS, {"OPER_CLASS"}},
+
+ {NL80211_ATTR_MAC_MASK, {"MAC_MASK"}},
+
+ {NL80211_ATTR_WIPHY_SELF_MANAGED_REG, {"WIPHY_SELF_MANAGED_REG"}},
+
+ {NL80211_ATTR_EXT_FEATURES, {"EXT_FEATURES"}},
+
+ {NL80211_ATTR_SURVEY_RADIO_STATS, {"SURVEY_RADIO_STATS"}},
+
+ {NL80211_ATTR_NETNS_FD, {"NETNS_FD"}},
+
+ {NL80211_ATTR_SCHED_SCAN_DELAY, {"SCHED_SCAN_DELAY"}},
+
+ {NL80211_ATTR_REG_INDOOR, {"REG_INDOOR"}},
+
+ {NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, {"MAX_NUM_SCHED_SCAN_PLANS", DataType::Uint}},
+ {NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, {"MAX_SCAN_PLAN_INTERVAL", DataType::Uint}},
+ {NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, {"MAX_SCAN_PLAN_ITERATIONS", DataType::Uint}},
+ {NL80211_ATTR_SCHED_SCAN_PLANS, {"SCHED_SCAN_PLANS"}},
+
+ {NL80211_ATTR_PBSS, {"PBSS"}},
+
+ {NL80211_ATTR_BSS_SELECT, {"BSS_SELECT"}},
+
+ {NL80211_ATTR_STA_SUPPORT_P2P_PS, {"STA_SUPPORT_P2P_PS"}},
+
+ {NL80211_ATTR_PAD, {"PAD"}},
+
+ {NL80211_ATTR_IFTYPE_EXT_CAPA, {"IFTYPE_EXT_CAPA"}},
+
+ {NL80211_ATTR_MU_MIMO_GROUP_DATA, {"MU_MIMO_GROUP_DATA"}},
+ {NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR, {"MU_MIMO_FOLLOW_MAC_ADDR"}},
+
+ {NL80211_ATTR_SCAN_START_TIME_TSF, {"SCAN_START_TIME_TSF"}},
+ {NL80211_ATTR_SCAN_START_TIME_TSF_BSSID, {"SCAN_START_TIME_TSF_BSSID"}},
+ {NL80211_ATTR_MEASUREMENT_DURATION, {"MEASUREMENT_DURATION"}},
+ {NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY, {"MEASUREMENT_DURATION_MANDATORY"}},
+
+ {NL80211_ATTR_MESH_PEER_AID, {"MESH_PEER_AID"}},
+
+ {NL80211_ATTR_NAN_MASTER_PREF, {"NAN_MASTER_PREF"}},
+ {NL80211_ATTR_BANDS, {"BANDS"}},
+ {NL80211_ATTR_NAN_FUNC, {"NAN_FUNC"}},
+ {NL80211_ATTR_NAN_MATCH, {"NAN_MATCH"}},
+
+ {NL80211_ATTR_FILS_KEK, {"FILS_KEK"}},
+ {NL80211_ATTR_FILS_NONCES, {"FILS_NONCES"}},
+
+ {NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED, {"MULTICAST_TO_UNICAST_ENABLED"}},
+
+ {NL80211_ATTR_BSSID, {"BSSID"}},
+
+ {NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI, {"SCHED_SCAN_RELATIVE_RSSI"}},
+ {NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST, {"SCHED_SCAN_RSSI_ADJUST"}},
+
+ {NL80211_ATTR_TIMEOUT_REASON, {"TIMEOUT_REASON"}},
+
+ {NL80211_ATTR_FILS_ERP_USERNAME, {"FILS_ERP_USERNAME"}},
+ {NL80211_ATTR_FILS_ERP_REALM, {"FILS_ERP_REALM"}},
+ {NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM, {"FILS_ERP_NEXT_SEQ_NUM"}},
+ {NL80211_ATTR_FILS_ERP_RRK, {"FILS_ERP_RRK"}},
+ {NL80211_ATTR_FILS_CACHE_ID, {"FILS_CACHE_ID"}},
+
+ {NL80211_ATTR_PMK, {"PMK"}},
+
+ {NL80211_ATTR_SCHED_SCAN_MULTI, {"SCHED_SCAN_MULTI"}},
+ {NL80211_ATTR_SCHED_SCAN_MAX_REQS, {"SCHED_SCAN_MAX_REQS"}},
+
+ {NL80211_ATTR_WANT_1X_4WAY_HS, {"WANT_1X_4WAY_HS"}},
+ {NL80211_ATTR_PMKR0_NAME, {"PMKR0_NAME"}},
+ {NL80211_ATTR_PORT_AUTHORIZED, {"PORT_AUTHORIZED"}},
+
+ {NL80211_ATTR_EXTERNAL_AUTH_ACTION, {"EXTERNAL_AUTH_ACTION"}},
+ {NL80211_ATTR_EXTERNAL_AUTH_SUPPORT, {"EXTERNAL_AUTH_SUPPORT"}},
+
+ {NL80211_ATTR_NSS, {"NSS"}},
+ {NL80211_ATTR_ACK_SIGNAL, {"ACK_SIGNAL"}},
+
+ {NL80211_ATTR_CONTROL_PORT_OVER_NL80211, {"CONTROL_PORT_OVER_NL80211"}},
+
+ {NL80211_ATTR_TXQ_STATS, {"TXQ_STATS"}},
+ {NL80211_ATTR_TXQ_LIMIT, {"TXQ_LIMIT"}},
+ {NL80211_ATTR_TXQ_MEMORY_LIMIT, {"TXQ_MEMORY_LIMIT"}},
+ {NL80211_ATTR_TXQ_QUANTUM, {"TXQ_QUANTUM"}},
+
+ {NL80211_ATTR_HE_CAPABILITY, {"HE_CAPABILITY"}},
+
+ {NL80211_ATTR_FTM_RESPONDER, {"FTM_RESPONDER"}},
+
+ {NL80211_ATTR_FTM_RESPONDER_STATS, {"FTM_RESPONDER_STATS"}},
+
+ {NL80211_ATTR_TIMEOUT, {"TIMEOUT"}},
+
+ {NL80211_ATTR_PEER_MEASUREMENTS, {"PEER_MEASUREMENTS"}},
+
+ {NL80211_ATTR_AIRTIME_WEIGHT, {"AIRTIME_WEIGHT"}},
+ {NL80211_ATTR_STA_TX_POWER_SETTING, {"STA_TX_POWER_SETTING"}},
+ {NL80211_ATTR_STA_TX_POWER, {"STA_TX_POWER"}},
+
+ {NL80211_ATTR_SAE_PASSWORD, {"SAE_PASSWORD"}},
+
+ {NL80211_ATTR_TWT_RESPONDER, {"TWT_RESPONDER"}},
+
+ {NL80211_ATTR_HE_OBSS_PD, {"HE_OBSS_PD"}},
+
+ {NL80211_ATTR_WIPHY_EDMG_CHANNELS, {"WIPHY_EDMG_CHANNELS"}},
+ {NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, {"WIPHY_EDMG_BW_CONFIG"}},
+
+ {NL80211_ATTR_VLAN_ID, {"VLAN_ID"}},
+
+ {NL80211_ATTR_HE_BSS_COLOR, {"HE_BSS_COLOR"}},
+
+ {NL80211_ATTR_IFTYPE_AKM_SUITES, {"IFTYPE_AKM_SUITES"}},
+
+ {NL80211_ATTR_TID_CONFIG, {"TID_CONFIG"}},
+
+ {NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, {"CONTROL_PORT_NO_PREAUTH"}},
+
+ {NL80211_ATTR_PMK_LIFETIME, {"PMK_LIFETIME"}},
+ {NL80211_ATTR_PMK_REAUTH_THRESHOLD, {"PMK_REAUTH_THRESHOLD"}},
+
+ {NL80211_ATTR_RECEIVE_MULTICAST, {"RECEIVE_MULTICAST"}},
+ {NL80211_ATTR_WIPHY_FREQ_OFFSET, {"WIPHY_FREQ_OFFSET"}},
+ {NL80211_ATTR_CENTER_FREQ1_OFFSET, {"CENTER_FREQ1_OFFSET"}},
+ {NL80211_ATTR_SCAN_FREQ_KHZ, {"SCAN_FREQ_KHZ"}},
+
+ {NL80211_ATTR_HE_6GHZ_CAPABILITY, {"HE_6GHZ_CAPABILITY"}},
+
+ {NL80211_ATTR_FILS_DISCOVERY, {"FILS_DISCOVERY"}},
+
+ {NL80211_ATTR_UNSOL_BCAST_PROBE_RESP, {"UNSOL_BCAST_PROBE_RESP"}},
+
+ {NL80211_ATTR_S1G_CAPABILITY, {"S1G_CAPABILITY"}},
+ {NL80211_ATTR_S1G_CAPABILITY_MASK, {"S1G_CAPABILITY_MASK"}},
+}) {}
+// clang-format on
+
+static void informationElementsToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
+ struct IEHeader {
+ uint8_t elementId;
+ uint8_t length;
+ } __attribute__((packed));
+ static_assert(sizeof(IEHeader) == 2);
+
+ const auto alldata = attr.data<uint8_t>();
+ const auto bytes = alldata.getRaw();
+
+ ss << '{';
+
+ if constexpr (kCompactIE) {
+ ss << "len=" << bytes.len() << ", ";
+ ss << "crc=" << std::hex << std::setw(4) << crc16(alldata) << std::dec << ", ";
+ }
+
+ bool first = true;
+ auto printComma = [&first, &ss]() {
+ // put separator at every but first entry
+ if (!first) ss << ", ";
+ first = false;
+ };
+
+ for (size_t offset = 0; offset < bytes.len();) {
+ const auto ptr = bytes.ptr() + offset;
+ const auto remainingLen = bytes.len() - offset;
+
+ // can we fit one more header?
+ if (sizeof(IEHeader) > remainingLen) break;
+ IEHeader ieHeader;
+ memcpy(&ieHeader, ptr, sizeof(IEHeader));
+ if (sizeof(IEHeader) + ieHeader.length > remainingLen) {
+ printComma();
+ ss << "ERR";
+ break;
+ }
+ offset += sizeof(IEHeader) + ieHeader.length;
+
+ const Buffer<uint8_t> data(ptr + sizeof(IEHeader), ieHeader.length);
+
+ if (ieHeader.elementId == WLAN_EID_SSID) {
+ printComma();
+
+ const auto str = data.getRaw();
+ const std::string ssid(reinterpret_cast<const char*>(str.ptr()), str.len());
+ ss << "SSID=\"" << printableOnly(ssid) << '"';
+
+ continue;
+ }
+
+ if constexpr (kCompactIE) continue;
+
+ // print entry ID:LENGTH/CRC16
+ printComma();
+ ss << (int)ieHeader.elementId << ':' << (int)ieHeader.length << '/';
+ ss << std::hex << std::setw(4) << crc16(data) << std::dec;
+ }
+ ss << '}';
+}
+
+static void nl80211_pattern_supportToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
+ const auto& [ok, data] = attr.data<nl80211_pattern_support>().getFirst();
+ if (!ok) {
+ ss << "invalid structure";
+ return;
+ }
+ ss << '{' //
+ << data.max_patterns << ',' //
+ << data.min_pattern_len << ',' //
+ << data.max_pattern_len << ',' //
+ << data.max_pkt_offset << '}';
+}
+
+} // namespace android::nl::protocols::generic::families
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/families/Nl80211.h b/automotive/can/1.0/default/libnl++/protocols/generic/families/Nl80211.h
new file mode 100644
index 0000000..8a9608c
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/families/Nl80211.h
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../GenericMessageBase.h"
+
+namespace android::nl::protocols::generic::families {
+
+class Nl80211 : public GenericMessageBase {
+ public:
+ Nl80211(nlmsgtype_t familyId);
+};
+
+} // namespace android::nl::protocols::generic::families
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp
index 7db487a..9cc05da 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp
@@ -16,6 +16,7 @@
#include "Link.h"
+#include "../structs.h"
#include "structs.h"
#include <net/if.h>
@@ -26,9 +27,9 @@
// clang-format off
Link::Link() : MessageDefinition<ifinfomsg>("link", {
- {RTM_NEWLINK, {"NEWLINK", MessageGenre::NEW}},
- {RTM_DELLINK, {"DELLINK", MessageGenre::DELETE}},
- {RTM_GETLINK, {"GETLINK", MessageGenre::GET}},
+ {RTM_NEWLINK, {"NEWLINK", MessageGenre::New}},
+ {RTM_DELLINK, {"DELLINK", MessageGenre::Delete}},
+ {RTM_GETLINK, {"GETLINK", MessageGenre::Get}},
}, {
{IFLA_ADDRESS, {"ADDRESS"}},
{IFLA_BROADCAST, {"BROADCAST"}},
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.h b/automotive/can/1.0/default/libnl++/protocols/route/structs.h
index b9d622a..fea2ce1 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/structs.h
+++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.h
@@ -30,16 +30,6 @@
// ifla_cacheinfo
void ifla_cacheinfoToStream(std::stringstream& ss, const Buffer<nlattr> attr);
-template <typename T>
-void arrayToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
- ss << '{';
- for (const auto it : attr.data<T>().getRaw()) {
- ss << it << ',';
- }
- ss.seekp(-1, std::ios_base::cur);
- ss << '}';
-}
-
// rtnl_link_stats or rtnl_link_stats64
template <typename T>
void statsToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.h b/automotive/can/1.0/default/libnl++/protocols/structs.h
new file mode 100644
index 0000000..44c17b8
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/structs.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <sstream>
+
+namespace android::nl::protocols {
+
+template <typename T>
+void arrayToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
+ ss << '{';
+ for (const auto it : attr.data<T>().getRaw()) {
+ ss << it << ',';
+ }
+ ss.seekp(-1, std::ios_base::cur);
+ ss << '}';
+}
+
+} // namespace android::nl::protocols
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 8d1693a..bbb48e1 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -88,6 +88,7 @@
whole_static_libs: [
"android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib",
"android.hardware.automotive.vehicle@2.0-manager-lib",
+ "libqemu_pipe",
],
shared_libs: [
"libbase",
@@ -95,7 +96,6 @@
"libprotobuf-cpp-lite",
],
static_libs: [
- "libqemu_pipe",
"android.hardware.automotive.vehicle@2.0-libproto-native",
],
}
@@ -210,6 +210,5 @@
"android.hardware.automotive.vehicle@2.0-manager-lib",
"android.hardware.automotive.vehicle@2.0-default-impl-lib",
"android.hardware.automotive.vehicle@2.0-libproto-native",
- "libqemu_pipe",
],
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 5ecce46..8ef2b60 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -308,6 +308,19 @@
{.config =
{
+ .prop = toInt(VehicleProperty::SEAT_OCCUPANCY),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = (SEAT_1_LEFT)},
+ VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}},
+ },
+ .initialAreaValues = {{SEAT_1_LEFT,
+ {.int32Values = {(int)VehicleSeatOccupancyState::VACANT}}},
+ {SEAT_1_RIGHT,
+ {.int32Values = {(int)VehicleSeatOccupancyState::VACANT}}}}},
+
+ {.config =
+ {
.prop = toInt(VehicleProperty::INFO_DRIVER_SEAT),
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::STATIC,
diff --git a/current.txt b/current.txt
index 7aa9593..8623fc0 100644
--- a/current.txt
+++ b/current.txt
@@ -772,12 +772,15 @@
2c331a9605f3a08d9c1e0a36169ca57758bc43c11a78ef3f3730509885e52c15 android.hardware.graphics.composer@2.4::IComposerClient
3da3ce039247872d95c6bd48621dbfdfa1c2d2a91a90f257862f87ee2bc46300 android.hardware.health@2.1::types
9679f27a42f75781c8993ef163ed92808a1928de186639834841d0b8e326e63d android.hardware.gatekeeper@1.0::IGatekeeper
+9c4eb603d7b9ad675a14edb6180681c5a78da5c6bdc7755853912c974a21f7e5 android.hardware.gnss@1.0::IAGnssCallback
40456eb90ea88b62d18ad3fbf1da8917981cd55ac04ce69c8e058d49ff5beff4 android.hardware.keymaster@3.0::IKeymasterDevice
6017b4f2481feb0fffceae81c62bc372c898998b2d8fe69fbd39859d3a315e5e android.hardware.keymaster@4.0::IKeymasterDevice
dabe23dde7c9e3ad65c61def7392f186d7efe7f4216f9b6f9cf0863745b1a9f4 android.hardware.keymaster@4.1::IKeymasterDevice
cd84ab19c590e0e73dd2307b591a3093ee18147ef95e6d5418644463a6620076 android.hardware.neuralnetworks@1.2::IDevice
9625e85f56515ad2cf87b6a1847906db669f746ea4ab02cd3d4ca25abc9b0109 android.hardware.neuralnetworks@1.2::types
9e758e208d14f7256e0885d6d8ad0b61121b21d8c313864f981727ae55bffd16 android.hardware.neuralnetworks@1.3::types
+e8c86c69c438da8d1549856c1bb3e2d1b8da52722f8235ff49a30f2cce91742c android.hardware.soundtrigger@2.1::ISoundTriggerHwCallback
+b9fbb6e2e061ed0960939d48b785e9700210add1f13ed32ecd688d0f1ca20ef7 android.hardware.renderscript@1.0::types
0f53d70e1eadf8d987766db4bf6ae2048004682168f4cab118da576787def3fa android.hardware.radio@1.0::types
38d65fb20c60a5b823298560fc0825457ecdc49603a4b4e94bf81511790737da android.hardware.radio@1.4::types
954c334efd80e8869b66d1ce5fe2755712d96ba4b3c38d415739c330af5fb4cb android.hardware.radio@1.5::types
diff --git a/gnss/1.0/IAGnssCallback.hal b/gnss/1.0/IAGnssCallback.hal
index 81f1689..11a6a5d 100644
--- a/gnss/1.0/IAGnssCallback.hal
+++ b/gnss/1.0/IAGnssCallback.hal
@@ -42,7 +42,6 @@
/**
* Represents the status of AGNSS augmented to support IPv4.
*/
- @export(name="", value_prefix="GPS_")
struct AGnssStatusIpV4 {
AGnssType type;
AGnssStatusValue status;
diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp
index 9c498d5..ef43a34 100644
--- a/gnss/1.1/default/Android.bp
+++ b/gnss/1.1/default/Android.bp
@@ -18,6 +18,7 @@
"android.hardware.gnss@2.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@1.0",
+ "android.hardware.gnss-ndk_platform",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
index 37de55d..7da462f 100644
--- a/gnss/2.0/default/Android.bp
+++ b/gnss/2.0/default/Android.bp
@@ -29,7 +29,7 @@
"GnssMeasurement.cpp",
"GnssMeasurementCorrections.cpp",
"GnssVisibilityControl.cpp",
- "service.cpp"
+ "service.cpp",
],
shared_libs: [
"libhidlbase",
@@ -39,8 +39,9 @@
"android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss@2.0",
- "android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss-ndk_platform",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp
index 7739f90..63e5013 100644
--- a/gnss/2.1/default/Android.bp
+++ b/gnss/2.1/default/Android.bp
@@ -34,6 +34,7 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
+ "android.hardware.gnss-ndk_platform",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/2.1/vts/functional/gnss_hal_test.h b/gnss/2.1/vts/functional/gnss_hal_test.h
index 7950670..2bcecf4 100644
--- a/gnss/2.1/vts/functional/gnss_hal_test.h
+++ b/gnss/2.1/vts/functional/gnss_hal_test.h
@@ -19,10 +19,9 @@
#include <android/hardware/gnss/2.1/IGnss.h>
#include "v2_1/gnss_hal_test_template.h"
-using android::hardware::gnss::V2_1::IGnss;
-
// The main test class for GNSS HAL.
-class GnssHalTest : public GnssHalTestTemplate<IGnss> {
+class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate<
+ android::hardware::gnss::V2_1::IGnss> {
public:
/**
* IsGnssHalVersion_2_1:
diff --git a/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp
index 7afd49c..deb80e8 100644
--- a/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp
@@ -27,6 +27,9 @@
using android::hardware::gnss::common::Utils;
+using android::hardware::gnss::V2_1::IGnssAntennaInfo;
+using android::hardware::gnss::V2_1::IGnssAntennaInfoCallback;
+
using IGnssMeasurement_2_1 = android::hardware::gnss::V2_1::IGnssMeasurement;
using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
diff --git a/gnss/3.0/default/Android.bp b/gnss/3.0/default/Android.bp
index 2b33b32..bb3c467 100644
--- a/gnss/3.0/default/Android.bp
+++ b/gnss/3.0/default/Android.bp
@@ -36,6 +36,7 @@
"android.hardware.gnss@3.0",
"android.hardware.gnss.measurement_corrections@1.1",
"android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss-ndk_platform",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/3.0/vts/functional/gnss_hal_test.h b/gnss/3.0/vts/functional/gnss_hal_test.h
index 387214e..be6d38c 100644
--- a/gnss/3.0/vts/functional/gnss_hal_test.h
+++ b/gnss/3.0/vts/functional/gnss_hal_test.h
@@ -19,7 +19,6 @@
#include <android/hardware/gnss/3.0/IGnss.h>
#include "v2_1/gnss_hal_test_template.h"
-using android::hardware::gnss::V3_0::IGnss;
-
// The main test class for GNSS HAL.
-class GnssHalTest : public GnssHalTestTemplate<IGnss> {};
\ No newline at end of file
+class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate<
+ android::hardware::gnss::V3_0::IGnss> {};
\ No newline at end of file
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl
index 354c953..a0e8de4 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl
@@ -21,4 +21,6 @@
int flags;
long timestampNs;
double timeUncertaintyNs;
+ const int HAS_TIMESTAMP_NS = 1;
+ const int HAS_TIME_UNCERTAINTY_NS = 2;
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl
new file mode 100644
index 0000000..42b940e
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable GnssClock {
+ int gnssClockFlags;
+ int leapSecond;
+ long timeNs;
+ double timeUncertaintyNs;
+ long fullBiasNs;
+ double biasNs;
+ double biasUncertaintyNs;
+ double driftNsps;
+ double driftUncertaintyNsps;
+ int hwClockDiscontinuityCount;
+ android.hardware.gnss.GnssSignalType referenceSignalTypeForIsb;
+ const int HAS_LEAP_SECOND = 1;
+ const int HAS_TIME_UNCERTAINTY = 2;
+ const int HAS_FULL_BIAS = 4;
+ const int HAS_BIAS = 8;
+ const int HAS_BIAS_UNCERTAINTY = 16;
+ const int HAS_DRIFT = 32;
+ const int HAS_DRIFT_UNCERTAINTY = 64;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
new file mode 100644
index 0000000..7ffabd2
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable GnssData {
+ android.hardware.gnss.GnssMeasurement[] measurements;
+ android.hardware.gnss.GnssClock clock;
+ android.hardware.gnss.ElapsedRealtime elapsedRealtime;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
new file mode 100644
index 0000000..7d15855
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
@@ -0,0 +1,79 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable GnssMeasurement {
+ int flags;
+ int svid;
+ android.hardware.gnss.GnssSignalType signalType;
+ double timeOffsetNs;
+ int state;
+ long receivedSvTimeInNs;
+ long receivedSvTimeUncertaintyInNs;
+ double antennaCN0DbHz;
+ double basebandCN0DbHz;
+ double pseudorangeRateMps;
+ double pseudorangeRateUncertaintyMps;
+ int accumulatedDeltaRangeState;
+ double accumulatedDeltaRangeM;
+ double accumulatedDeltaRangeUncertaintyM;
+ float carrierFrequencyHz;
+ long carrierCycles;
+ double carrierPhase;
+ double carrierPhaseUncertainty;
+ android.hardware.gnss.GnssMultipathIndicator multipathIndicator;
+ double snrDb;
+ double agcLevelDb;
+ double fullInterSignalBiasNs;
+ double fullInterSignalBiasUncertaintyNs;
+ double satelliteInterSignalBiasNs;
+ double satelliteInterSignalBiasUncertaintyNs;
+ const int HAS_SNR = 1;
+ const int HAS_CARRIER_FREQUENCY = 512;
+ const int HAS_CARRIER_CYCLES = 1024;
+ const int HAS_CARRIER_PHASE = 2048;
+ const int HAS_CARRIER_PHASE_UNCERTAINTY = 4096;
+ const int HAS_AUTOMATIC_GAIN_CONTROL = 8192;
+ const int HAS_FULL_ISB = 65536;
+ const int HAS_FULL_ISB_UNCERTAINTY = 131072;
+ const int HAS_SATELLITE_ISB = 262144;
+ const int HAS_SATELLITE_ISB_UNCERTAINTY = 524288;
+ const int STATE_UNKNOWN = 0;
+ const int STATE_CODE_LOCK = 1;
+ const int STATE_BIT_SYNC = 2;
+ const int STATE_SUBFRAME_SYNC = 4;
+ const int STATE_TOW_DECODED = 8;
+ const int STATE_MSEC_AMBIGUOUS = 16;
+ const int STATE_SYMBOL_SYNC = 32;
+ const int STATE_GLO_STRING_SYNC = 64;
+ const int STATE_GLO_TOD_DECODED = 128;
+ const int STATE_BDS_D2_BIT_SYNC = 256;
+ const int STATE_BDS_D2_SUBFRAME_SYNC = 512;
+ const int STATE_GAL_E1BC_CODE_LOCK = 1024;
+ const int STATE_GAL_E1C_2ND_CODE_LOCK = 2048;
+ const int STATE_GAL_E1B_PAGE_SYNC = 4096;
+ const int STATE_SBAS_SYNC = 8192;
+ const int STATE_TOW_KNOWN = 16384;
+ const int STATE_GLO_TOD_KNOWN = 32768;
+ const int STATE_2ND_CODE_LOCK = 65536;
+ const int ADR_STATE_UNKNOWN = 0;
+ const int ADR_STATE_VALID = 1;
+ const int ADR_STATE_RESET = 2;
+ const int ADR_STATE_CYCLE_SLIP = 4;
+ const int ADR_STATE_HALF_CYCLE_RESOLVED = 8;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl
new file mode 100644
index 0000000..75ca3af
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@Backing(type="int") @VintfStability
+enum GnssMultipathIndicator {
+ UNKNOWN = 0,
+ PRESENT = 1,
+ NOT_PRESENT = 2,
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
new file mode 100644
index 0000000..3e66c4a
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+parcelable GnssSignalType {
+ android.hardware.gnss.GnssConstellationType constellation;
+ double carrierFrequencyHz;
+ String codeType;
+ const String CODE_TYPE_A = "A";
+ const String CODE_TYPE_B = "B";
+ const String CODE_TYPE_C = "C";
+ const String CODE_TYPE_D = "D";
+ const String CODE_TYPE_I = "I";
+ const String CODE_TYPE_L = "L";
+ const String CODE_TYPE_M = "M";
+ const String CODE_TYPE_N = "N";
+ const String CODE_TYPE_P = "P";
+ const String CODE_TYPE_Q = "Q";
+ const String CODE_TYPE_S = "S";
+ const String CODE_TYPE_W = "W";
+ const String CODE_TYPE_X = "X";
+ const String CODE_TYPE_Y = "Y";
+ const String CODE_TYPE_Z = "Z";
+ const String CODE_TYPE_UNKNOWN = "UNKNOWN";
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
index e1a4b9e..10ac150 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
@@ -22,8 +22,7 @@
void close();
android.hardware.gnss.IGnssPsds getExtensionPsds();
android.hardware.gnss.IGnssConfiguration getExtensionGnssConfiguration();
+ android.hardware.gnss.IGnssMeasurementInterface getExtensionGnssMeasurement();
android.hardware.gnss.IGnssPowerIndication getExtensionGnssPowerIndication();
const int ERROR_INVALID_ARGUMENT = 1;
- const int ELAPSED_REALTIME_HAS_TIMESTAMP_NS = 1;
- const int ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS = 2;
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl
new file mode 100644
index 0000000..e05e9b9
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IGnssMeasurementCallback {
+ void gnssMeasurementCb(in android.hardware.gnss.GnssData data);
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
new file mode 100644
index 0000000..9576205
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IGnssMeasurementInterface {
+ void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking);
+ void close();
+}
diff --git a/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl
index fae14f8..67d090e 100644
--- a/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl
+++ b/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl
@@ -22,10 +22,18 @@
@VintfStability
parcelable ElapsedRealtime {
+ /** Bit mask indicating a valid timestampNs is stored in the ElapsedRealtime parcelable. */
+ const int HAS_TIMESTAMP_NS = 1 << 0;
+
+ /**
+ * Bit mask indicating a valid timeUncertaintyNs is stored in the ElapsedRealtime parcelable.
+ */
+ const int HAS_TIME_UNCERTAINTY_NS = 1 << 1;
+
/**
* A bit field of flags indicating the validity of each field in this data structure.
*
- * The bit masks are defined in IGnss interface and prefixed with ELAPSED_REALTIME_HAS_.
+ * The bit masks are the constants with prefix HAS_.
*
* Fields may have invalid information in them, if not marked as valid by the corresponding bit
* in flags.
diff --git a/gnss/aidl/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/android/hardware/gnss/GnssClock.aidl
new file mode 100644
index 0000000..f416e08
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssClock.aidl
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.GnssSignalType;
+
+/**
+ * Represents an estimate of the GNSS clock time.
+ */
+@VintfStability
+parcelable GnssClock {
+ /** Bit mask indicating a valid 'leap second' is stored in the GnssClock. */
+ const int HAS_LEAP_SECOND = 1 << 0;
+ /** Bit mask indicating a valid 'time uncertainty' is stored in the GnssClock. */
+ const int HAS_TIME_UNCERTAINTY = 1 << 1;
+ /** Bit mask indicating a valid 'full bias' is stored in the GnssClock. */
+ const int HAS_FULL_BIAS = 1 << 2;
+ /** Bit mask indicating a valid 'bias' is stored in the GnssClock. */
+ const int HAS_BIAS = 1 << 3;
+ /** Bit mask indicating a valid 'bias uncertainty' is stored in the GnssClock. */
+ const int HAS_BIAS_UNCERTAINTY = 1 << 4;
+ /** Bit mask indicating a valid 'drift' is stored in the GnssClock. */
+ const int HAS_DRIFT = 1 << 5;
+ /** Bit mask indicating a valid 'drift uncertainty' is stored in the GnssClock. */
+ const int HAS_DRIFT_UNCERTAINTY = 1 << 6;
+
+ /**
+ * A bitfield of flags indicating the validity of the fields in this data
+ * structure.
+ *
+ * The bit masks are the constants with perfix HAS_.
+ *
+ * Fields for which there is no corresponding flag must be filled in
+ * with a valid value. For convenience, these are marked as mandatory.
+ *
+ * Others fields may have invalid information in them, if not marked as
+ * valid by the corresponding bit in gnssClockFlags.
+ */
+ int gnssClockFlags;
+
+ /**
+ * Leap second data.
+ * The sign of the value is defined by the following equation:
+ * utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
+ * 1,000,000,000
+ *
+ * If this data is available, gnssClockFlags must contain
+ * HAS_LEAP_SECOND.
+ */
+ int leapSecond;
+
+ /**
+ * The GNSS receiver internal clock value. This is the local hardware clock
+ * value.
+ *
+ * For local hardware clock, this value is expected to be monotonically
+ * increasing while the hardware clock remains powered on. (For the case of a
+ * HW clock that is not continuously on, see the
+ * hwClockDiscontinuityCount field). The receiver's estimate of GNSS time
+ * can be derived by subtracting the sum of fullBiasNs and biasNs (when
+ * available) from this value.
+ *
+ * This GNSS time must be the best estimate of current GNSS time
+ * that GNSS receiver can achieve.
+ *
+ * Sub-nanosecond accuracy can be provided by means of the 'biasNs' field.
+ * The value contains the timeUncertaintyNs in it.
+ *
+ * This value is mandatory.
+ */
+ long timeNs;
+
+ /**
+ * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available, gnssClockFlags must contain
+ * HAS_TIME_UNCERTAINTY. Ths value is ideally zero, as the time
+ * 'latched' by timeNs is defined as the reference clock vs. which all
+ * other times (and corresponding uncertainties) are measured.
+ */
+ double timeUncertaintyNs;
+
+ /**
+ * The difference between hardware clock ('time' field) inside GNSS receiver
+ * and the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
+ *
+ * The sign of the value is defined by the following equation:
+ * local estimate of GPS time = timeNs - (fullBiasNs + biasNs)
+ *
+ * If receiver has computed time for a non-GPS constellation, the time offset of
+ * that constellation versus GPS time must be applied to fill this value.
+ *
+ * The error estimate for the sum of this and the biasNs is the biasUncertaintyNs.
+ *
+ * If the data is available gnssClockFlags must contain HAS_FULL_BIAS.
+ *
+ * This value is mandatory if the receiver has estimated GPS time.
+ */
+ long fullBiasNs;
+
+ /**
+ * Sub-nanosecond bias - used with fullBiasNS, see fullBiasNs for details.
+ *
+ * The error estimate for the sum of this and the fullBiasNs is the
+ * biasUncertaintyNs.
+ *
+ * If the data is available gnssClockFlags must contain HAS_BIAS.
+ *
+ * This value is mandatory if the receiver has estimated GPS time.
+ */
+ double biasNs;
+
+ /**
+ * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock
+ * bias) in nanoseconds. The uncertainty is represented as an absolute
+ * (single sided) value.
+ *
+ * The caller is responsible for using this uncertainty (it can be very
+ * large before the GPS time has been fully resolved.)
+ *
+ * If the data is available gnssClockFlags must contain HAS_BIAS_UNCERTAINTY.
+ *
+ * This value is mandatory if the receiver has estimated GPS time.
+ */
+ double biasUncertaintyNs;
+
+ /**
+ * The clock's drift in nanoseconds (per second).
+ *
+ * A positive value means that the frequency is higher than the nominal
+ * frequency, and that the (fullBiasNs + biasNs) is growing more positive
+ * over time.
+ *
+ * If the data is available gnssClockFlags must contain HAS_DRIFT.
+ *
+ * This value is mandatory if the receiver has estimated GPS time.
+ */
+ double driftNsps;
+
+ /**
+ * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per
+ * second).
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available gnssClockFlags must contain HAS_DRIFT_UNCERTAINTY.
+ *
+ * This value is mandatory if the receiver has estimated GPS time.
+ */
+ double driftUncertaintyNsps;
+
+ /**
+ * This field must be incremented, when there are discontinuities in the
+ * hardware clock.
+ *
+ * A "discontinuity" is meant to cover the case of a switch from one source
+ * of clock to another. A single free-running crystal oscillator (XO)
+ * will generally not have any discontinuities, and this can be set and
+ * left at 0.
+ *
+ * If, however, the timeNs value (HW clock) is derived from a composite of
+ * sources, that is not as smooth as a typical XO, or is otherwise stopped &
+ * restarted, then this value shall be incremented each time a discontinuity
+ * occurs. (E.g. this value can start at zero at device boot-up and
+ * increment each time there is a change in clock continuity. In the
+ * unlikely event that this value reaches full scale, rollover (not
+ * clamping) is required, such that this value continues to change, during
+ * subsequent discontinuity events.)
+ *
+ * While this number stays the same, between GnssClock reports, it can be
+ * safely assumed that the timeNs value has been running continuously, e.g.
+ * derived from a single, high quality clock (XO like, or better, that is
+ * typically used during continuous GNSS signal sampling.)
+ *
+ * It is expected, esp. during periods where there are few GNSS signals
+ * available, that the HW clock be discontinuity-free as long as possible,
+ * as this avoids the need to use (waste) a GNSS measurement to fully
+ * re-solve for the GNSS clock bias and drift, when using the accompanying
+ * measurements, from consecutive GnssData reports.
+ *
+ * This value is mandatory.
+ */
+ int hwClockDiscontinuityCount;
+
+ /**
+ * Reference GNSS signal type for inter-signal bias.
+ */
+ GnssSignalType referenceSignalTypeForIsb;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssData.aidl b/gnss/aidl/android/hardware/gnss/GnssData.aidl
new file mode 100644
index 0000000..ed30c98
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssData.aidl
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.ElapsedRealtime;
+import android.hardware.gnss.GnssClock;
+import android.hardware.gnss.GnssMeasurement;
+
+/**
+ * Represents a reading of GNSS measurements. For devices launched in Android Q or newer, it is
+ * mandatory that these be provided, on request, when the GNSS receiver is searching/tracking
+ * signals.
+ *
+ * - Reporting of GNSS constellation measurements is mandatory.
+ * - Reporting of all tracked constellations are encouraged.
+ */
+@VintfStability
+parcelable GnssData {
+ /** The array of measurements. */
+ GnssMeasurement[] measurements;
+
+ /** The GNSS clock time reading. */
+ GnssClock clock;
+
+ /**
+ * Timing information of the GNSS data synchronized with SystemClock.elapsedRealtimeNanos()
+ * clock.
+ */
+ ElapsedRealtime elapsedRealtime;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
new file mode 100644
index 0000000..fae862b
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
@@ -0,0 +1,634 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.GnssConstellationType;
+import android.hardware.gnss.GnssSignalType;
+import android.hardware.gnss.GnssMultipathIndicator;
+
+/**
+ * Represents a GNSS Measurement, it contains raw and computed information.
+ *
+ * All signal measurement information (e.g. svTime, pseudorangeRate, multipathIndicator) reported in
+ * this struct must be based on GNSS signal measurements only. You must not synthesize measurements
+ * by calculating or reporting expected measurements based on known or estimated position, velocity,
+ * or time.
+ */
+@VintfStability
+parcelable GnssMeasurement {
+ /** Bit mask indicating a valid 'snr' is stored in the GnssMeasurement. */
+ const int HAS_SNR = 1 << 0;
+ /** Bit mask indicating a valid 'carrier frequency' is stored in the GnssMeasurement. */
+ const int HAS_CARRIER_FREQUENCY = 1 << 9;
+ /** Bit mask indicating a valid 'carrier cycles' is stored in the GnssMeasurement. */
+ const int HAS_CARRIER_CYCLES = 1 << 10;
+ /** Bit mask indicating a valid 'carrier phase' is stored in the GnssMeasurement. */
+ const int HAS_CARRIER_PHASE = 1 << 11;
+ /** Bit mask indicating a valid 'carrier phase uncertainty' is stored in the GnssMeasurement. */
+ const int HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12;
+ /** Bit mask indicating a valid automatic gain control is stored in the GnssMeasurement. */
+ const int HAS_AUTOMATIC_GAIN_CONTROL = 1 << 13;
+ /** Bit mask indicating a valid full inter-signal bias is stored in the GnssMeasurement. */
+ const int HAS_FULL_ISB = 1 << 16;
+ /**
+ * Bit mask indicating a valid full inter-signal bias uncertainty is stored in the
+ * GnssMeasurement.
+ */
+ const int HAS_FULL_ISB_UNCERTAINTY = 1 << 17;
+ /**
+ * Bit mask indicating a valid satellite inter-signal bias is stored in the GnssMeasurement.
+ */
+ const int HAS_SATELLITE_ISB = 1 << 18;
+ /**
+ * Bit mask indicating a valid satellite inter-signal bias uncertainty is stored in the
+ * GnssMeasurement.
+ */
+ const int HAS_SATELLITE_ISB_UNCERTAINTY = 1 << 19;
+
+ /**
+ * A bitfield of flags indicating the validity of the fields in this GnssMeasurement. The bit
+ * masks are defined in the constants with prefix HAS_*
+ *
+ * Fields for which there is no corresponding flag must be filled in with a valid value. For
+ * convenience, these are marked as mandatory.
+ *
+ * Others fields may have invalid information in them, if not marked as valid by the
+ * corresponding bit in flags.
+ */
+ int flags;
+
+ /**
+ * Satellite vehicle ID number, as defined in GnssSvInfo::svid
+ *
+ * This value is mandatory.
+ */
+ int svid;
+
+ /**
+ * Defines the constellation of the given SV.
+ *
+ * This value is mandatory.
+ */
+ GnssSignalType signalType;
+
+ /**
+ * Time offset at which the measurement was taken in nanoseconds.
+ * The reference receiver's time is specified by GnssData::clock::timeNs.
+ *
+ * The sign of timeOffsetNs is given by the following equation:
+ * measurement time = GnssClock::timeNs + timeOffsetNs
+ *
+ * It provides an individual time-stamp for the measurement, and allows
+ * sub-nanosecond accuracy. It may be zero if all measurements are
+ * aligned to a common time.
+ *
+ * This value is mandatory.
+ */
+ double timeOffsetNs;
+
+ /**
+ * Flags indicating the GNSS measurement state.
+ *
+ * The expected behavior here is for GNSS HAL to set all the flags that apply. For example, if
+ * the state for a satellite is only C/A code locked and bit synchronized, and there is still
+ * millisecond ambiguity, the state must be set as:
+ *
+ * STATE_CODE_LOCK | STATE_BIT_SYNC | STATE_MSEC_AMBIGUOUS
+ *
+ * If GNSS is still searching for a satellite, the corresponding state must be set to
+ * STATE_UNKNOWN(0).
+ *
+ * The received satellite time is relative to the beginning of the system week for all
+ * constellations except for Glonass where it is relative to the beginning of the Glonass system
+ * day.
+ *
+ * The table below indicates the valid range of the received GNSS satellite time. These ranges
+ * depend on the constellation and code being tracked and the state of the tracking algorithms
+ * given by the getState method. If the state flag is set, then the valid measurement range is
+ * zero to the value in the table. The state flag with the widest range indicates the range of
+ * the received GNSS satellite time value.
+ *
+ * +---------------------------+--------------------+-----+-----------+--------------------+------+
+ * | |GPS/QZSS |GLNS |BDS |GAL |SBAS |
+ * +---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |State Flag |L1 |L5I |L5Q |L1OF |B1I |B1I |E1B |E1C |E5AQ |L1 |
+ * | |C/A | | | |(D1) |(D2)| | | |C/A |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_CODE_LOCK |1ms |1 ms |1 ms |1 ms |1 ms |1 ms|- |- |1 ms |1 ms |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_SYMBOL_SYNC |20ms |10 ms |1 ms |10 ms|20 ms |2 ms|4 ms |4 ms |1 ms |2 ms |
+ * | |(opt.)| |(opt.)| |(opt.)| |(opt.)|(opt.)|(opt.)| |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_BIT_SYNC |20 ms |20 ms |1 ms |20 ms|20 ms |- |8 ms |- |1 ms |4 ms |
+ * | | | |(opt.)| | | | | |(opt.)| |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_SUBFRAME_SYNC |6s |6s |- |2 s |6 s |- |- |- |100 ms|- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_TOW_DECODED |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week|
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_TOW_KNOWN |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week|
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_GLO_STRING_SYNC |- |- |- |2 s |- |- |- |- |- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_GLO_TOD_DECODED |- |- |- |1 day|- |- |- |- |- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_GLO_TOD_KNOWN |- |- |- |1 day|- |- |- |- |- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |2 ms|- |- |- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |600 |- |- |- |- |
+ * | | | | | | |ms | | | | |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |4 ms |4 ms |- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |100 ms|- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_2ND_CODE_LOCK |- |10 ms |20 ms |- |- |- |- |100 ms|100 ms|- |
+ * | | |(opt.)| | | | | |(opt.)| | |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |2 s |- |- |- |
+ * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |1s |
+ * +---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
+ * been determined from other sources. If TOW decoded is set then TOW Known must also be set.
+ *
+ * Note well: if there is any ambiguity in integer millisecond, STATE_MSEC_AMBIGUOUS must be
+ * set accordingly, in the 'state' field. This value must be populated if 'state' !=
+ * STATE_UNKNOWN.
+ *
+ * Note on optional flags:
+ * - For L1 C/A and B1I, STATE_SYMBOL_SYNC is optional since the symbol length is the
+ * same as the bit length.
+ * - For L5Q and E5aQ, STATE_BIT_SYNC and STATE_SYMBOL_SYNC are optional since they are
+ * implied by STATE_CODE_LOCK.
+ * - STATE_2ND_CODE_LOCK for L5I is optional since it is implied by STATE_SYMBOL_SYNC.
+ * - STATE_2ND_CODE_LOCK for E1C is optional since it is implied by
+ * STATE_GAL_E1C_2ND_CODE_LOCK.
+ * - For E1B and E1C, STATE_SYMBOL_SYNC is optional, because it is implied by
+ * STATE_GAL_E1BC_CODE_LOCK.
+ */
+ const int STATE_UNKNOWN = 0;
+ const int STATE_CODE_LOCK = 1 << 0;
+ const int STATE_BIT_SYNC = 1 << 1;
+ const int STATE_SUBFRAME_SYNC = 1 << 2;
+ const int STATE_TOW_DECODED = 1 << 3;
+ const int STATE_MSEC_AMBIGUOUS = 1 << 4;
+ const int STATE_SYMBOL_SYNC = 1 << 5;
+ const int STATE_GLO_STRING_SYNC = 1 << 6;
+ const int STATE_GLO_TOD_DECODED = 1 << 7;
+ const int STATE_BDS_D2_BIT_SYNC = 1 << 8;
+ const int STATE_BDS_D2_SUBFRAME_SYNC = 1 << 9;
+ const int STATE_GAL_E1BC_CODE_LOCK = 1 << 10;
+ const int STATE_GAL_E1C_2ND_CODE_LOCK = 1 << 11;
+ const int STATE_GAL_E1B_PAGE_SYNC = 1 << 12;
+ const int STATE_SBAS_SYNC = 1 << 13;
+ const int STATE_TOW_KNOWN = 1 << 14;
+ const int STATE_GLO_TOD_KNOWN = 1 << 15;
+ const int STATE_2ND_CODE_LOCK = 1 << 16;
+
+ /**
+ * A bitfield of flags indicating the GnssMeasurementState per satellite sync state. It
+ * represents the current sync state for the associated satellite.
+ *
+ * Based on the sync state, the 'received GNSS tow' field must be interpreted accordingly.
+ *
+ * The bit masks are defined in the constants with prefix STATE_.
+ *
+ * This value is mandatory.
+ */
+ int state;
+
+ /**
+ * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
+ * For GNSS & QZSS, this is the received GNSS Time-of-Week at the
+ * measurement time, in nanoseconds. The value is relative to the
+ * beginning of the current GNSS week.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
+ * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
+ * Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC set
+ * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED set
+ * TOW Known : [ 0 1week ] : STATE_TOW_KNOWN set
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded
+ * over the air but has been determined from other sources. If TOW
+ * decoded is set then TOW Known must also be set.
+ *
+ * Note: If there is any ambiguity in integer millisecond,
+ * STATE_MSEC_AMBIGUOUS must be set accordingly, in the
+ * 'state' field.
+ *
+ * This value must be populated if 'state' != STATE_UNKNOWN.
+ *
+ * For Glonass, this is the received Glonass time of day, at the
+ * measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN set
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
+ * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC set
+ * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
+ * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC set
+ * Time of day decoded : [ 0 1day ] : STATE_GLO_TOD_DECODED set
+ * Time of day known : [ 0 1day ] : STATE_GLO_TOD_KNOWN set
+ *
+ * Note: Time of day known refers to the case where it is possibly not
+ * decoded over the air but has been determined from other sources. If
+ * Time of day decoded is set then Time of day known must also be set.
+ *
+ * For Beidou, this is the received Beidou time of week,
+ * at the measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN set.
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set.
+ * Bit sync (D2) : [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC set.
+ * Bit sync (D1) : [ 0 20ms ] : STATE_BIT_SYNC set.
+ * Subframe (D2) : [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
+ * Subframe (D1) : [ 0 6s ] : STATE_SUBFRAME_SYNC set.
+ * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED set.
+ * Time of week known : [ 0 1week ] : STATE_TOW_KNOWN set
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded
+ * over the air but has been determined from other sources. If TOW
+ * decoded is set then TOW Known must also be set.
+ *
+ * For Galileo, this is the received Galileo time of week,
+ * at the measurement time in nanoseconds.
+ *
+ * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
+ * E1C 2nd code lock : [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
+ * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC set.
+ * Time of week decoded : [ 0 1week] : STATE_TOW_DECODED is set.
+ * Time of week known : [ 0 1week] : STATE_TOW_KNOWN set
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded
+ * over the air but has been determined from other sources. If TOW
+ * decoded is set then TOW Known must also be set.
+ *
+ * For SBAS, this is received SBAS time, at the measurement time in
+ * nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN
+ * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK is set
+ * Symbol sync : [ 0 2ms ] : STATE_SYMBOL_SYNC is set
+ * Message : [ 0 1s ] : STATE_SBAS_SYNC is set
+ */
+ long receivedSvTimeInNs;
+
+ /**
+ * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds.
+ *
+ * This value must be populated if 'state' != STATE_UNKNOWN.
+ */
+ long receivedSvTimeUncertaintyInNs;
+
+ /**
+ * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+ * It contains the measured C/N0 value for the signal at the antenna port.
+ *
+ * If a signal has separate components (e.g. Pilot and Data channels) and
+ * the receiver only processes one of the components, then the reported
+ * antennaCN0DbHz reflects only the component that is processed.
+ *
+ * This value is mandatory.
+ */
+ double antennaCN0DbHz;
+
+ /**
+ * Baseband Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. It contains the
+ * measured C/N0 value for the signal measured at the baseband.
+ *
+ * This is typically a few dB weaker than the value estimated for C/N0 at the antenna port,
+ * which is reported in cN0DbHz.
+ *
+ * If a signal has separate components (e.g. Pilot and Data channels) and the receiver only
+ * processes one of the components, then the reported basebandCN0DbHz reflects only the
+ * component that is processed.
+ *
+ * This value is mandatory.
+ */
+ double basebandCN0DbHz;
+
+ /**
+ * Pseudorange rate at the timestamp in m/s. The correction of a given
+ * Pseudorange Rate value includes corrections for receiver and satellite
+ * clock frequency errors. Ensure that this field is independent (see
+ * comment at top of GnssMeasurement struct.)
+ *
+ * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and
+ * provide GnssClock's 'drift' field as well. When providing the
+ * uncorrected pseudorange rate, do not apply the corrections described above.)
+ *
+ * The value includes the 'pseudorange rate uncertainty' in it.
+ * A positive 'uncorrected' value indicates that the SV is moving away from
+ * the receiver.
+ *
+ * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the
+ * sign of 'doppler shift' is given by the equation:
+ * pseudorange rate = -k * doppler shift (where k is a constant)
+ *
+ * This must be the most accurate pseudorange rate available, based on
+ * fresh signal measurements from this channel.
+ *
+ * It is mandatory that this value be provided at typical carrier phase PRR
+ * quality (few cm/sec per second of uncertainty, or better) - when signals
+ * are sufficiently strong & stable, e.g. signals from a GNSS simulator at >=
+ * 35 dB-Hz.
+ */
+ double pseudorangeRateMps;
+
+ /**
+ * 1-Sigma uncertainty of the pseudorangeRateMps.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * This value is mandatory.
+ */
+ double pseudorangeRateUncertaintyMps;
+
+
+ /**
+ * Flags indicating the Accumulated Delta Range's states.
+ *
+ * See the table below for a detailed interpretation of each state.
+ *
+ * +---------------------+-------------------+-----------------------------+
+ * | ADR_STATE | Time of relevance | Interpretation |
+ * +---------------------+-------------------+-----------------------------+
+ * | UNKNOWN | ADR(t) | No valid carrier phase |
+ * | | | information is available |
+ * | | | at time t. |
+ * +---------------------+-------------------+-----------------------------+
+ * | VALID | ADR(t) | Valid carrier phase |
+ * | | | information is available |
+ * | | | at time t. This indicates |
+ * | | | that this measurement can |
+ * | | | be used as a reference for |
+ * | | | future measurements. |
+ * | | | However, to compare it to |
+ * | | | previous measurements to |
+ * | | | compute delta range, |
+ * | | | other bits should be |
+ * | | | checked. Specifically, it |
+ * | | | can be used for delta range |
+ * | | | computation if it is valid |
+ * | | | and has no reset or cycle |
+ * | | | slip at this epoch i.e. |
+ * | | | if VALID_BIT == 1 && |
+ * | | | CYCLE_SLIP_BIT == 0 && |
+ * | | | RESET_BIT == 0. |
+ * +---------------------+-------------------+-----------------------------+
+ * | RESET | ADR(t) - ADR(t-1) | Carrier phase accumulation |
+ * | | | has been restarted between |
+ * | | | current time t and previous |
+ * | | | time t-1. This indicates |
+ * | | | that this measurement can |
+ * | | | be used as a reference for |
+ * | | | future measurements, but it |
+ * | | | should not be compared to |
+ * | | | previous measurements to |
+ * | | | compute delta range. |
+ * +---------------------+-------------------+-----------------------------+
+ * | CYCLE_SLIP | ADR(t) - ADR(t-1) | Cycle slip(s) have been |
+ * | | | detected between the |
+ * | | | current time t and previous |
+ * | | | time t-1. This indicates |
+ * | | | that this measurement can |
+ * | | | be used as a reference for |
+ * | | | future measurements. |
+ * | | | Clients can use a |
+ * | | | measurement with a cycle |
+ * | | | slip to compute delta range |
+ * | | | against previous |
+ * | | | measurements at their own |
+ * | | | risk. |
+ * +---------------------+-------------------+-----------------------------+
+ * | HALF_CYCLE_RESOLVED | ADR(t) | Half cycle ambiguity is |
+ * | | | resolved at time t. |
+ * +---------------------+-------------------+-----------------------------+
+ */
+ const int ADR_STATE_UNKNOWN = 0;
+ const int ADR_STATE_VALID = 1 << 0;
+ const int ADR_STATE_RESET = 1 << 1;
+ const int ADR_STATE_CYCLE_SLIP = 1 << 2;
+ const int ADR_STATE_HALF_CYCLE_RESOLVED = 1 << 3;
+
+ /**
+ * A bitfield of flags indicating the accumulated delta range's state. It indicates whether ADR
+ * is reset or there is a cycle slip(indicating loss of lock).
+ *
+ * The bit masks are defined in constants with prefix ADR_STATE_.
+ *
+ * This value is mandatory.
+ */
+ int accumulatedDeltaRangeState;
+
+ /**
+ * Accumulated delta range since the last channel reset in meters.
+ * A positive value indicates that the SV is moving away from the receiver.
+ *
+ * The sign of the 'accumulated delta range' and its relation to the sign of
+ * 'carrier phase' is given by the equation:
+ * accumulated delta range = -k * carrier phase (where k is a constant)
+ *
+ * This value must be populated if 'accumulated delta range state' !=
+ * ADR_STATE_UNKNOWN.
+ * However, it is expected that the data is only accurate when:
+ * 'accumulated delta range state' == ADR_STATE_VALID.
+ *
+ * The alignment of the phase measurement will not be adjusted by the receiver so the in-phase
+ * and quadrature phase components will have a quarter cycle offset as they do when transmitted
+ * from the satellites. If the measurement is from a combination of the in-phase and quadrature
+ * phase components, then the alignment of the phase measurement will be aligned to the in-phase
+ * component.
+ */
+ double accumulatedDeltaRangeM;
+
+ /**
+ * 1-Sigma uncertainty of the accumulated delta range in meters.
+ * This value must be populated if 'accumulated delta range state' !=
+ * ADR_STATE_UNKNOWN.
+ */
+ double accumulatedDeltaRangeUncertaintyM;
+
+ /**
+ * Carrier frequency of the signal tracked, for example it can be the
+ * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
+ * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
+ * is the primary common use central frequency, e.g. L1 = 1575.45 MHz
+ * for GPS.
+ *
+ * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
+ * time, two raw measurement structs must be reported for this same
+ * satellite, in one of the measurement structs, all the values related
+ * to L1 must be filled, and in the other all of the values related to
+ * L5 must be filled.
+ *
+ * If the data is available, gnssMeasurementFlags must contain
+ * HAS_CARRIER_FREQUENCY.
+ */
+ float carrierFrequencyHz;
+
+ /**
+ * The number of full carrier cycles between the satellite and the
+ * receiver. The reference frequency is given by the field
+ * 'carrierFrequencyHz'. Indications of possible cycle slips and
+ * resets in the accumulation of this value can be inferred from the
+ * accumulatedDeltaRangeState flags.
+ *
+ * If the data is available, gnssMeasurementFlags must contain
+ * HAS_CARRIER_CYCLES.
+ */
+ long carrierCycles;
+
+ /**
+ * The RF phase detected by the receiver, in the range [0.0, 1.0].
+ * This is usually the fractional part of the complete carrier phase
+ * measurement.
+ *
+ * The reference frequency is given by the field 'carrierFrequencyHz'.
+ * The value contains the 'carrier-phase uncertainty' in it.
+ *
+ * If the data is available, gnssMeasurementFlags must contain
+ * HAS_CARRIER_PHASE.
+ */
+ double carrierPhase;
+
+ /**
+ * 1-Sigma uncertainty of the carrier-phase.
+ * If the data is available, gnssMeasurementFlags must contain
+ * HAS_CARRIER_PHASE_UNCERTAINTY.
+ */
+ double carrierPhaseUncertainty;
+
+ /**
+ * An enumeration that indicates the 'multipath' state of the event.
+ *
+ * The multipath Indicator is intended to report the presence of overlapping
+ * signals that manifest as distorted correlation peaks.
+ *
+ * - if there is a distorted correlation peak shape, report that multipath
+ * is MULTIPATH_INDICATOR_PRESENT.
+ * - if there is no distorted correlation peak shape, report
+ * MULTIPATH_INDICATOR_NOT_PRESENT
+ * - if signals are too weak to discern this information, report
+ * MULTIPATH_INDICATOR_UNKNOWN
+ *
+ * Example: when doing the standardized overlapping Multipath Performance
+ * test (3GPP TS 34.171) the Multipath indicator must report
+ * MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and
+ * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those
+ * signals that are tracked and do not contain multipath.
+ */
+ GnssMultipathIndicator multipathIndicator;
+
+ /**
+ * Signal-to-noise ratio at correlator output in dB.
+ * If the data is available, GnssMeasurementFlags must contain HAS_SNR.
+ * This is the power ratio of the "correlation peak height above the
+ * observed noise floor" to "the noise RMS".
+ */
+ double snrDb;
+
+ /**
+ * Automatic gain control (AGC) level. AGC acts as a variable gain
+ * amplifier adjusting the power of the incoming signal. The AGC level
+ * may be used to indicate potential interference. When AGC is at a
+ * nominal level, this value must be set as 0. Higher gain (and/or lower
+ * input power) must be output as a positive number. Hence in cases of
+ * strong jamming, in the band of this signal, this value must go more
+ * negative.
+ *
+ * Note: Different hardware designs (e.g. antenna, pre-amplification, or
+ * other RF HW components) may also affect the typical output of this
+ * value on any given hardware design in an open sky test - the
+ * important aspect of this output is that changes in this value are
+ * indicative of changes on input signal power in the frequency band for
+ * this measurement.
+ */
+ double agcLevelDb;
+
+ /**
+ * The full inter-signal bias (ISB) in nanoseconds.
+ *
+ * This value is the sum of the estimated receiver-side and the space-segment-side inter-system
+ * bias, inter-frequency bias and inter-code bias, including
+ *
+ * - Receiver inter-constellation bias (with respect to the constellation in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Receiver inter-frequency bias (with respect to the carrier frequency in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Receiver inter-code bias (with respect to the code type in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPS-UTC Time Offset (TauGps), BDS-GLO
+ * Time Offset (BGTO)) (with respect to the constellation in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Group delay (e.g., Total Group Delay (TGD))
+ * - Satellite inter-frequency bias (GLO only) (with respect to the carrier frequency in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Satellite inter-code bias (e.g., Differential Code Bias (DCB)) (with respect to the code
+ * type in GnssClock.referenceSignalTypeForIsb)
+ *
+ * If a component of the above is already compensated in the provided
+ * GnssMeasurement.receivedSvTimeInNs, then it must not be included in the reported full ISB.
+ *
+ * The value does not include the inter-frequency Ionospheric bias.
+ *
+ * The full ISB of GnssClock.referenceSignalTypeForIsb is defined to be 0.0 nanoseconds.
+ */
+ double fullInterSignalBiasNs;
+
+ /**
+ * 1-sigma uncertainty associated with the full inter-signal bias in nanoseconds.
+ */
+ double fullInterSignalBiasUncertaintyNs;
+
+ /**
+ * The satellite inter-signal bias in nanoseconds.
+ *
+ * This value is the sum of the space-segment-side inter-system bias, inter-frequency bias
+ * and inter-code bias, including
+ *
+ * - Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPS-UTC Time Offset (TauGps), BDS-GLO
+ * Time Offset (BGTO)) (with respect to the constellation in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Group delay (e.g., Total Group Delay (TGD))
+ * - Satellite inter-frequency bias (GLO only) (with respect to the carrier frequency in
+ * GnssClock.referenceSignalTypeForIsb)
+ * - Satellite inter-code bias (e.g., Differential Code Bias (DCB)) (with respect to the code
+ * type in GnssClock.referenceSignalTypeForIsb)
+ *
+ * The satellite ISB of GnssClock.referenceSignalTypeForIsb is defined to be 0.0 nanoseconds.
+ */
+ double satelliteInterSignalBiasNs;
+
+ /**
+ * 1-sigma uncertainty associated with the satellite inter-signal bias in nanoseconds.
+ */
+ double satelliteInterSignalBiasUncertaintyNs;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl
new file mode 100644
index 0000000..ec1ce62
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+/**
+ * Enumeration of available values for the GNSS Measurement's multipath
+ * indicator.
+ */
+@VintfStability
+@Backing(type="int")
+enum GnssMultipathIndicator {
+ /** The indicator is not available or unknown. */
+ UNKNOWN = 0,
+ /** The measurement is indicated to be affected by multipath. */
+ PRESENT = 1,
+ /** The measurement is indicated to be not affected by multipath. */
+ NOT_PRESENT = 2,
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
new file mode 100644
index 0000000..a284fed
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.GnssConstellationType;
+
+/**
+ * Represents a GNSS signal type.
+ */
+@VintfStability
+parcelable GnssSignalType {
+ /**
+ * Constellation type of the SV that transmits the signal.
+ */
+ GnssConstellationType constellation;
+
+ /**
+ * Carrier frequency of the signal tracked, for example it can be the
+ * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
+ * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
+ * is the primary common use central frequency, e.g. L1 = 1575.45 MHz
+ * for GPS.
+ *
+ * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
+ * time, two raw measurement structs must be reported for this same
+ * satellite, in one of the measurement structs, all the values related
+ * to L1 must be filled, and in the other all of the values related to
+ * L5 must be filled.
+ */
+ double carrierFrequencyHz;
+
+ /**
+ * GNSS signal code type "A" representing GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA.
+ */
+ const String CODE_TYPE_A = "A";
+
+ /**
+ * GNSS signal code type "B" representing GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB.
+ */
+ const String CODE_TYPE_B = "B";
+
+ /**
+ * GNSS signal code type "C" representing GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A,
+ * GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C.
+ */
+ const String CODE_TYPE_C = "C";
+
+ /**
+ * GNSS signal code type "D" representing BDS B1C D.
+ */
+ const String CODE_TYPE_D = "D";
+
+ /**
+ * GNSS signal code type "I" representing GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I,
+ * GALILEO E5a+b I, SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I.
+ */
+ const String CODE_TYPE_I = "I";
+
+ /**
+ * GNSS signal code type "L" representing GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L),
+ * LEX(6) L.
+ */
+ const String CODE_TYPE_L = "L";
+
+ /**
+ * GNSS signal code type "M" representing GPS L1M, GPS L2M.
+ */
+ const String CODE_TYPE_M = "M";
+
+ /**
+ * GNSS signal code type "N" representing GPS L1 codeless, GPS L2 codeless.
+ */
+ const String CODE_TYPE_N = "N";
+
+ /**
+ * GNSS signal code type "P" representing GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P, BDS B1C P.
+ */
+ const String CODE_TYPE_P = "P";
+
+ /**
+ * GNSS signal code type "Q" representing GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q,
+ * GALILEO E5a+b Q, SBAS L5 Q, QZSS L5 Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
+ */
+ const String CODE_TYPE_Q = "Q";
+
+ /**
+ * GNSS signal code type "S" represents GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M),
+ * LEX(6) S.
+ */
+ const String CODE_TYPE_S = "S";
+
+ /**
+ * GNSS signal code type "W" representing GPS L1 Z-tracking, GPS L2 Z-tracking.
+ */
+ const String CODE_TYPE_W = "W";
+
+ /**
+ * GNSS signal code type "X" representing GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q),
+ * GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q),
+ * GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q),
+ * LEX(6) (S+L), BDS B1 (I+Q), BDS B1C (D+P), BDS B2 (I+Q), BDS B3 (I+Q), IRNSS L5 (B+C).
+ */
+ const String CODE_TYPE_X = "X";
+
+ /**
+ * GNSS signal code type "Y" representing GPS L1Y, GPS L2Y.
+ */
+ const String CODE_TYPE_Y = "Y";
+
+ /**
+ * GNSS signal code type "Z" representing GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF.
+ */
+ const String CODE_TYPE_Z = "Z";
+
+ /**
+ * GNSS signal code type "UNKNOWN" representing the GNSS Measurement's code type is unknown.
+ */
+ const String CODE_TYPE_UNKNOWN = "UNKNOWN";
+
+ /**
+ * The type of code that is currently being tracked in the GNSS signal.
+ *
+ * For high precision applications the type of code being tracked needs to be considered
+ * in-order to properly apply code specific corrections to the pseudorange measurements.
+ *
+ * The value is one of the constant Strings with prefix CODE_TYPE_ defined in this parcelable.
+ *
+ * This is used to specify the observation descriptor defined in GNSS Observation Data File
+ * Header Section Description in the RINEX standard (Version 3.XX). In RINEX Version 3.03,
+ * in Appendix Table A2 Attributes are listed as uppercase letters (for instance, "A" for
+ * "A channel"). In the future, if for instance a code "G" was added in the official RINEX
+ * standard, "G" could be specified here.
+ */
+ String codeType;
+}
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 2af57b5..c815e2d 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -17,9 +17,10 @@
package android.hardware.gnss;
import android.hardware.gnss.IGnssCallback;
+import android.hardware.gnss.IGnssConfiguration;
+import android.hardware.gnss.IGnssMeasurementInterface;
import android.hardware.gnss.IGnssPowerIndication;
import android.hardware.gnss.IGnssPsds;
-import android.hardware.gnss.IGnssConfiguration;
/**
* Represents the standard GNSS (Global Navigation Satellite System) interface.
@@ -33,14 +34,6 @@
*/
const int ERROR_INVALID_ARGUMENT = 1;
- /** Bit mask indicating a valid timestampNs is stored in the ElapsedRealtime parcelable. */
- const int ELAPSED_REALTIME_HAS_TIMESTAMP_NS = 1 << 0;
-
- /**
- * Bit mask indicating a valid timeUncertaintyNs is stored in the ElapsedRealtime parcelable.
- */
- const int ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS = 1 << 1;
-
/**
* Opens the interface and provides the callback routines to the implementation of this
* interface.
@@ -74,6 +67,8 @@
/**
* This method returns the IGnssPsds interface.
*
+ * This method must return non-null.
+ *
* @return Handle to the IGnssPsds interface.
*/
IGnssPsds getExtensionPsds();
@@ -81,13 +76,26 @@
/**
* This method returns the IGnssConfiguration interface.
*
+ * This method must return non-null.
+ *
* @return Handle to the IGnssConfiguration interface.
*/
IGnssConfiguration getExtensionGnssConfiguration();
/**
+ * This methods returns the IGnssMeasurementInterface interface.
+ *
+ * This method must return non-null.
+ *
+ * @return Handle to the IGnssMeasurementInterface interface.
+ */
+ IGnssMeasurementInterface getExtensionGnssMeasurement();
+
+ /**
* This method returns the IGnssPowerIndication interface.
*
+ * This method must return non-null.
+ *
* @return Handle to the IGnssPowerIndication interface.
*/
IGnssPowerIndication getExtensionGnssPowerIndication();
diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl
new file mode 100644
index 0000000..328cf2a
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.GnssData;
+
+/**
+ * The callback interface to report GNSS Measurement from the HAL.
+ */
+@VintfStability
+interface IGnssMeasurementCallback {
+ /**
+ * Callback for the hal to pass a GnssData structure back to the client.
+ *
+ * @param data Contains a reading of GNSS measurements.
+ */
+ void gnssMeasurementCb(in GnssData data);
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
new file mode 100644
index 0000000..fdeebde
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.IGnssMeasurementCallback;
+
+/**
+ * Extended interface for GNSS Measurement support.
+ */
+@VintfStability
+interface IGnssMeasurementInterface {
+ /**
+ * Initializes the interface and registers the callback routines with the HAL. After a
+ * successful call to 'setCallback' the HAL must begin to provide updates at an average
+ * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
+ * can be tolerated.)
+ *
+ * @param callback Handle to GnssMeasurement callback interface.
+ * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
+ * no clock discontinuities are expected and, when supported, carrier phase should be
+ * continuous in good signal conditions. All non-blocklisted, healthy constellations,
+ * satellites and frequency bands that the chipset supports must be reported in this mode.
+ * The GNSS chipset is allowed to consume more power in this mode. If false, API must
+ * optimize power via duty cycling, constellations and frequency limits, etc.
+ *
+ * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
+ * already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
+ * for any other error. The HAL must not generate any other updates upon returning this
+ * error code.
+ */
+ void setCallback(in IGnssMeasurementCallback callback, in boolean enableFullTracking);
+
+ /**
+ * Stops updates from the HAL, and unregisters the callback routines. After a call to close(),
+ * the previously registered callbacks must be considered invalid by the HAL.
+ *
+ * If close() is invoked without a previous setCallback, this function must perform
+ * no work.
+ */
+ void close();
+}
\ No newline at end of file
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index 23677ed..6694ce6 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -50,6 +50,7 @@
"GnssPowerIndication.cpp",
"GnssPsds.cpp",
"GnssConfiguration.cpp",
+ "GnssMeasurementInterface.cpp",
"service.cpp",
],
static_libs: [
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 669372b..02bad60 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -19,6 +19,7 @@
#include "Gnss.h"
#include <log/log.h>
#include "GnssConfiguration.h"
+#include "GnssMeasurementInterface.h"
#include "GnssPowerIndication.h"
#include "GnssPsds.h"
@@ -74,4 +75,12 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Gnss::getExtensionGnssMeasurement(
+ std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) {
+ ALOGD("Gnss::getExtensionGnssMeasurement");
+
+ *iGnssMeasurement = SharedRefBase::make<GnssMeasurementInterface>();
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 9f6ef0e..bccc7f2 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -18,6 +18,7 @@
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <aidl/android/hardware/gnss/BnGnssConfiguration.h>
+#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
#include <aidl/android/hardware/gnss/BnGnssPowerIndication.h>
#include <aidl/android/hardware/gnss/BnGnssPsds.h>
#include "GnssConfiguration.h"
@@ -33,6 +34,8 @@
std::shared_ptr<IGnssConfiguration>* iGnssConfiguration) override;
ndk::ScopedAStatus getExtensionGnssPowerIndication(
std::shared_ptr<IGnssPowerIndication>* iGnssPowerIndication) override;
+ ndk::ScopedAStatus getExtensionGnssMeasurement(
+ std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) override;
std::shared_ptr<GnssConfiguration> mGnssConfiguration;
diff --git a/gnss/aidl/default/GnssConfiguration.h b/gnss/aidl/default/GnssConfiguration.h
index 25fa16e..491733c 100644
--- a/gnss/aidl/default/GnssConfiguration.h
+++ b/gnss/aidl/default/GnssConfiguration.h
@@ -24,8 +24,6 @@
namespace aidl::android::hardware::gnss {
-using android::hardware::gnss::GnssConstellationType;
-
struct BlocklistedSourceHash {
inline int operator()(const BlocklistedSource& source) const {
return int(source.constellation) * 1000 + int(source.svid);
@@ -42,7 +40,8 @@
using std::vector;
using BlocklistedSourceSet =
std::unordered_set<BlocklistedSource, BlocklistedSourceHash, BlocklistedSourceEqual>;
-using BlocklistedConstellationSet = std::unordered_set<GnssConstellationType>;
+using BlocklistedConstellationSet =
+ std::unordered_set<android::hardware::gnss::GnssConstellationType>;
struct GnssConfiguration : public BnGnssConfiguration {
public:
diff --git a/gnss/aidl/default/GnssHidlHal.cpp b/gnss/aidl/default/GnssHidlHal.cpp
index 11fc806..9529ec9 100644
--- a/gnss/aidl/default/GnssHidlHal.cpp
+++ b/gnss/aidl/default/GnssHidlHal.cpp
@@ -17,11 +17,10 @@
#define LOG_TAG "GnssHidlHal"
#include "GnssHidlHal.h"
-//#include <android/hardware/gnss/1.0/IGnssCallback.h>
namespace aidl::android::hardware::gnss {
-namespace V1_0 = ::android::hardware::gnss::V1_0;
+using GnssSvInfo = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo;
GnssHidlHal::GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl) : mGnssAidl(gnssAidl) {
Gnss* iGnss = mGnssAidl.get();
@@ -45,8 +44,8 @@
if (mGnssConfigurationAidl->isBlocklistedV2_1(gnssSvInfoList[i])) {
ALOGD("Blocklisted constellation: %d, svid: %d",
(int)gnssSvInfoList[i].v2_0.constellation, gnssSvInfoList[i].v2_0.v1_0.svid);
- gnssSvInfoList[i].v2_0.v1_0.svFlag &=
- ~static_cast<uint8_t>(V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX);
+ gnssSvInfoList[i].v2_0.v1_0.svFlag &= ~static_cast<uint8_t>(
+ ::android::hardware::gnss::V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX);
}
}
return gnssSvInfoList;
diff --git a/gnss/aidl/default/GnssHidlHal.h b/gnss/aidl/default/GnssHidlHal.h
index 50aad3a..93a79a1 100644
--- a/gnss/aidl/default/GnssHidlHal.h
+++ b/gnss/aidl/default/GnssHidlHal.h
@@ -22,16 +22,16 @@
namespace aidl::android::hardware::gnss {
-using ::android::hardware::gnss::common::implementation::GnssTemplate;
-using GnssSvInfo = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo;
-
-class GnssHidlHal : public GnssTemplate<::android::hardware::gnss::V2_1::IGnss> {
+class GnssHidlHal : public ::android::hardware::gnss::common::implementation::GnssTemplate<
+ ::android::hardware::gnss::V2_1::IGnss> {
public:
GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl);
private:
- hidl_vec<GnssSvInfo> filterBlocklistedSatellitesV2_1(
- hidl_vec<GnssSvInfo> gnssSvInfoList) override;
+ hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo>
+ filterBlocklistedSatellitesV2_1(
+ hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList)
+ override;
std::shared_ptr<Gnss> mGnssAidl;
std::shared_ptr<GnssConfiguration> mGnssConfigurationAidl;
diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp
new file mode 100644
index 0000000..d726d95
--- /dev/null
+++ b/gnss/aidl/default/GnssMeasurementInterface.cpp
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "GnssMeasIfaceAidl"
+
+#include "GnssMeasurementInterface.h"
+#include <aidl/android/hardware/gnss/BnGnss.h>
+#include <log/log.h>
+#include "Utils.h"
+
+namespace aidl::android::hardware::gnss {
+
+using Utils = ::android::hardware::gnss::common::Utils;
+
+std::shared_ptr<IGnssMeasurementCallback> GnssMeasurementInterface::sCallback = nullptr;
+
+GnssMeasurementInterface::GnssMeasurementInterface() : mMinIntervalMillis(1000) {}
+
+GnssMeasurementInterface::~GnssMeasurementInterface() {
+ stop();
+}
+
+ndk::ScopedAStatus GnssMeasurementInterface::setCallback(
+ const std::shared_ptr<IGnssMeasurementCallback>& callback, const bool enableFullTracking) {
+ ALOGD("setCallback: enableFullTracking: %d", (int)enableFullTracking);
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+
+ if (mIsActive) {
+ ALOGW("GnssMeasurement callback already set. Resetting the callback...");
+ stop();
+ }
+ start();
+
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus GnssMeasurementInterface::close() {
+ ALOGD("close");
+ stop();
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = nullptr;
+ return ndk::ScopedAStatus::ok();
+}
+
+void GnssMeasurementInterface::start() {
+ ALOGD("start");
+ mIsActive = true;
+ mThread = std::thread([this]() {
+ while (mIsActive == true) {
+ auto measurement = Utils::getMockMeasurement();
+ this->reportMeasurement(measurement);
+
+ std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMillis));
+ }
+ });
+}
+
+void GnssMeasurementInterface::stop() {
+ ALOGD("stop");
+ mIsActive = false;
+ if (mThread.joinable()) {
+ mThread.join();
+ }
+}
+
+void GnssMeasurementInterface::reportMeasurement(const GnssData& data) {
+ ALOGD("reportMeasurement()");
+ std::unique_lock<std::mutex> lock(mMutex);
+ if (sCallback == nullptr) {
+ ALOGE("%s: GnssMeasurement::sCallback is null.", __func__);
+ return;
+ }
+ sCallback->gnssMeasurementCb(data);
+}
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h
new file mode 100644
index 0000000..69cd871
--- /dev/null
+++ b/gnss/aidl/default/GnssMeasurementInterface.h
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/gnss/BnGnssMeasurementCallback.h>
+#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
+#include <atomic>
+#include <mutex>
+#include <thread>
+
+namespace aidl::android::hardware::gnss {
+
+struct GnssMeasurementInterface : public BnGnssMeasurementInterface {
+ public:
+ GnssMeasurementInterface();
+ ~GnssMeasurementInterface();
+ ndk::ScopedAStatus setCallback(const std::shared_ptr<IGnssMeasurementCallback>& callback,
+ const bool enableFullTracking) override;
+ ndk::ScopedAStatus close() override;
+
+ private:
+ void start();
+ void stop();
+ void reportMeasurement(const GnssData&);
+
+ std::atomic<long> mMinIntervalMillis;
+ std::atomic<bool> mIsActive;
+ std::thread mThread;
+
+ // Guarded by mMutex
+ static std::shared_ptr<IGnssMeasurementCallback> sCallback;
+
+ // Synchronization lock for sCallback
+ mutable std::mutex mMutex;
+};
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssPowerIndication.cpp b/gnss/aidl/default/GnssPowerIndication.cpp
index 8ea60f3..429cc8c 100644
--- a/gnss/aidl/default/GnssPowerIndication.cpp
+++ b/gnss/aidl/default/GnssPowerIndication.cpp
@@ -19,6 +19,7 @@
#include "GnssPowerIndication.h"
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <log/log.h>
+#include <utils/SystemClock.h>
namespace aidl::android::hardware::gnss {
@@ -43,10 +44,9 @@
std::unique_lock<std::mutex> lock(mMutex);
ElapsedRealtime elapsedRealtime = {
- .flags = IGnss::ELAPSED_REALTIME_HAS_TIMESTAMP_NS |
- IGnss::ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS,
- .timestampNs = (long)1323542,
- .timeUncertaintyNs = (long)1000,
+ .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS,
+ .timestampNs = ::android::elapsedRealtimeNano(),
+ .timeUncertaintyNs = 1000,
};
GnssPowerStats gnssPowerStats = {
.elapsedRealtime = elapsedRealtime,
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index d102e7f..c10e809 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -22,6 +22,7 @@
"gnss_hal_test.cpp",
"gnss_hal_test_cases.cpp",
"GnssCallbackAidl.cpp",
+ "GnssMeasurementCallbackAidl.cpp",
"GnssPowerIndicationCallback.cpp",
"VtsHalGnssTargetTest.cpp",
],
diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
new file mode 100644
index 0000000..c4fad7f
--- /dev/null
+++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "GnssMeasurementCallbackAidl"
+
+#include "GnssMeasurementCallbackAidl.h"
+#include <inttypes.h>
+#include <log/log.h>
+
+using android::hardware::gnss::GnssData;
+
+android::binder::Status GnssMeasurementCallbackAidl::gnssMeasurementCb(const GnssData& gnssData) {
+ ALOGI("gnssMeasurementCb");
+ ALOGI("elapsedRealtime: flags = %d, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf",
+ gnssData.elapsedRealtime.flags, gnssData.elapsedRealtime.timestampNs,
+ gnssData.elapsedRealtime.timeUncertaintyNs);
+ for (const auto& measurement : gnssData.measurements) {
+ ALOGI("measurement.receivedSvTimeInNs=%" PRId64, measurement.receivedSvTimeInNs);
+ }
+ gnss_data_cbq_.store(gnssData);
+ return android::binder::Status::ok();
+}
diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.h b/gnss/aidl/vts/GnssMeasurementCallbackAidl.h
new file mode 100644
index 0000000..f6c79cf
--- /dev/null
+++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <android/hardware/gnss/BnGnssMeasurementCallback.h>
+#include "GnssCallbackEventQueue.h"
+
+/** Implementation for IGnssMeasurementCallback. */
+class GnssMeasurementCallbackAidl : public android::hardware::gnss::BnGnssMeasurementCallback {
+ public:
+ GnssMeasurementCallbackAidl() : gnss_data_cbq_("gnss_data") {}
+ ~GnssMeasurementCallbackAidl() {}
+
+ android::binder::Status gnssMeasurementCb(
+ const android::hardware::gnss::GnssData& gnssData) override;
+
+ android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssData>
+ gnss_data_cbq_;
+};
diff --git a/gnss/aidl/vts/GnssPowerIndicationCallback.h b/gnss/aidl/vts/GnssPowerIndicationCallback.h
index d4c4539..3416f17 100644
--- a/gnss/aidl/vts/GnssPowerIndicationCallback.h
+++ b/gnss/aidl/vts/GnssPowerIndicationCallback.h
@@ -25,7 +25,6 @@
public:
GnssPowerIndicationCallback()
: capabilities_cbq_("capabilities"),
- other_mode_names_cbq_("other_mode_names"),
gnss_power_stats_cbq_("gnss_power_stats") {}
~GnssPowerIndicationCallback() {}
@@ -35,9 +34,6 @@
android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
int last_capabilities_;
- android::hardware::gnss::common::GnssCallbackEventQueue<std::vector<std::string>>
- other_mode_names_cbq_;
- std::vector<std::string> last_other_mode_names_;
android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssPowerStats>
gnss_power_stats_cbq_;
android::hardware::gnss::GnssPowerStats last_gnss_power_stats_;
diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h
index eb5301e..f72f7fe 100644
--- a/gnss/aidl/vts/gnss_hal_test.h
+++ b/gnss/aidl/vts/gnss_hal_test.h
@@ -36,7 +36,7 @@
using android::hardware::gnss::IGnssConfiguration;
// The main test class for GNSS HAL.
-class GnssHalTest : public GnssHalTestTemplate<IGnss_V2_1> {
+class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate<IGnss_V2_1> {
public:
GnssHalTest(){};
~GnssHalTest(){};
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 4e8d0bd..857c742 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -16,19 +16,30 @@
#define LOG_TAG "GnssHalTestCases"
+#include <android/hardware/gnss/IGnss.h>
+#include <android/hardware/gnss/IGnssMeasurementCallback.h>
+#include <android/hardware/gnss/IGnssMeasurementInterface.h>
#include <android/hardware/gnss/IGnssPowerIndication.h>
#include <android/hardware/gnss/IGnssPsds.h>
+#include "GnssMeasurementCallbackAidl.h"
#include "GnssPowerIndicationCallback.h"
#include "gnss_hal_test.h"
using android::sp;
using android::hardware::gnss::BlocklistedSource;
-using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
+using android::hardware::gnss::ElapsedRealtime;
+using android::hardware::gnss::GnssClock;
+using android::hardware::gnss::GnssMeasurement;
+using android::hardware::gnss::IGnss;
using android::hardware::gnss::IGnssConfiguration;
+using android::hardware::gnss::IGnssMeasurementCallback;
+using android::hardware::gnss::IGnssMeasurementInterface;
using android::hardware::gnss::IGnssPowerIndication;
using android::hardware::gnss::IGnssPsds;
using android::hardware::gnss::PsdsType;
+using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
+
/*
* SetupTeardownCreateCleanup:
* Requests the gnss HAL then calls cleanup
@@ -53,6 +64,62 @@
}
/*
+ * TestGnssMeasurementExtension:
+ * 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
+ * 2. Sets a GnssMeasurementCallback, waits for a measurement, and verifies fields are valid.
+ */
+TEST_P(GnssHalTest, TestGnssMeasurementExtension) {
+ const int kFirstGnssMeasurementTimeoutSeconds = 10;
+ sp<IGnssMeasurementInterface> iGnssMeasurement;
+ auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+ auto callback = sp<GnssMeasurementCallbackAidl>::make();
+ status = iGnssMeasurement->setCallback(callback, /* enableFullTracking= */ true);
+ ASSERT_TRUE(status.isOk());
+
+ android::hardware::gnss::GnssData lastMeasurement;
+ ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
+ kFirstGnssMeasurementTimeoutSeconds));
+ EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), 1);
+ ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
+
+ // Validity check GnssData fields
+ ASSERT_TRUE(
+ lastMeasurement.elapsedRealtime.flags >= 0 &&
+ lastMeasurement.elapsedRealtime.flags <=
+ (ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS));
+ if (lastMeasurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) {
+ ASSERT_TRUE(lastMeasurement.elapsedRealtime.timestampNs > 0);
+ }
+ if (lastMeasurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) {
+ ASSERT_TRUE(lastMeasurement.elapsedRealtime.timeUncertaintyNs > 0);
+ }
+ ASSERT_TRUE(lastMeasurement.clock.gnssClockFlags >= 0 &&
+ lastMeasurement.clock.gnssClockFlags <=
+ (GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY |
+ GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS |
+ GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
+ GnssClock::HAS_DRIFT_UNCERTAINTY));
+ for (const auto& measurement : lastMeasurement.measurements) {
+ ASSERT_TRUE(
+ measurement.flags >= 0 &&
+ measurement.flags <=
+ (GnssMeasurement::HAS_SNR | GnssMeasurement::HAS_CARRIER_FREQUENCY |
+ GnssMeasurement::HAS_CARRIER_CYCLES | GnssMeasurement::HAS_CARRIER_PHASE |
+ GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY |
+ GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL |
+ GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
+ GnssMeasurement::HAS_SATELLITE_ISB |
+ GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY));
+ }
+
+ status = iGnssMeasurement->close();
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
* TestGnssPowerIndication
* 1. Gets the GnssPowerIndicationExtension.
* 2. Sets a GnssPowerIndicationCallback.
diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp
index 730de4b..be1d532 100644
--- a/gnss/common/utils/default/Android.bp
+++ b/gnss/common/utils/default/Android.bp
@@ -42,5 +42,6 @@
"android.hardware.gnss@2.1",
"android.hardware.gnss.measurement_corrections@1.1",
"android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss-ndk_platform",
],
}
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index d336f1b..dd932d4 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -17,6 +17,7 @@
#include <Constants.h>
#include <MockLocation.h>
#include <Utils.h>
+#include <aidl/android/hardware/gnss/BnGnss.h>
#include <utils/SystemClock.h>
namespace android {
@@ -24,16 +25,28 @@
namespace gnss {
namespace common {
+using IGnss = aidl::android::hardware::gnss::IGnss;
+using IGnssMeasurementCallback = aidl::android::hardware::gnss::IGnssMeasurementCallback;
+using GnssMeasurement = aidl::android::hardware::gnss::GnssMeasurement;
using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags;
using GnssMeasurementFlagsV1_0 = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags;
using GnssMeasurementFlagsV2_1 = V2_1::IGnssMeasurementCallback::GnssMeasurementFlags;
using GnssMeasurementStateV2_0 = V2_0::IGnssMeasurementCallback::GnssMeasurementState;
-using ElapsedRealtime = V2_0::ElapsedRealtime;
+using ElapsedRealtime = aidl::android::hardware::gnss::ElapsedRealtime;
using ElapsedRealtimeFlags = V2_0::ElapsedRealtimeFlags;
using GnssConstellationTypeV2_0 = V2_0::GnssConstellationType;
using IGnssMeasurementCallbackV2_0 = V2_0::IGnssMeasurementCallback;
using GnssSignalType = V2_1::GnssSignalType;
+using GnssDataV2_0 = V2_0::IGnssMeasurementCallback::GnssData;
+using GnssDataV2_1 = V2_1::IGnssMeasurementCallback::GnssData;
+using GnssSvInfoV1_0 = V1_0::IGnssCallback::GnssSvInfo;
+using GnssSvInfoV2_0 = V2_0::IGnssCallback::GnssSvInfo;
+using GnssSvInfoV2_1 = V2_1::IGnssCallback::GnssSvInfo;
+using GnssAntennaInfo = ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo;
+using Row = V2_1::IGnssAntennaInfoCallback::Row;
+using Coord = V2_1::IGnssAntennaInfoCallback::Coord;
+
GnssDataV2_1 Utils::getMockMeasurementV2_1() {
GnssDataV2_0 gnssDataV2_0 = Utils::getMockMeasurementV2_0();
V2_1::IGnssMeasurementCallback::GnssMeasurement gnssMeasurementV2_1 = {
@@ -110,7 +123,7 @@
.driftUncertaintyNsps = 310.64968328491528,
.hwClockDiscontinuityCount = 1};
- ElapsedRealtime timestamp = {
+ V2_0::ElapsedRealtime timestamp = {
.flags = ElapsedRealtimeFlags::HAS_TIMESTAMP_NS |
ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS,
.timestampNs = static_cast<uint64_t>(::android::elapsedRealtimeNano()),
@@ -124,6 +137,52 @@
return gnssData;
}
+aidl::android::hardware::gnss::GnssData Utils::getMockMeasurement() {
+ aidl::android::hardware::gnss::GnssSignalType signalType = {
+ .constellation = aidl::android::hardware::gnss::GnssConstellationType::GLONASS,
+ .carrierFrequencyHz = 1.59975e+09,
+ .codeType = aidl::android::hardware::gnss::GnssSignalType::CODE_TYPE_C,
+ };
+ aidl::android::hardware::gnss::GnssMeasurement measurement = {
+ .flags = GnssMeasurement::HAS_CARRIER_FREQUENCY,
+ .svid = 6,
+ .signalType = signalType,
+ .timeOffsetNs = 0.0,
+ .receivedSvTimeInNs = 8195997131077,
+ .receivedSvTimeUncertaintyInNs = 15,
+ .antennaCN0DbHz = 30.0,
+ .pseudorangeRateMps = -484.13739013671875,
+ .pseudorangeRateUncertaintyMps = 1.0379999876022339,
+ .accumulatedDeltaRangeState = GnssMeasurement::ADR_STATE_UNKNOWN,
+ .accumulatedDeltaRangeM = 0.0,
+ .accumulatedDeltaRangeUncertaintyM = 0.0,
+ .multipathIndicator = aidl::android::hardware::gnss::GnssMultipathIndicator::UNKNOWN,
+ .state = GnssMeasurement::STATE_CODE_LOCK | GnssMeasurement::STATE_BIT_SYNC |
+ GnssMeasurement::STATE_SUBFRAME_SYNC | GnssMeasurement::STATE_TOW_DECODED |
+ GnssMeasurement::STATE_GLO_STRING_SYNC |
+ GnssMeasurement::STATE_GLO_TOD_DECODED};
+
+ aidl::android::hardware::gnss::GnssClock clock = {.timeNs = 2713545000000,
+ .fullBiasNs = -1226701900521857520,
+ .biasNs = 0.59689998626708984,
+ .biasUncertaintyNs = 47514.989972114563,
+ .driftNsps = -51.757811607455452,
+ .driftUncertaintyNsps = 310.64968328491528,
+ .hwClockDiscontinuityCount = 1};
+
+ ElapsedRealtime timestamp = {
+ .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS,
+ .timestampNs = ::android::elapsedRealtimeNano(),
+ // This is an hardcoded value indicating a 1ms of uncertainty between the two clocks.
+ // In an actual implementation provide an estimate of the synchronization uncertainty
+ // or don't set the field.
+ .timeUncertaintyNs = 1000000};
+
+ aidl::android::hardware::gnss::GnssData gnssData = {
+ .measurements = {measurement}, .clock = clock, .elapsedRealtime = timestamp};
+ return gnssData;
+}
+
V2_0::GnssLocation Utils::getMockLocationV2_0() {
const V2_0::ElapsedRealtime timestamp = {
.flags = V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS |
diff --git a/gnss/common/utils/default/include/NmeaFixInfo.h b/gnss/common/utils/default/include/NmeaFixInfo.h
index fb2c1a4..06eae7e 100644
--- a/gnss/common/utils/default/include/NmeaFixInfo.h
+++ b/gnss/common/utils/default/include/NmeaFixInfo.h
@@ -26,11 +26,6 @@
namespace hardware {
namespace gnss {
namespace common {
-using ::android::sp;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
constexpr char GPGA_RECORD_TAG[] = "$GPGGA";
constexpr char GPRMC_RECORD_TAG[] = "$GPRMC";
diff --git a/gnss/common/utils/default/include/Utils.h b/gnss/common/utils/default/include/Utils.h
index d9ad5a5..0ca1b00 100644
--- a/gnss/common/utils/default/include/Utils.h
+++ b/gnss/common/utils/default/include/Utils.h
@@ -17,6 +17,7 @@
#ifndef android_hardware_gnss_common_default_Utils_H_
#define android_hardware_gnss_common_default_Utils_H_
+#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
#include <android/hardware/gnss/1.0/IGnss.h>
#include <android/hardware/gnss/2.0/IGnss.h>
#include <android/hardware/gnss/2.1/IGnss.h>
@@ -28,28 +29,22 @@
namespace gnss {
namespace common {
-using GnssDataV2_0 = V2_0::IGnssMeasurementCallback::GnssData;
-using GnssDataV2_1 = V2_1::IGnssMeasurementCallback::GnssData;
-using GnssSvInfoV1_0 = V1_0::IGnssCallback::GnssSvInfo;
-using GnssSvInfoV2_0 = V2_0::IGnssCallback::GnssSvInfo;
-using GnssSvInfoV2_1 = V2_1::IGnssCallback::GnssSvInfo;
-using GnssAntennaInfo = ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo;
-using Row = ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback::Row;
-using Coord = ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback::Coord;
-
struct Utils {
- static GnssDataV2_0 getMockMeasurementV2_0();
- static GnssDataV2_1 getMockMeasurementV2_1();
+ static aidl::android::hardware::gnss::GnssData getMockMeasurement();
+ static V2_0::IGnssMeasurementCallback::GnssData getMockMeasurementV2_0();
+ static V2_1::IGnssMeasurementCallback::GnssData getMockMeasurementV2_1();
static V2_0::GnssLocation getMockLocationV2_0();
static V1_0::GnssLocation getMockLocationV1_0();
- static hidl_vec<GnssSvInfoV2_1> getMockSvInfoListV2_1();
- static GnssSvInfoV2_1 getMockSvInfoV2_1(GnssSvInfoV2_0 gnssSvInfoV2_0, float basebandCN0DbHz);
- static GnssSvInfoV2_0 getMockSvInfoV2_0(GnssSvInfoV1_0 gnssSvInfoV1_0,
- V2_0::GnssConstellationType type);
- static GnssSvInfoV1_0 getMockSvInfoV1_0(int16_t svid, V1_0::GnssConstellationType type,
- float cN0DbHz, float elevationDegrees,
- float azimuthDegrees);
- static hidl_vec<GnssAntennaInfo> getMockAntennaInfos();
+ static hidl_vec<V2_1::IGnssCallback::GnssSvInfo> getMockSvInfoListV2_1();
+ static V2_1::IGnssCallback::GnssSvInfo getMockSvInfoV2_1(
+ V2_0::IGnssCallback::GnssSvInfo gnssSvInfoV2_0, float basebandCN0DbHz);
+ static V2_0::IGnssCallback::GnssSvInfo getMockSvInfoV2_0(
+ V1_0::IGnssCallback::GnssSvInfo gnssSvInfoV1_0, V2_0::GnssConstellationType type);
+ static V1_0::IGnssCallback::GnssSvInfo getMockSvInfoV1_0(int16_t svid,
+ V1_0::GnssConstellationType type,
+ float cN0DbHz, float elevationDegrees,
+ float azimuthDegrees);
+ static hidl_vec<V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo> getMockAntennaInfos();
};
} // namespace common
diff --git a/gnss/common/utils/default/include/v2_1/GnssAntennaInfo.h b/gnss/common/utils/default/include/v2_1/GnssAntennaInfo.h
index e74ff54..a232499 100644
--- a/gnss/common/utils/default/include/v2_1/GnssAntennaInfo.h
+++ b/gnss/common/utils/default/include/v2_1/GnssAntennaInfo.h
@@ -23,29 +23,25 @@
namespace android::hardware::gnss::V2_1::implementation {
-using ::android::sp;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using IGnssAntennaInfo = ::android::hardware::gnss::V2_1::IGnssAntennaInfo;
-using IGnssAntennaInfoCallback = ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback;
-
-struct GnssAntennaInfo : public IGnssAntennaInfo {
+struct GnssAntennaInfo : public ::android::hardware::gnss::V2_1::IGnssAntennaInfo {
GnssAntennaInfo();
~GnssAntennaInfo();
// Methods from ::android::hardware::gnss::V2_1::IGnssAntennaInfo follow.
Return<GnssAntennaInfoStatus> setCallback(
- const sp<IGnssAntennaInfoCallback>& callback) override;
+ const sp<::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback>& callback) override;
Return<void> close() override;
private:
void start();
void stop();
void reportAntennaInfo(
- const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& antennaInfo) const;
+ const hidl_vec<
+ ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo>&
+ antennaInfo) const;
// Guarded by mMutex
- static sp<IGnssAntennaInfoCallback> sCallback;
+ static sp<::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback> sCallback;
std::atomic<long> mMinIntervalMillis;
std::atomic<bool> mIsActive;
diff --git a/gnss/common/utils/default/include/v2_1/GnssConfiguration.h b/gnss/common/utils/default/include/v2_1/GnssConfiguration.h
index 8463a5c..2cfb38f 100644
--- a/gnss/common/utils/default/include/v2_1/GnssConfiguration.h
+++ b/gnss/common/utils/default/include/v2_1/GnssConfiguration.h
@@ -25,35 +25,27 @@
namespace android::hardware::gnss::V2_1::implementation {
-using ::android::sp;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-
-using BlacklistedSourceV2_1 =
- ::android::hardware::gnss::V2_1::IGnssConfiguration::BlacklistedSource;
-using GnssConstellationTypeV2_0 = V2_0::GnssConstellationType;
-using GnssSvInfoV2_1 = V2_1::IGnssCallback::GnssSvInfo;
-
struct BlacklistedSourceHashV2_1 {
- inline int operator()(const BlacklistedSourceV2_1& source) const {
+ inline int operator()(
+ const ::android::hardware::gnss::V2_1::IGnssConfiguration::BlacklistedSource& source)
+ const {
return int(source.constellation) * 1000 + int(source.svid);
}
};
struct BlacklistedSourceEqualV2_1 {
- inline bool operator()(const BlacklistedSourceV2_1& s1, const BlacklistedSourceV2_1& s2) const {
+ inline bool operator()(
+ const ::android::hardware::gnss::V2_1::IGnssConfiguration::BlacklistedSource& s1,
+ const ::android::hardware::gnss::V2_1::IGnssConfiguration::BlacklistedSource& s2)
+ const {
return (s1.constellation == s2.constellation) && (s1.svid == s2.svid);
}
};
using BlacklistedSourceSetV2_1 =
- std::unordered_set<BlacklistedSourceV2_1, BlacklistedSourceHashV2_1,
- BlacklistedSourceEqualV2_1>;
-using BlacklistedConstellationSetV2_1 = std::unordered_set<GnssConstellationTypeV2_0>;
+ std::unordered_set<::android::hardware::gnss::V2_1::IGnssConfiguration::BlacklistedSource,
+ BlacklistedSourceHashV2_1, BlacklistedSourceEqualV2_1>;
+using BlacklistedConstellationSetV2_1 = std::unordered_set<V2_0::GnssConstellationType>;
struct GnssConfiguration : public IGnssConfiguration {
// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
@@ -78,7 +70,7 @@
Return<bool> setBlacklist_2_1(
const hidl_vec<V2_1::IGnssConfiguration::BlacklistedSource>& blacklist) override;
- Return<bool> isBlacklistedV2_1(const GnssSvInfoV2_1& gnssSvInfo) const;
+ Return<bool> isBlacklistedV2_1(const V2_1::IGnssCallback::GnssSvInfo& gnssSvInfo) const;
private:
mutable std::recursive_mutex mMutex;
diff --git a/gnss/common/utils/default/include/v2_1/GnssDebug.h b/gnss/common/utils/default/include/v2_1/GnssDebug.h
index 8580989..481de59 100644
--- a/gnss/common/utils/default/include/v2_1/GnssDebug.h
+++ b/gnss/common/utils/default/include/v2_1/GnssDebug.h
@@ -21,15 +21,8 @@
namespace android::hardware::gnss::V1_1::implementation {
-using ::android::sp;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using V1_0::IGnssDebug;
-
/* Interface for GNSS Debug support. */
-struct GnssDebug : public IGnssDebug {
+struct GnssDebug : public V1_0::IGnssDebug {
/*
* Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
* These declarations were generated from IGnssDebug.hal.
diff --git a/gnss/common/utils/default/include/v2_1/GnssMeasurement.h b/gnss/common/utils/default/include/v2_1/GnssMeasurement.h
index 1d1fc9d..db8407b 100644
--- a/gnss/common/utils/default/include/v2_1/GnssMeasurement.h
+++ b/gnss/common/utils/default/include/v2_1/GnssMeasurement.h
@@ -25,17 +25,6 @@
namespace android::hardware::gnss::V2_1::implementation {
-using GnssDataV2_1 = V2_1::IGnssMeasurementCallback::GnssData;
-using GnssDataV2_0 = V2_0::IGnssMeasurementCallback::GnssData;
-
-using ::android::sp;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-
struct GnssMeasurement : public IGnssMeasurement {
GnssMeasurement();
~GnssMeasurement();
@@ -59,8 +48,8 @@
private:
void start();
void stop();
- void reportMeasurement(const GnssDataV2_0&);
- void reportMeasurement(const GnssDataV2_1&);
+ void reportMeasurement(const V2_0::IGnssMeasurementCallback::GnssData&);
+ void reportMeasurement(const V2_1::IGnssMeasurementCallback::GnssData&);
// Guarded by mMutex
static sp<V2_1::IGnssMeasurementCallback> sCallback_2_1;
diff --git a/gnss/common/utils/default/include/v2_1/GnssMeasurementCorrections.h b/gnss/common/utils/default/include/v2_1/GnssMeasurementCorrections.h
index eaa7659..54045ad 100644
--- a/gnss/common/utils/default/include/v2_1/GnssMeasurementCorrections.h
+++ b/gnss/common/utils/default/include/v2_1/GnssMeasurementCorrections.h
@@ -22,9 +22,6 @@
namespace android::hardware::gnss::measurement_corrections::V1_1::implementation {
-using ::android::sp;
-using ::android::hardware::Return;
-
struct GnssMeasurementCorrections : public IMeasurementCorrections {
GnssMeasurementCorrections();
~GnssMeasurementCorrections();
diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
index 4d1baa7..4d4ec93 100644
--- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h
+++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
@@ -39,16 +39,6 @@
namespace android::hardware::gnss::common::implementation {
-using GnssSvInfo = V2_1::IGnssCallback::GnssSvInfo;
-
-using common::NmeaFixInfo;
-using common::Utils;
-using measurement_corrections::V1_1::implementation::GnssMeasurementCorrections;
-
-using V2_1::implementation::GnssAntennaInfo;
-using V2_1::implementation::GnssConfiguration;
-using V2_1::implementation::GnssMeasurement;
-
constexpr int INPUT_BUFFER_SIZE = 128;
constexpr char CMD_GET_LOCATION[] = "CMD_GET_LOCATION";
constexpr char GNSS_PATH[] = "/dev/gnss0";
@@ -120,7 +110,7 @@
std::unique_ptr<V2_0::GnssLocation> getLocationFromHW();
void reportLocation(const V2_0::GnssLocation&) const;
void reportLocation(const V1_0::GnssLocation&) const;
- void reportSvStatus(const hidl_vec<GnssSvInfo>&) const;
+ void reportSvStatus(const hidl_vec<V2_1::IGnssCallback::GnssSvInfo>&) const;
Return<void> help(const hidl_handle& fd);
Return<void> setLocation(const hidl_handle& fd, const hidl_vec<hidl_string>& options);
@@ -131,15 +121,15 @@
static sp<V1_0::IGnssCallback> sGnssCallback_1_0;
std::atomic<long> mMinIntervalMs;
- sp<GnssConfiguration> mGnssConfiguration;
+ sp<V2_1::implementation::GnssConfiguration> mGnssConfiguration;
std::atomic<bool> mIsActive;
std::atomic<bool> mHardwareModeChecked;
std::atomic<int> mGnssFd;
std::thread mThread;
mutable std::mutex mMutex;
- virtual hidl_vec<GnssSvInfo> filterBlocklistedSatellitesV2_1(
- hidl_vec<GnssSvInfo> gnssSvInfoList);
+ virtual hidl_vec<V2_1::IGnssCallback::GnssSvInfo> filterBlocklistedSatellitesV2_1(
+ hidl_vec<V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList);
};
template <class T_IGnss>
@@ -154,7 +144,7 @@
template <class T_IGnss>
GnssTemplate<T_IGnss>::GnssTemplate()
: mMinIntervalMs(1000),
- mGnssConfiguration{new GnssConfiguration()},
+ mGnssConfiguration{new V2_1::implementation::GnssConfiguration()},
mHardwareModeChecked(false),
mGnssFd(-1) {}
@@ -237,8 +227,8 @@
}
template <class T_IGnss>
-hidl_vec<GnssSvInfo> GnssTemplate<T_IGnss>::filterBlocklistedSatellitesV2_1(
- hidl_vec<GnssSvInfo> gnssSvInfoList) {
+hidl_vec<V2_1::IGnssCallback::GnssSvInfo> GnssTemplate<T_IGnss>::filterBlocklistedSatellitesV2_1(
+ hidl_vec<V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList) {
ALOGD("filterBlocklistedSatellitesV2_1");
for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) {
if (mGnssConfiguration->isBlacklistedV2_1(gnssSvInfoList[i])) {
@@ -348,7 +338,7 @@
template <class T_IGnss>
Return<sp<V1_0::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement() {
ALOGD("Gnss::getExtensionGnssMeasurement");
- return new GnssMeasurement();
+ return new V2_1::implementation::GnssMeasurement();
}
template <class T_IGnss>
@@ -501,14 +491,14 @@
template <class T_IGnss>
Return<sp<V2_0::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement_2_0() {
ALOGD("Gnss::getExtensionGnssMeasurement_2_0");
- return new GnssMeasurement();
+ return new V2_1::implementation::GnssMeasurement();
}
template <class T_IGnss>
Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>>
GnssTemplate<T_IGnss>::getExtensionMeasurementCorrections() {
ALOGD("Gnss::getExtensionMeasurementCorrections()");
- return new GnssMeasurementCorrections();
+ return new measurement_corrections::V1_1::implementation::GnssMeasurementCorrections();
}
template <class T_IGnss>
@@ -569,7 +559,7 @@
template <class T_IGnss>
Return<sp<V2_1::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement_2_1() {
ALOGD("Gnss::getExtensionGnssMeasurement_2_1");
- return new GnssMeasurement();
+ return new V2_1::implementation::GnssMeasurement();
}
template <class T_IGnss>
@@ -582,17 +572,18 @@
Return<sp<measurement_corrections::V1_1::IMeasurementCorrections>>
GnssTemplate<T_IGnss>::getExtensionMeasurementCorrections_1_1() {
ALOGD("Gnss::getExtensionMeasurementCorrections_1_1()");
- return new GnssMeasurementCorrections();
+ return new measurement_corrections::V1_1::implementation::GnssMeasurementCorrections();
}
template <class T_IGnss>
Return<sp<V2_1::IGnssAntennaInfo>> GnssTemplate<T_IGnss>::getExtensionGnssAntennaInfo() {
ALOGD("Gnss::getExtensionGnssAntennaInfo");
- return new GnssAntennaInfo();
+ return new V2_1::implementation::GnssAntennaInfo();
}
template <class T_IGnss>
-void GnssTemplate<T_IGnss>::reportSvStatus(const hidl_vec<GnssSvInfo>& svInfoList) const {
+void GnssTemplate<T_IGnss>::reportSvStatus(
+ const hidl_vec<V2_1::IGnssCallback::GnssSvInfo>& svInfoList) const {
std::unique_lock<std::mutex> lock(mMutex);
// TODO(skz): update this to call 2_0 callback if non-null
if (sGnssCallback_2_1 == nullptr) {
diff --git a/gnss/common/utils/default/v2_1/GnssConfiguration.cpp b/gnss/common/utils/default/v2_1/GnssConfiguration.cpp
index 8b30701..be974bc 100644
--- a/gnss/common/utils/default/v2_1/GnssConfiguration.cpp
+++ b/gnss/common/utils/default/v2_1/GnssConfiguration.cpp
@@ -21,6 +21,9 @@
namespace android::hardware::gnss::V2_1::implementation {
+using GnssSvInfoV2_1 = V2_1::IGnssCallback::GnssSvInfo;
+using BlacklistedSourceV2_1 = V2_1::IGnssConfiguration::BlacklistedSource;
+
// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setSuplEs(bool enable) {
ALOGD("setSuplEs enable: %d", enable);
@@ -69,7 +72,7 @@
// Methods from ::android::hardware::gnss::V2_1::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setBlacklist_2_1(
- const hidl_vec<V2_1::IGnssConfiguration::BlacklistedSource>& sourceList) {
+ const hidl_vec<BlacklistedSourceV2_1>& sourceList) {
std::unique_lock<std::recursive_mutex> lock(mMutex);
mBlacklistedConstellationSet.clear();
mBlacklistedSourceSet.clear();
diff --git a/gnss/common/utils/default/v2_1/GnssMeasurement.cpp b/gnss/common/utils/default/v2_1/GnssMeasurement.cpp
index 7d3a002..887cb5a 100644
--- a/gnss/common/utils/default/v2_1/GnssMeasurement.cpp
+++ b/gnss/common/utils/default/v2_1/GnssMeasurement.cpp
@@ -114,7 +114,7 @@
}
}
-void GnssMeasurement::reportMeasurement(const GnssDataV2_0& data) {
+void GnssMeasurement::reportMeasurement(const V2_0::IGnssMeasurementCallback::GnssData& data) {
ALOGD("reportMeasurement()");
std::unique_lock<std::mutex> lock(mMutex);
if (sCallback_2_0 == nullptr) {
@@ -127,7 +127,7 @@
}
}
-void GnssMeasurement::reportMeasurement(const GnssDataV2_1& data) {
+void GnssMeasurement::reportMeasurement(const V2_1::IGnssMeasurementCallback::GnssData& data) {
ALOGD("reportMeasurement()");
std::unique_lock<std::mutex> lock(mMutex);
if (sCallback_2_1 == nullptr) {
diff --git a/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h b/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h
index 1439158..fec3503 100644
--- a/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h
+++ b/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h
@@ -23,36 +23,10 @@
#include <gtest/gtest.h>
#include <chrono>
-using ::android::hardware::gnss::common::Utils;
-
-using android::hardware::hidl_vec;
-using android::hardware::Return;
-using android::hardware::Void;
-
-using android::hardware::gnss::common::GnssCallback;
-using android::hardware::gnss::common::GnssCallbackEventQueue;
-using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
-using android::hardware::gnss::V1_0::GnssLocationFlags;
-using android::hardware::gnss::V2_0::GnssConstellationType;
-using android::hardware::gnss::V2_1::IGnssAntennaInfo;
-using android::hardware::gnss::V2_1::IGnssAntennaInfoCallback;
-
-using GnssLocation_1_0 = android::hardware::gnss::V1_0::GnssLocation;
-using GnssLocation_2_0 = android::hardware::gnss::V2_0::GnssLocation;
-
-using IGnssCallback_1_0 = android::hardware::gnss::V1_0::IGnssCallback;
-using IGnssCallback_2_0 = android::hardware::gnss::V2_0::IGnssCallback;
-using IGnssCallback_2_1 = android::hardware::gnss::V2_1::IGnssCallback;
-
-using IGnssMeasurementCallback_1_0 = android::hardware::gnss::V1_0::IGnssMeasurementCallback;
-using IGnssMeasurementCallback_1_1 = android::hardware::gnss::V1_1::IGnssMeasurementCallback;
-using IGnssMeasurementCallback_2_0 = android::hardware::gnss::V2_0::IGnssMeasurementCallback;
-using IGnssMeasurementCallback_2_1 = android::hardware::gnss::V2_1::IGnssMeasurementCallback;
-
-using android::sp;
-
#define TIMEOUT_SEC 2 // for basic commands/responses
+namespace android::hardware::gnss::common {
+
// The main test class for GNSS HAL.
template <class T_IGnss>
class GnssHalTestTemplate : public testing::TestWithParam<std::string> {
@@ -62,34 +36,37 @@
virtual void TearDown() override;
/* Callback class for GnssMeasurement. */
- class GnssMeasurementCallback : public IGnssMeasurementCallback_2_1 {
+ class GnssMeasurementCallback : public V2_1::IGnssMeasurementCallback {
public:
- GnssCallbackEventQueue<IGnssMeasurementCallback_2_1::GnssData> measurement_cbq_;
+ GnssCallbackEventQueue<V2_1::IGnssMeasurementCallback::GnssData> measurement_cbq_;
GnssMeasurementCallback() : measurement_cbq_("measurement"){};
virtual ~GnssMeasurementCallback() = default;
// Methods from V1_0::IGnssMeasurementCallback follow.
- Return<void> GnssMeasurementCb(const IGnssMeasurementCallback_1_0::GnssData&) override {
+ Return<void> GnssMeasurementCb(const V1_0::IGnssMeasurementCallback::GnssData&) override {
return Void();
}
// Methods from V1_1::IGnssMeasurementCallback follow.
- Return<void> gnssMeasurementCb(const IGnssMeasurementCallback_1_1::GnssData&) override {
+ Return<void> gnssMeasurementCb(const V1_1::IGnssMeasurementCallback::GnssData&) override {
return Void();
}
// Methods from V2_0::IGnssMeasurementCallback follow.
- Return<void> gnssMeasurementCb_2_0(const IGnssMeasurementCallback_2_0::GnssData&) override {
+ Return<void> gnssMeasurementCb_2_0(
+ const V2_0::IGnssMeasurementCallback::GnssData&) override {
return Void();
}
// Methods from V2_1::IGnssMeasurementCallback follow.
- Return<void> gnssMeasurementCb_2_1(const IGnssMeasurementCallback_2_1::GnssData&) override;
+ Return<void> gnssMeasurementCb_2_1(
+ const V2_1::IGnssMeasurementCallback::GnssData&) override;
};
/* Callback class for GnssMeasurementCorrections. */
- class GnssMeasurementCorrectionsCallback : public IMeasurementCorrectionsCallback {
+ class GnssMeasurementCorrectionsCallback
+ : public measurement_corrections::V1_0::IMeasurementCorrectionsCallback {
public:
uint32_t last_capabilities_;
GnssCallbackEventQueue<uint32_t> capabilities_cbq_;
@@ -102,9 +79,9 @@
};
/* Callback class for GnssAntennaInfo. */
- class GnssAntennaInfoCallback : public IGnssAntennaInfoCallback {
+ class GnssAntennaInfoCallback : public V2_1::IGnssAntennaInfoCallback {
public:
- GnssCallbackEventQueue<hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>>
+ GnssCallbackEventQueue<hidl_vec<V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo>>
antenna_info_cbq_;
GnssAntennaInfoCallback() : antenna_info_cbq_("info"){};
@@ -112,7 +89,7 @@
// Methods from V2_1::GnssAntennaInfoCallback follow.
Return<void> gnssAntennaInfoCb(
- const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos);
+ const hidl_vec<V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos);
};
/*
@@ -138,7 +115,7 @@
*
* check_speed: true if speed related fields are also verified.
*/
- void CheckLocation(const GnssLocation_2_0& location, const bool check_speed);
+ void CheckLocation(const V2_0::GnssLocation& location, const bool check_speed);
/*
* StartAndCheckLocations:
@@ -170,7 +147,7 @@
* Note that location is not stopped in this method. The client should call
* StopAndClearLocations() after the call.
*/
- GnssConstellationType startLocationAndGetNonGpsConstellation(
+ V2_0::GnssConstellationType startLocationAndGetNonGpsConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout);
sp<T_IGnss> gnss_hal_; // GNSS HAL to call into
@@ -283,7 +260,7 @@
}
template <class T_IGnss>
-void GnssHalTestTemplate<T_IGnss>::CheckLocation(const GnssLocation_2_0& location,
+void GnssHalTestTemplate<T_IGnss>::CheckLocation(const V2_0::GnssLocation& location,
bool check_speed) {
const bool check_more_accuracies =
(gnss_cb_->info_cbq_.calledCount() > 0 && gnss_cb_->last_info_.yearOfHw >= 2017);
@@ -315,7 +292,7 @@
}
template <class T_IGnss>
-GnssConstellationType GnssHalTestTemplate<T_IGnss>::startLocationAndGetNonGpsConstellation(
+V2_0::GnssConstellationType GnssHalTestTemplate<T_IGnss>::startLocationAndGetNonGpsConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout) {
gnss_cb_->location_cbq_.reset();
StartAndCheckLocations(locations_to_await);
@@ -328,29 +305,29 @@
sv_info_list_cbq_size, locations_to_await, location_called_count);
// Find first non-GPS constellation to blacklist
- GnssConstellationType constellation_to_blacklist = GnssConstellationType::UNKNOWN;
+ V2_0::GnssConstellationType constellation_to_blacklist = V2_0::GnssConstellationType::UNKNOWN;
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
- hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
+ hidl_vec<V2_1::IGnssCallback::GnssSvInfo> sv_info_vec;
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, gnss_sv_info_list_timeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
- if ((gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX) &&
- (gnss_sv.v2_0.constellation != GnssConstellationType::UNKNOWN) &&
- (gnss_sv.v2_0.constellation != GnssConstellationType::GPS)) {
+ if ((gnss_sv.v2_0.v1_0.svFlag & V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX) &&
+ (gnss_sv.v2_0.constellation != V2_0::GnssConstellationType::UNKNOWN) &&
+ (gnss_sv.v2_0.constellation != V2_0::GnssConstellationType::GPS)) {
// found a non-GPS constellation
constellation_to_blacklist = gnss_sv.v2_0.constellation;
break;
}
}
- if (constellation_to_blacklist != GnssConstellationType::UNKNOWN) {
+ if (constellation_to_blacklist != V2_0::GnssConstellationType::UNKNOWN) {
break;
}
}
- if (constellation_to_blacklist == GnssConstellationType::UNKNOWN) {
+ if (constellation_to_blacklist == V2_0::GnssConstellationType::UNKNOWN) {
ALOGI("No non-GPS constellations found, constellation blacklist test less effective.");
// Proceed functionally to blacklist something.
- constellation_to_blacklist = GnssConstellationType::GLONASS;
+ constellation_to_blacklist = V2_0::GnssConstellationType::GLONASS;
}
return constellation_to_blacklist;
@@ -358,7 +335,7 @@
template <class T_IGnss>
Return<void> GnssHalTestTemplate<T_IGnss>::GnssMeasurementCallback::gnssMeasurementCb_2_1(
- const IGnssMeasurementCallback_2_1::GnssData& data) {
+ const V2_1::IGnssMeasurementCallback::GnssData& data) {
ALOGD("GnssMeasurement v2.1 received. Size = %d", (int)data.measurements.size());
measurement_cbq_.store(data);
return Void();
@@ -374,8 +351,10 @@
template <class T_IGnss>
Return<void> GnssHalTestTemplate<T_IGnss>::GnssAntennaInfoCallback::gnssAntennaInfoCb(
- const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos) {
+ const hidl_vec<V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos) {
ALOGD("GnssAntennaInfo v2.1 received. Size = %d", (int)gnssAntennaInfos.size());
antenna_info_cbq_.store(gnssAntennaInfos);
return Void();
}
+
+} // namespace android::hardware::gnss::common
diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal
index 2c8ac5e..4566558 100644
--- a/radio/1.6/IRadio.hal
+++ b/radio/1.6/IRadio.hal
@@ -327,12 +327,26 @@
* @param serial Serial number of request.
* @param networkTypeBitmap a 32-bit bearer bitmap of RadioAccessFamily
*
- * Response callbask is IRadioResponse.setNetworkTypeBitmapResponse()
+ * Response callback is IRadioResponse.setNetworkTypeBitmapResponse()
*/
oneway setAllowedNetworkTypeBitmap(
uint32_t serial, bitfield<RadioAccessFamily> networkTypeBitmap);
/**
+ * Requests bitmap representing the currently allowed network types.
+ *
+ * Requests the bitmap set by the corresponding method
+ * setAllowedNetworkTypeBitmap, which sets a strict set of RATs for the
+ * radio to use. Differs from getPreferredNetworkType and getPreferredNetworkTypeBitmap
+ * in that those request *preferences*.
+ *
+ * @param serial Serial number of request.
+ *
+ * Response callback is IRadioResponse.getNetworkTypeBitmapResponse()
+ */
+ oneway getAllowedNetworkTypeBitmap(uint32_t serial);
+
+ /**
* Control data throttling at modem.
* - DataThrottlingAction:NO_DATA_THROTTLING should clear any existing
* data throttling within the requested completion window.
diff --git a/radio/1.6/IRadioResponse.hal b/radio/1.6/IRadioResponse.hal
index 3b2061f..f13ee2b 100644
--- a/radio/1.6/IRadioResponse.hal
+++ b/radio/1.6/IRadioResponse.hal
@@ -17,6 +17,7 @@
package android.hardware.radio@1.6;
import @1.0::SendSmsResult;
+import @1.4::RadioAccessFamily;
import @1.5::IRadioResponse;
import @1.6::CellInfo;
import @1.6::RegStateResult;
@@ -310,6 +311,23 @@
oneway setAllowedNetworkTypeBitmapResponse(RadioResponseInfo info);
/**
+ * Callback of IRadio.getAllowedNetworkTypeBitmap(int, bitfield<RadioAccessFamily>)
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:MODE_NOT_SUPPORTED
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:MODEM_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ oneway getAllowedNetworkTypeBitmapResponse(
+ RadioResponseInfo info, bitfield<RadioAccessFamily> networkTypeBitmap);
+
+ /**
* @param info Response info struct containing response type, serial no. and error
*
* Valid errors returned:
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
index 111fcd1..ab56540 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
+++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
@@ -793,6 +793,12 @@
Return<void> setAllowedNetworkTypeBitmapResponse(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
+ Return<void> getAllowedNetworkTypeBitmapResponse(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const ::android::hardware::hidl_bitfield<
+ ::android::hardware::radio::V1_4::RadioAccessFamily>
+ networkTypeBitmap);
+
Return<void> setDataThrottlingResponse(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp
index 68d1f20..e37efdd 100644
--- a/radio/1.6/vts/functional/radio_response.cpp
+++ b/radio/1.6/vts/functional/radio_response.cpp
@@ -1157,6 +1157,14 @@
return Void();
}
+Return<void> RadioResponse_v1_6::getAllowedNetworkTypeBitmapResponse(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_bitfield<
+ ::android::hardware::radio::V1_4::RadioAccessFamily>
+ /*networkTypeBitmap*/) {
+ return Void();
+}
+
Return<void> RadioResponse_v1_6::setDataThrottlingResponse(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info) {
rspInfo = info;
diff --git a/renderscript/1.0/types.hal b/renderscript/1.0/types.hal
index 7c32188..bb39baa 100644
--- a/renderscript/1.0/types.hal
+++ b/renderscript/1.0/types.hal
@@ -170,7 +170,6 @@
};
// Script to Script
-@export(name="RsScriptCall")
struct ScriptCall {
ForEachStrategy strategy;
uint32_t xStart;
diff --git a/soundtrigger/2.1/ISoundTriggerHwCallback.hal b/soundtrigger/2.1/ISoundTriggerHwCallback.hal
index 42e851b..b7720b6 100644
--- a/soundtrigger/2.1/ISoundTriggerHwCallback.hal
+++ b/soundtrigger/2.1/ISoundTriggerHwCallback.hal
@@ -22,7 +22,6 @@
/**
* SoundTrigger HAL Callback interface. Obtained during SoundTrigger setup.
*/
-@hidl_callback
interface ISoundTriggerHwCallback extends @2.0::ISoundTriggerHwCallback {
/**
diff --git a/wifi/1.5/IWifiChip.hal b/wifi/1.5/IWifiChip.hal
index 2702759..e9caa3d 100644
--- a/wifi/1.5/IWifiChip.hal
+++ b/wifi/1.5/IWifiChip.hal
@@ -17,6 +17,7 @@
package android.hardware.wifi@1.5;
import @1.0::WifiStatus;
+import @1.0::IfaceType;
import @1.5::IWifiApIface;
import @1.0::IWifiIface;
import @1.3::IWifiChip;
@@ -129,7 +130,6 @@
*/
setMultiStaUseCase(MultiStaUseCase useCase) generates (WifiStatus status);
-
/**
* Create bridged IWifiApIface.
*
@@ -167,4 +167,47 @@
*/
removeIfaceInstanceFromBridgedApIface(string brIfaceName, string ifaceInstanceName)
generates (WifiStatus status);
+
+ /**
+ * Representation of a Wi-Fi channel for Wi-Fi coex channel avoidance.
+ */
+ struct CoexUnsafeChannel {
+ /* The band of the channel */
+ WifiBand band;
+ /* The channel number */
+ uint32_t channel;
+ /** The power cap will be a maximum power value in dbm that is allowed to be transmitted by
+ the chip on this channel. A value of PowerCapConstant.NO_POWER_CAP means no limitation
+ on transmitted power is needed by the chip for this channel.
+ */
+ int32_t powerCapDbm;
+ };
+
+ enum PowerCapConstant : int32_t {
+ NO_POWER_CAP = 0x7FFFFFFF,
+ };
+
+ /**
+ * Invoked to indicate that the provided |CoexUnsafeChannels| should be avoided with the
+ * specified restrictions.
+ *
+ * Channel avoidance is a suggestion and should be done on a best-effort approach. If a provided
+ * channel is used, then the specified power cap should be applied.
+ *
+ * In addition, hard restrictions on the Wifi modes may be indicated by |IfaceType| bits
+ * (STA, AP, P2P, NAN, etc) in the |restrictions| bitfield. If a hard restriction is provided,
+ * then the channels should be completely avoided for the provided Wifi modes instead of by
+ * best-effort.
+ *
+ * @param unsafeChannels List of |CoexUnsafeChannels| to avoid.
+ * @param restrictions Bitset of |IfaceType| values indicating Wifi modes to completely avoid.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|,
+ */
+ setCoexUnsafeChannels(
+ vec<CoexUnsafeChannel> unsafeChannels, bitfield<IfaceType> restrictions)
+ generates (WifiStatus status);
};
diff --git a/wifi/1.5/default/hidl_struct_util.cpp b/wifi/1.5/default/hidl_struct_util.cpp
index 83d06fe..8e2e647 100644
--- a/wifi/1.5/default/hidl_struct_util.cpp
+++ b/wifi/1.5/default/hidl_struct_util.cpp
@@ -2800,6 +2800,47 @@
}
CHECK(false);
}
+
+bool convertHidlCoexUnsafeChannelToLegacy(
+ const IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel,
+ legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) {
+ if (!legacy_unsafe_channel) {
+ return false;
+ }
+ *legacy_unsafe_channel = {};
+ switch (hidl_unsafe_channel.band) {
+ case WifiBand::BAND_24GHZ:
+ legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND;
+ break;
+ case WifiBand::BAND_5GHZ:
+ legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND;
+ break;
+ default:
+ return false;
+ };
+ legacy_unsafe_channel->channel = hidl_unsafe_channel.channel;
+ legacy_unsafe_channel->power_cap_dbm = hidl_unsafe_channel.powerCapDbm;
+ return true;
+}
+
+bool convertHidlVectorOfCoexUnsafeChannelToLegacy(
+ const std::vector<IWifiChip::CoexUnsafeChannel>& hidl_unsafe_channels,
+ std::vector<legacy_hal::wifi_coex_unsafe_channel>* legacy_unsafe_channels) {
+ if (!legacy_unsafe_channels) {
+ return false;
+ }
+ *legacy_unsafe_channels = {};
+ for (const auto& hidl_unsafe_channel : hidl_unsafe_channels) {
+ legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel;
+ if (!hidl_struct_util::convertHidlCoexUnsafeChannelToLegacy(
+ hidl_unsafe_channel, &legacy_unsafe_channel)) {
+ return false;
+ }
+ legacy_unsafe_channels->push_back(legacy_unsafe_channel);
+ }
+ return true;
+}
+
} // namespace hidl_struct_util
} // namespace implementation
} // namespace V1_5
diff --git a/wifi/1.5/default/hidl_struct_util.h b/wifi/1.5/default/hidl_struct_util.h
index 49d8a12..feb47ef 100644
--- a/wifi/1.5/default/hidl_struct_util.h
+++ b/wifi/1.5/default/hidl_struct_util.h
@@ -71,6 +71,12 @@
IfaceType hidl_interface_type);
legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy(
IWifiChip::MultiStaUseCase use_case);
+bool convertHidlCoexUnsafeChannelToLegacy(
+ const IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel,
+ legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel);
+bool convertHidlVectorOfCoexUnsafeChannelToLegacy(
+ const std::vector<IWifiChip::CoexUnsafeChannel>& hidl_unsafe_channels,
+ std::vector<legacy_hal::wifi_coex_unsafe_channel>* legacy_unsafe_channels);
// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(
diff --git a/wifi/1.5/default/wifi_chip.cpp b/wifi/1.5/default/wifi_chip.cpp
index dd39551..1b0353b 100644
--- a/wifi/1.5/default/wifi_chip.cpp
+++ b/wifi/1.5/default/wifi_chip.cpp
@@ -722,6 +722,15 @@
hidl_status_cb, use_case);
}
+Return<void> WifiChip::setCoexUnsafeChannels(
+ const hidl_vec<CoexUnsafeChannel>& unsafeChannels,
+ hidl_bitfield<IfaceType> restrictions,
+ setCoexUnsafeChannels_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::setCoexUnsafeChannelsInternal,
+ hidl_status_cb, unsafeChannels, restrictions);
+}
+
void WifiChip::invalidateAndRemoveAllIfaces() {
invalidateAndClearBridgedApAll();
invalidateAndClearAll(ap_ifaces_);
@@ -1447,6 +1456,18 @@
return createWifiStatusFromLegacyError(legacy_status);
}
+WifiStatus WifiChip::setCoexUnsafeChannelsInternal(
+ std::vector<CoexUnsafeChannel> unsafe_channels, uint32_t restrictions) {
+ std::vector<legacy_hal::wifi_coex_unsafe_channel> legacy_unsafe_channels;
+ if (!hidl_struct_util::convertHidlVectorOfCoexUnsafeChannelToLegacy(
+ unsafe_channels, &legacy_unsafe_channels)) {
+ return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+ }
+ auto legacy_status = legacy_hal_.lock()->setCoexUnsafeChannels(
+ legacy_unsafe_channels, restrictions);
+ return createWifiStatusFromLegacyError(legacy_status);
+}
+
WifiStatus WifiChip::handleChipConfiguration(
/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock,
ChipModeId mode_id) {
diff --git a/wifi/1.5/default/wifi_chip.h b/wifi/1.5/default/wifi_chip.h
index bff8d68..95c122d 100644
--- a/wifi/1.5/default/wifi_chip.h
+++ b/wifi/1.5/default/wifi_chip.h
@@ -174,6 +174,10 @@
Return<void> setMultiStaUseCase(
MultiStaUseCase use_case,
setMultiStaUseCase_cb hidl_status_cb) override;
+ Return<void> setCoexUnsafeChannels(
+ const hidl_vec<CoexUnsafeChannel>& unsafe_channels,
+ hidl_bitfield<IfaceType> restrictions,
+ setCoexUnsafeChannels_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -252,6 +256,8 @@
const sp<V1_4::IWifiChipEventCallback>& event_callback);
WifiStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname);
WifiStatus setMultiStaUseCaseInternal(MultiStaUseCase use_case);
+ WifiStatus setCoexUnsafeChannelsInternal(
+ std::vector<CoexUnsafeChannel> unsafe_channels, uint32_t restrictions);
WifiStatus handleChipConfiguration(
std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id);
diff --git a/wifi/1.5/default/wifi_legacy_hal.cpp b/wifi/1.5/default/wifi_legacy_hal.cpp
index 76e718b..773dd9b 100644
--- a/wifi/1.5/default/wifi_legacy_hal.cpp
+++ b/wifi/1.5/default/wifi_legacy_hal.cpp
@@ -1521,6 +1521,14 @@
use_case);
}
+wifi_error WifiLegacyHal::setCoexUnsafeChannels(
+ std::vector<wifi_coex_unsafe_channel> unsafe_channels,
+ uint32_t restrictions) {
+ return global_func_table_.wifi_set_coex_unsafe_channels(
+ global_handle_, unsafe_channels.size(), unsafe_channels.data(),
+ restrictions);
+}
+
void WifiLegacyHal::invalidate() {
global_handle_ = nullptr;
iface_name_to_handle_.clear();
diff --git a/wifi/1.5/default/wifi_legacy_hal.h b/wifi/1.5/default/wifi_legacy_hal.h
index 555c540..6266cf6 100644
--- a/wifi/1.5/default/wifi_legacy_hal.h
+++ b/wifi/1.5/default/wifi_legacy_hal.h
@@ -386,6 +386,11 @@
virtual wifi_error multiStaSetPrimaryConnection(const std::string& ifname);
virtual wifi_error multiStaSetUseCase(wifi_multi_sta_use_case use_case);
+ // Coex functions.
+ virtual wifi_error setCoexUnsafeChannels(
+ std::vector<wifi_coex_unsafe_channel> unsafe_channels,
+ uint32_t restrictions);
+
private:
// Retrieve interface handles for all the available interfaces.
wifi_error retrieveIfaceHandles();
diff --git a/wifi/1.5/default/wifi_legacy_hal_stubs.cpp b/wifi/1.5/default/wifi_legacy_hal_stubs.cpp
index 71d2ddf..b6c908b 100644
--- a/wifi/1.5/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.5/default/wifi_legacy_hal_stubs.cpp
@@ -149,6 +149,7 @@
populateStubFor(&hal_fn->wifi_get_chip_feature_set);
populateStubFor(&hal_fn->wifi_multi_sta_set_primary_connection);
populateStubFor(&hal_fn->wifi_multi_sta_set_use_case);
+ populateStubFor(&hal_fn->wifi_set_coex_unsafe_channels);
return true;
}