SDK Version 2.0.1
AnsuR Technologies ASMIRA SDK
Loading...
Searching...
No Matches
asmirasdk.h File Reference
#include <windows.h>
#include <stdio.h>
#include <cstdint>
#include <chrono>
#include <vector>

Go to the source code of this file.

Classes

struct  asdk::frame_t
 A decoded video or photo frame, delivered by FrameFunc. More...
struct  asdk::video_options_t
 Encoder settings in effect on the sending client, delivered by VideoOptionsFunc. More...
struct  asdk::video_mode_t
 What the sending client is currently doing, delivered by VideoModeFunc. More...
struct  asdk::audio_options_t
 Audio encoder settings, see sdk_t::SetAudioOptions and sdk_t::AudioOptions. More...
struct  asdk::audio_frame_t
 Decoded room audio, delivered by DecodedAudioFrameFunc. More...
struct  asdk::position_klv_values_t
 Platform and sensor position decoded from MISB ST 0601 KLV. More...
struct  asdk::position_nmea_values_t
 Position decoded from an NMEA 0183 GNSS receiver. More...
struct  asdk::position_values_t
 Position reported by the sending client, delivered by PositionValuesFunc. More...
struct  asdk::bandwidth_statistics_t
 Full set of transport counters for one reporting period. More...
struct  asdk::bandwidth_statistics_simple_t
 Throughput of the active connection, delivered by BandwidthStatisticsFunc. More...
struct  asdk::certificate_t
 A server certificate, as filled in by sdk_t::RequestCertificate. More...
struct  asdk::sdk_t
 SDK Core. More...

Namespaces

namespace  asdk

Macros

#define ASDK_WINDOWS
#define ASDK_LoadLib(a)
#define ASDK_GetProc(a1, a2)
#define ASDK_FreeLib(a)
#define ASDK_CALL   __cdecl
#define ASDK_SAFE_ALIAS

Typedefs

typedef void * asdk::hsdk
typedef uint32_t asdk::RoomFlagValue
typedef uint32_t asdk::RoomStateValue
typedef uint8_t asdk::UserCapabilityValue
typedef int asdk::DeviceCapabilityValue
typedef uint8_t asdk::AudioFrameStateValue
typedef struct asdk::position_klv_values_t asdk::position_klv_values_t
typedef struct asdk::position_nmea_values_t asdk::position_nmea_values_t
typedef struct asdk::position_values_t asdk::position_values_t
typedef struct asdk::bandwidth_statistics_t asdk::bandwidth_statistics_t
using asdk::TimePoint = std::chrono::high_resolution_clock::time_point
using asdk::TimeMS = std::chrono::milliseconds
using asdk::TimePointSteady = std::chrono::steady_clock::time_point
typedef struct asdk::certificate_t asdk::certificate_t
typedef void(*) asdk::ServerStateFunc(const ServerState serverState, void *opaque)
 The connection to the server changed state.
typedef void(*) asdk::RoomAnnounceFunc(const char *roomName, const uint32_t roomID, const asdk::RoomStateValue state, const asdk::RoomFlagValue flags, void *opaque)
 A room was announced after RequestRoomListSubscribe, or an announced room changed.
typedef void(*) asdk::RoomResponseFunc(const Request request, const RoomResponse response, const void *optionalData, const uint32_t optionalDataSize, void *opaque)
 The server answered a request sent with SendRequest or SendRequestStr.
typedef void(*) asdk::RoomClientAddedFunc(const uint32_t clientID, const char *userName, const UserCapabilityValue userCapability, const DeviceCapabilityValue deviceCapability, void *opaque)
 A client joined the room, and once for each member already present when this client joined.
typedef void(*) asdk::RoomClientRemovedFunc(const uint32_t clientID, void *opaque)
 A client left the room, identified by the clientID given by RoomClientAdded.
typedef void(*) asdk::AuthenticateResponseFunc(const AuthenticationResponse authenticateResponse, void *opaque)
 The server answered the login, see AuthenticationResponse for the bits.
typedef void(*) asdk::FrameFunc(const frame_t *frame, void *opaque)
 A video or photo frame was decoded to RGB.
typedef void(*) asdk::EncodedStreamFunc(const StreamType type, const void *data, const uint32_t dataSize, void *opaque)
 An encoded frame or stream chunk arrived, before any decoding.
