Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_uc_source_http_extra.h Source File

arm_uc_source_http_extra.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #ifndef __UPDATE_CLIENT_SOURCE_HTTP_EXTRA_H__
00020 #define __UPDATE_CLIENT_SOURCE_HTTP_EXTRA_H__
00021 
00022 #include "update-client-common/arm_uc_common.h"
00023 
00024 #include <stdint.h>
00025 
00026 /**
00027  * @brief Set URI location for the default manifest.
00028  * @details The default manifest is polled regularly and generates a
00029  *          notification upon change. The URI struct and the content pointer to
00030  *          must be valid throughout the lifetime of the application.
00031  *
00032  * @param uri URI struct with manifest location.
00033  * @return Error code.
00034  */
00035 arm_uc_error_t ARM_UCS_SetDefaultManifestURL(arm_uc_uri_t* uri);
00036 
00037 /**
00038  * @brief Set polling interval for notification generation.
00039  * @details The default manifest location is polled with this interval.
00040  *
00041  * @param seconds Seconds between each poll.
00042  * @return Error code.
00043  */
00044 arm_uc_error_t ARM_UCS_SetPollingInterval(uint32_t seconds);
00045 
00046 /**
00047  * @brief Main function for the Source.
00048  * @details This function will query the default manifest location and generate
00049  *          a notification if it has changed since the last time it was checked.
00050  *          The number of queries generated is bound by the polling interval.
00051  *
00052  *          This function should be used on systems with timed callbacks.
00053  *
00054  * @param buffer arm_uc_buffer_t for storing HTTP header during hash check.
00055  * @return Seconds until the next polling interval.
00056  */
00057 uint32_t ARM_UCS_CallMultipleTimes(arm_uc_buffer_t* buffer);
00058 
00059 
00060 typedef struct _ARM_UCS_HTTPLinuxExtra_t
00061 {
00062     arm_uc_error_t (*SetDefaultManifestURL)(arm_uc_uri_t* uri);
00063     arm_uc_error_t (*SetPollingInterval)(uint32_t seconds);
00064     uint32_t (*CallMultipleTimes)(arm_uc_buffer_t* buffer);
00065 } ARM_UCS_HTTPSourceExtra_t;
00066 
00067 extern ARM_UCS_HTTPSourceExtra_t ARM_UCS_HTTPSourceExtra;
00068 
00069 #endif // __UPDATE_CLIENT_SOURCE_HTTP_EXTRA_H__