Skip to main content
Version: 1.5.0

Methods

Instantiation

SdkAPI

Create a new Spire Linux Agent Client.

    #include "SdkAPI.h"

apiClient_t *client;

client = apiClient_create();

/* ... */

apiClient_free(client);

SendFile

Sends a file from the payload to the ground via the API.

    send_file_request_t *req;
send_options_t *send_opt;
send_file_response_t *resp;
ttl_params_t *ttl;

ttl = ttl_params_create(urgent, bulk, surplus);
send_opt = send_options_create(ttl, reliable);

req = send_file_request_create(dest, filename, topic, send_opt);

resp = SdkAPI_sendFile(client, req);
if (resp != NULL) {
fprintf(stderr, "resp uuid = %s", resp->uuid);
send_file_response_free(resp);
}

send_file_request_free(req);

Arguments

TypeDescription
SendFileRequestSendFileRequest Object

Return value

TypeDescription
SendFileResponseContains the UUID assigned for this file transfer

QueryAvailableFiles

Queries files that have been uplinked from the ground to the payload.

    char *topic = NULL;
apiClient_t *client;
available_files_response_t *resp;

topic = strdup(argv[1]);
client = apiClient_create();

resp = SdkAPI_queryAvailableFiles(client, topic);
if (resp != NULL) {
listEntry_t *item;
fprintf(stderr, "Available files:\n");
list_ForEach(item, resp->files) {
file_info_t *finfo = (file_info_t *)item->data;
fprintf(stderr, "%s: %s\n", finfo->id, finfo->path);
}
available_files_response_free(resp);
}

apiClient_free(client);

Arguments

TypeDescription
stringThe topic to check for available files.

Return value

TypeDescription
AvailableFilesResponseAvailableFilesResponse Object

RetrieveFile

Retrieve a file returned from QueryAvailableFiles

    char *filename = NULL, *id = NULL;
apiClient_t *client;
retrieve_file_request_t *req;
file_info_t *finfo;

if (argc != 3) {
usage(argv[0]);
}
id = strdup(argv[1]);
filename = strdup(argv[2]);

client = apiClient_create();

req = retrieve_file_request_create(id, filename);

finfo = SdkAPI_retrieveFile(client, req);
if (finfo != NULL) {
fprintf(stderr, "retrieved id = %s to %s",
req->id, finfo->path);
file_info_free(finfo);
}

retrieve_file_request_free(req);
apiClient_free(client);

Retrieve an available file from the Data Pipeline API.

Arguments

TypeDescription
RetrieveFileRequestRetrieveFileRequest Object

Return value

TypeDescription
FileInfoDetails about the file retrieved