![]() |
SDK Version 2.0.1
AnsuR Technologies ASMIRA SDK
|
Typedefs | |
| 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. | |
Enumerations | |
| 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... | |
Functions | |
| Status | asdk::sdk_t::RoomFileSend (const uint32_t roomID, const char *fileName, const void *data, const uint32_t size) |
| Uploads a file to a room from memory. | |
| Status | asdk::sdk_t::RoomFileSendFromPath (const uint32_t roomID, const char *filePath) |
| Uploads a file to a room from disk. | |
| Status | asdk::sdk_t::RoomFileSendResumeFromPath (const uint32_t roomID, const char *filePath) |
| Resumes an interrupted upload of a file from disk. | |
| Status | asdk::sdk_t::RoomFileDownload (const uint32_t roomID, const uint64_t hash) |
| Downloads a room file announced by RoomFileAvailableFunc. | |
| Status | asdk::sdk_t::RoomFileDownloadResume (const uint32_t roomID, const uint64_t hash, const char *fileName, const uint32_t totalSize, const void *haveBytes, const uint32_t haveCount) |
| Resumes a room file download the caller already has part of. | |
| Status | asdk::sdk_t::RoomFileCancel (const uint32_t roomID, const uint64_t hash) |
| Cancels a room file transfer in either direction. | |
| Status | asdk::sdk_t::RoomFileDelete (const uint32_t roomID, const uint64_t hash) |
| Deletes a shared room file for the whole room. | |
| void | asdk::sdk_t::SetRoomFileAvailableCallback (RoomFileAvailableFunc func, void *opaque=nullptr) |
| Room File Available callback. | |
| void | asdk::sdk_t::SetRoomFileDeletedCallback (RoomFileDeletedFunc func, void *opaque=nullptr) |
| Room File Deleted callback. | |
| void | asdk::sdk_t::SetRoomFileDownloadedCallback (RoomFileDownloadedFunc func, void *opaque=nullptr) |
| Room File Downloaded callback. | |
| void | asdk::sdk_t::SetRoomFileProgressCallback (RoomFileProgressFunc func, void *opaque=nullptr) |
| Room File Progress callback. | |
| void | asdk::sdk_t::SetRoomFileSentCallback (RoomFileSentFunc func, void *opaque=nullptr) |
| Room File Sent callback. | |
| void | asdk::sdk_t::SetRoomFileErrorCallback (RoomFileErrorFunc func, void *opaque=nullptr) |
| Room File Error callback. | |
Sharing files with a room: upload from memory or disk, download, resume, cancel and delete.
| 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).
Identify it by (roomID, hash); pass that pair to sdk_t::RoomFileDelete to remove it (privileged, server-enforced). originClientID is the room client id that shared it (matching RoomClientAdded, 0 = server), utc the Unix time it was shared - both handy for a "who/when" column in a file list.
Definition at line 880 of file asmirasdk.h.
| 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.
Definition at line 886 of file asmirasdk.h.
| 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).
Triggered by room_file_download.
Definition at line 891 of file asmirasdk.h.
| 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.
A download ends with either RoomFileDownloadedFunc or RoomFileErrorFunc, an upload with RoomFileSentFunc.
Definition at line 897 of file asmirasdk.h.
| 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.
Definition at line 904 of file asmirasdk.h.
| 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.
Definition at line 908 of file asmirasdk.h.
Room file transfer direction.
| Enumerator | |
|---|---|
| RoomFileDirectionUndef | Undefined |
| RoomFileDirectionSend | Upload, started with RoomFileSend/RoomFileSendFromPath |
| RoomFileDirectionReceive | Download, started with RoomFileDownload |
Definition at line 273 of file asmirasdk.h.
| enum asdk::RoomFileError |
Room file transfer failure reason.
Definition at line 283 of file asmirasdk.h.
|
inline |
Uploads a file to a room from memory.
The whole file is held in memory until it has been queued, prefer RoomFileSendFromPath for anything large. The server hashes the content, stores it and announces it to the other room members, which then choose to download it. Requires a joined room and DeviceCapabilityFileTransfer on the connection. Progress arrives on RoomFileProgressFunc, completion on RoomFileSentFunc.
| roomID | Room ID to share the file in. |
| fileName | File name shown to the other members. |
| data | File content. |
| size | File content size in bytes. |
Definition at line 1240 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Uploads a file to a room from disk.
Same as RoomFileSend but the content is hashed and streamed straight from disk, so the file is never held in memory in full. The name shown to the other members is taken from the path. The file has to stay in place and unchanged until the upload completes.
| roomID | Room ID to share the file in. |
| filePath | Path to the local file. |
Definition at line 1260 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Resumes an interrupted upload of a file from disk.
Completion arrives on RoomFileSentFunc, progress on RoomFileProgressFunc, as for a normal upload. Requires a joined room and DeviceCapabilityFileTransfer.
| roomID | Room ID to share the file in. |
| filePath | Path to the local file, unchanged since the interrupted upload. |
Definition at line 1277 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Downloads a room file announced by RoomFileAvailableFunc.
Identify the file by the (roomID, hash) pair from that callback. The content is buffered in memory and handed over by RoomFileDownloadedFunc once every byte arrived and the hash verified, so keep the announced file size in mind. Progress arrives on RoomFileProgressFunc, failures on RoomFileErrorFunc.
| roomID | Room ID from RoomFileAvailableFunc. |
| hash | File hash from RoomFileAvailableFunc. |
Definition at line 1296 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Resumes a room file download the caller already has part of.
Like RoomFileDownload, but the caller supplies the leading bytes it already holds (for example a partial file persisted from an interrupted download). The server streams only the remaining bytes from haveCount onward; the SDK prepends the supplied bytes, so the completed file is still delivered whole and hash verified through RoomFileDownloadedFunc. The bytes must be the exact prefix that was announced, or the transfer fails the hash check (RoomFileErrorHashMismatch). Pass a haveCount of zero to download from the start (identical to RoomFileDownload).
| roomID | Room ID from RoomFileAvailableFunc. |
| hash | File hash from RoomFileAvailableFunc. |
| fileName | File name, as announced (used for the completion and progress callbacks). |
| totalSize | Total file size, as announced (used for progress reporting). |
| haveBytes | Bytes already held, the exact leading portion of the file. |
| haveCount | Number of bytes already held. |
Definition at line 1322 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Cancels a room file transfer in either direction.
The server stops streaming and anything already received is discarded. No RoomFileErrorFunc follows a cancel that was requested here.
| roomID | Room ID of the transfer. |
| hash | File hash of the transfer. |
Definition at line 1342 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Deletes a shared room file for the whole room.
StatusOK means the request was sent, success shows up as RoomFileDeletedFunc.
| roomID | Room ID from RoomFileAvailableFunc. |
| hash | File hash from RoomFileAvailableFunc. |
Definition at line 1358 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Room File Available callback.
A file was shared in the room, pass its (roomID, hash) to RoomFileDownload to get it.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1567 of file asmirasdk.h.
|
inline |
Room File Deleted callback.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1579 of file asmirasdk.h.
|
inline |
Room File Downloaded callback.
A download finished and hash verified, the data is valid for the duration of the call.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1593 of file asmirasdk.h.
|
inline |
Room File Progress callback.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1605 of file asmirasdk.h.
|
inline |
Room File Sent callback.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1617 of file asmirasdk.h.
|
inline |
Room File Error callback.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1629 of file asmirasdk.h.