typedef void(*) asdk::EncodedAudioFrameFunc(const uint16_t srcID, const unsigned int timeStamp, const asdk::AudioFrameStateValue state, const unsigned char *audioEncoded, const size_t audioEncodedSize, void *opaque)
 An encoded audio frame arrived, before any decoding.
typedef void(*) asdk::VideoOptionsFunc(const video_options_t *videoOptions, void *opaque)
 The sending client reported its encoder settings, see video_options_t.
typedef void(*) asdk::VideoModeFunc(const video_mode_t *videoMode, void *opaque)
 The sending client switched photo mode, ROI or streaming on or off.
typedef void(*) asdk::PositionValuesFunc(const position_values_t *positionValues, void *opaque)
 The sending client reported a position, see position_values_t.
typedef void(*) asdk::BandwidthStatisticsFunc(const bandwidth_statistics_simple_t *bandwidthStatistics, void *opaque)
 Periodic throughput report for the active connection.
typedef void(*) asdk::RoomPreviewImageFunc(const uint32_t roomID, const uint64_t utc, const ImageFormat imageFormat, const uint8_t *data, const uint32_t size, void *opaque)
 A room preview image arrived for a room announced with RoomStatePreview.
typedef void(*) asdk::RoomFileAvailableFunc(const uint32_t roomID, const uint64_t hash, const char *fileName, const uint32_t fileSize, const uint32_t originClientID, const uint64_t utc, void *opaque)
 A room file became available to download (pull model).
typedef void(*) asdk::RoomFileDeletedFunc(const uint32_t roomID, const uint64_t hash, void *opaque)
 A room file (roomID, hash) was deleted for the whole room; drop any reference to it.
typedef void(*) asdk::RoomFileDownloadedFunc(const uint32_t roomID, const uint64_t hash, const char *fileName, const uint8_t *data, const uint32_t size, void *opaque)
 A requested room-file download finished and hash-verified: data/size hold the file bytes (valid only for the duration of the callback).
typedef void(*) asdk::RoomFileProgressFunc(const uint32_t roomID, const uint64_t hash, const char *fileName, const RoomFileDirection direction, const uint32_t transferred, const uint32_t total, void *opaque)
 Bytes moved for a transfer in either direction.
typedef void(*) asdk::RoomFileSentFunc(const uint32_t roomID, const uint64_t hash, const char *fileName, void *opaque)
 An upload reached the server, which now announces it to the other room members.
typedef void(*) asdk::RoomFileErrorFunc(const uint32_t roomID, const uint64_t hash, const char *fileName, const RoomFileError error, void *opaque)
 A transfer failed, anything already received for it has been discarded.
typedef void(*) asdk::ChatMessageFunc(const uint32_t clientID, const char *message, const uint32_t size, void *opaque)
 A chat message was received from the joined room.
typedef void(*) asdk::DecodedAudioFrameFunc(const audio_frame_t *audioFrame, void *opaque)
 A received audio frame was decoded to PCM.
typedef struct asdk::sdk_t asdk::sdk_t

Enumerations

enum  asdk::Status {
  asdk::StatusUndef ,
  asdk::StatusOK ,
  asdk::StatusDisconnected ,
  asdk::StatusError ,
  asdk::StatusErrorHandle ,
  asdk::StatusErrorVideoModule ,
  asdk::StatusErrorImageModule ,
  asdk::StatusErrorInitialized ,
  asdk::StatusErrorConnect ,
  asdk::StatusErrorTransmit ,
  asdk::StatusErrorAudioModule ,
  asdk::StatusErrorFile ,
  asdk::StatusErrorNotPermitted
}
 Result of an SDK call. More...
enum  asdk::ServerState {
  asdk::ServerStateUndef ,
  asdk::ServerStateDisconnected ,
  asdk::ServerStateConnected ,
  asdk::ServerStateConnectedAndAuthenticated ,
  asdk::ServerStateAuthenticateError
}
 State of the connection to the server, reported by ServerStateFunc. More...
enum  asdk::AuthenticationResponse {
  asdk::AuthenticationResponseUndef = 0 ,
  asdk::AuthenticationResponseSuccess = 1 << 0 ,
  asdk::AuthenticationResponseError = 1 << 1 ,
  asdk::AuthenticationResponseVersionError = 1 << 2 ,
  asdk::AuthenticationResponseVersionRecUpgrade = 1 << 3 ,
  asdk::AuthenticationResponseVersionMayUpgrade = 1 << 4 ,
  asdk::AuthenticationResponseLoggedInOther = 1 << 5 ,
  asdk::AuthenticationResponseKickedOther = 1 << 6 ,
  asdk::AuthenticationResponseWrongLoginType = 1 << 7 ,
  asdk::AuthenticationResponseTryAgainLater = 1 << 8 ,
  asdk::AuthenticationResponseFormatError = 1 << 9 ,
  asdk::AuthenticationResponseRequestedCapError = 1 << 10
}
 Outcome of a login attempt, reported by AuthenticateResponseFunc. More...
