int main(void)
{
    /* Create and initialise server session */
    AwaServerSession * session = AwaServerSession_New();

    /* Use default IPC configuration */
    AwaServerSession_Connect(session);

    /* Create WRITE operation */
    AwaServerWriteOperation * operation = AwaServerWriteOperation_New(session, AwaWriteMode_Update);

    /*
     * This example uses object /2 which is the Lwm2m ACL object.
     */

    /* Create a new object instance by specifying the object instance path */
    AwaServerWriteOperation_CreateObjectInstance(operation, "/2/10");
    AwaServerWriteOperation_Perform(operation, CLIENT_ID, OPERATION_PERFORM_TIMEOUT);

    /* Operations must be freed after use */
    AwaServerWriteOperation_Free(&operation);

    AwaServerSession_Disconnect(session);
    AwaServerSession_Free(&session);
    return 0;
}
int main(void)
{
    /* Create and initialise server session */
    AwaServerSession * session = AwaServerSession_New();

    /* Use default IPC configuration */
    AwaServerSession_Connect(session);

    /* Create WRITE operation */
    AwaServerWriteOperation * operation = AwaServerWriteOperation_New(session, AwaWriteMode_Update);

    /*
     * This example uses resource /3/0/15 which is the Timezone
     * resource in the standard Device object. It is a string.
     */

    /* Add the resource path and value to the WRITE operation */
    AwaServerWriteOperation_AddValueAsCString(operation, "/3/0/15", "Pacific/Auckland");
    AwaServerWriteOperation_Perform(operation, CLIENT_ID, OPERATION_PERFORM_TIMEOUT);

    /* Operations must be freed after use */
    AwaServerWriteOperation_Free(&operation);

    AwaServerSession_Disconnect(session);
    AwaServerSession_Free(&session);
    return 0;
}
static int ProcessWriteOperation(AwaServerWriteOperation * operation, const char * clientID)
{
    int result = 0;
    if (AwaServerWriteOperation_Perform(operation, clientID, OPERATION_PERFORM_TIMEOUT) != AwaError_Success)
    {
        Error("AwaServerWriteOperation_Perform failed\n");
        result = 1;
    }
    else
    {
        Verbose("Write operation completed successfully.\n");
    }

    const AwaServerWriteResponse * response = AwaServerWriteOperation_GetResponse(operation, clientID);
    if (response != NULL)
    {
        AwaPathIterator * iterator = AwaServerWriteResponse_NewPathIterator(response);
        while (AwaPathIterator_Next(iterator))
        {
            const char * path = AwaPathIterator_Get(iterator);
            const AwaPathResult * result = AwaServerWriteResponse_GetPathResult(response, path);
            AwaError error = AwaPathResult_GetError(result);
            if (error != AwaError_Success)
            {
                if (error != AwaError_LWM2MError)
                {
                    Error("Failed to write to path %s: %s\n", path, AwaError_ToString(error));
                }
                else
                {
                    Error("Failed to write to path %s: %s\n", path, AwaLWM2MError_ToString(AwaPathResult_GetLWM2MError(result)));
                }
            }
        }
        AwaPathIterator_Free(&iterator);
    }
    return result;
}