SmarTak® WnA Code Overview

SmarTak API v4.0.0

Overview

The `SMTK_WnA_Code` is a 32-bit unsigned integer that uniquely identifies any combination of weapon system and ammunition. By using bitwise operations, three critical pieces of information—weapon category (Type), the specific weapon system, and the ammunition type—are encoded into a single, compact field. This documentation outlines the structure of the WnA code and provides the necessary definitions for each field.

WnA Code Bitfield Structure

TYPE WEAPON AMMO
31-28 27-15 14-0

Field Descriptions

FieldBitsDescription
TYPE4Defines the general category of the weapon system (e.g., Handgun, Rifle).
WEAPON13A unique code identifying the specific weapon system.
AMMO15A unique code identifying the specific type of ammunition.

C Structure Definition (`SMTK_WnA_Code_t`)


							typedef struct
							{
								uint32_t wna_code;    // The full 32-bit WnA code
								uint8_t  type;        // 4 bits for weapon type
								uint16_t weapon;      // 13 bits for the weapon code
								uint16_t ammo;        // 15 bits for the ammunition code
							} SMTK_WnA_Code_t;

The Core Logic: Encoding and Decoding

The API provides macros to seamlessly compose the 32-bit code from its parts (encoding) and extract the parts from the code (decoding) using bitwise operations.

Encoding Process

Type Code
+
Weapon Code
+
Ammo Code
SMTK_WnA_MSK_32bit_CODE(t, w, a)

(Bitwise Shifts & OR operations)

32-bit WnA Code

Decoding Process

32-bit WnA Code
SMTK_WnA_GET_...(x)

(Bitwise Masking & Right Shifts)

Type Code
Weapon Code
Ammo Code

`TYPE` Field Definitions

MacroValue (Hex)Description
WNA_TYPE_CODE_MED0x0Medical
WNA_TYPE_CODE_HGUN0x1Handgun
WNA_TYPE_CODE_RIFLE0x2Rifle
WNA_TYPE_CODE_CREW0x3Crew Served
WNA_TYPE_CODE_AT0x4Anti-Tank
WNA_TYPE_CODE_MORTAR0x5Mortar
WNA_TYPE_CODE_DRONE0x6Drone Payload
WNA_TYPE_CODE_MISSILE0x7Missile
WNA_TYPE_CODE_EW0x8Electronic Warfare
WNA_TYPE_CODE_PYRO0x9Pyrotechnic
WNA_TYPE_CODE_DEMO0xADemolition
WNA_TYPE_CODE_DE0xBDirected Energy
WNA_TYPE_CODE_RESERVED_10xCReserved
WNA_TYPE_CODE_RESERVED_20xDReserved
WNA_TYPE_CODE_RESERVED_30xEReserved
WNA_TYPE_CODE_RESERVED_40xFReserved