enum  asdk::Request {
  asdk::RequestUndef ,
  asdk::RequestRoomListSubscribe ,
  asdk::RequestRoomListUnsubscribe ,
  asdk::RequestRoomJoin ,
  asdk::RequestRoomLeave
}
 Request sent with sdk_t::SendRequest or sdk_t::SendRequestStr. More...
enum  asdk::RoomResponse {
  asdk::RoomResponseUndef ,
  asdk::RoomResponseSuccess ,
  asdk::RoomResponseError ,
  asdk::RoomResponseErrorAlreadyJoined ,
  asdk::RoomResponseErrorUnhandled
}
 Server answer to a Request, reported by RoomResponseFunc. More...
enum  asdk::RoomFlag {
  asdk::RoomFlagUndef ,
  asdk::RoomFlagIsPublic = 1 << 0 ,
  asdk::RoomFlagChatGuests = 1 << 1 ,
  asdk::RoomFlagChatViewers = 1 << 2 ,
  asdk::RoomFlagChatSenders = 1 << 3 ,
  asdk::RoomFlagAudioGuests = 1 << 4 ,
  asdk::RoomFlagAudioViewers = 1 << 5 ,
  asdk::RoomFlagAudioSenders = 1 << 6
}
 What a room permits, announced by RoomAnnounceFunc as a RoomFlagValue. More...
enum  asdk::RoomState {
  asdk::RoomStateUndef ,
  asdk::RoomStatePassword = 1 << 0 ,
  asdk::RoomStatePreview = 1 << 1
}
 State of a room, announced by RoomAnnounceFunc as a RoomStateValue. More...
enum  asdk::RoomFileDirection {
  asdk::RoomFileDirectionUndef ,
  asdk::RoomFileDirectionSend ,
  asdk::RoomFileDirectionReceive
}
 Room file transfer direction. More...
enum  asdk::RoomFileError {
  asdk::RoomFileErrorUndef ,
  asdk::RoomFileErrorCanceled ,
  asdk::RoomFileErrorHashMismatch ,
  asdk::RoomFileErrorFile
}
 Room file transfer failure reason. More...
enum  asdk::PositionSource {
  asdk::PositionSourceUndefined ,
  asdk::PositionSourceNMEA ,
  asdk::PositionSourceKLV
}
 Which member of position_values_t carries the position. More...
enum  asdk::StreamType {
  asdk::StreamTypeUnknown ,
  asdk::StreamType264Frame ,
  asdk::StreamType265Frame ,
  asdk::StreamTypeAV1Frame ,
  asdk::StreamTypeMPEGTS ,
  asdk::StreamTypeWEBP
}
 Kind of payload delivered by EncodedStreamFunc. More...
enum  asdk::ImageFormat {
  asdk::ImageFormatUndef ,
  asdk::ImageFormatJPEG ,
  asdk::ImageFormatWEBP ,
  asdk::ImageFormatHEIF ,
  asdk::ImageFormatAVIF ,
  asdk::ImageFormatAV1 ,
  asdk::ImageFormatH265
}
 Encoding of the image delivered by RoomPreviewImageFunc. More...
enum  asdk::UserCapability : uint8_t {
  asdk::UserCapabilityUndef = 0 ,
  asdk::UserCapabilitySender = 1 << 0 ,
  asdk::UserCapabilityController = 1 << 1 ,
  asdk::UserCapabilityViewer = 1 << 2 ,
  asdk::UserCapabilityGuest = 1 << 3 ,
  asdk::UserCapabilitySuper = 1 << 6 ,
  asdk::UserCapabilityUnsure = 1 << 7
}
 The role a client asks the server for on connect. More...
enum  asdk::DeviceCapability : int {
  asdk::DeviceCapabilityUndef = 0 ,
  asdk::DeviceCapabilityVideoAV1 = 1 << 1 ,
  asdk::DeviceCapabilityVideoH264 = 1 << 2 ,
  asdk::DeviceCapabilityVideoH265 = 1 << 3 ,
  asdk::DeviceCapabilityAudioOpus = 1 << 4 ,
  asdk::DeviceCapabilityAudioSpeex = 1 << 5 ,
  asdk::DeviceCapabilityAudioMIC = 1 << 6 ,
  asdk::DeviceCapabilityPhotoModeWEBP = 1 << 7 ,
  asdk::DeviceCapabilityPhotoModeHEIF = 1 << 8 ,
  asdk::DeviceCapabilityPhotoModeAVIF = 1 << 9 ,
  asdk::DeviceCapabilityPhotoROI = 1 << 10 ,
  asdk::DeviceCapabilityVideoROI = 1 << 11 ,
  asdk::DeviceCapabilityChat = 1 << 12 ,
  asdk::DeviceCapabilityDisplay = 1 << 13 ,
  asdk::DeviceCapabilityFileTransfer = 1 << 16 ,
  asdk::DeviceCapabilityASIGN = 1 << 31 ,
  asdk::DeviceCapabilityBasic ,
  asdk::DeviceCapabilityCore ,
  asdk::DeviceCapabilityFull ,
  asdk::DeviceCapabilityHeadless
}
 What a client announces it can do, as a DeviceCapabilityValue. More...
enum  asdk::AudioFrameState {
  asdk::AudioFrameStateUndef = 0 ,
  asdk::AudioFrameSpeex = 1 << 0 ,
  asdk::AudioFrameOpus = 1 << 1 ,
  asdk::AudioFrameServer = 1 << 2
}
 Codec and origin of an encoded audio frame, as an AudioFrameStateValue. More...
enum  asdk::AudioCodec {
  asdk::AudioCodecUndef ,
  asdk::AudioCodecOpus ,
  asdk::AudioCodecSpeex
}
 Audio codec enum, the encoder used by sdk_t::SendAudioFrame. More...
enum  asdk::CertificateState {
  asdk::CertificateStateUndef ,
  asdk::CertificateStateConnected ,
  asdk::CertificateStateReceived ,
  asdk::CertificateStateConnectError
}
 Outcome of sdk_t::RequestCertificate. More...

Functions

TimePoint asdk::TimeNow ()
 Current high resolution clock reading.
long long asdk::TimeSpent (const TimePoint &timeStart)
 Milliseconds elapsed since a TimeNow() reading.
TimePointSteady asdk::TimeNowSteady ()
 Current steady clock reading, unaffected by clock adjustments.
long long asdk::TimeSpentSteady (const TimePointSteady &time)
 Milliseconds elapsed since a TimeNowSteady() reading.
sdk_t * asdk::Initialize ()
 Loads the SDK shared library and creates an SDK handle.

Variables

static const uint8_t asdk::VERSION_MAJOR = 2
static const uint8_t asdk::VERSION_MINOR = 0
static const uint8_t asdk::VERSION_PATCH = 1
static const uint32_t asdk::CHAT_MESSAGE_LEN = 256
static const uint32_t asdk::AUDIO_SAMPLE_RATE = 16000
static const uint32_t asdk::AUDIO_CHANNELS = 1
static const uint32_t asdk::AUDIO_FRAME_SAMPLES = 320

Macro Definition Documentation

◆ ASDK_WINDOWS

#define ASDK_WINDOWS

Definition at line 83 of file asmirasdk.h.

◆ ASDK_LoadLib

#define ASDK_LoadLib ( a)
Value:
(asdk::hsdk)LoadLibraryA(a)
void * hsdk
Definition asmirasdk.h:127

Definition at line 86 of file asmirasdk.h.

Referenced by asdk::Initialize().

◆ ASDK_GetProc

#define ASDK_GetProc ( a1,
a2 )
Value:
GetProcAddress((HINSTANCE__*)a1, a2)

Definition at line 89 of file asmirasdk.h.

Referenced by asdk::Initialize().

◆ ASDK_FreeLib

#define ASDK_FreeLib ( a)
Value:
FreeLibrary((HINSTANCE__*)a)

Definition at line 92 of file asmirasdk.h.

Referenced by asdk::Initialize(), and asdk::sdk_t::Unload().

◆ ASDK_CALL

#define ASDK_CALL   __cdecl

Definition at line 94 of file asmirasdk.h.

Referenced by asdk::Initialize().

◆ ASDK_SAFE_ALIAS

#define ASDK_SAFE_ALIAS

Definition at line 121 of file asmirasdk.h.