Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-update-modules.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <stdint.h>
22 
23 #include "sol-update.h"
24 
25 #include "sol-macros.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
47 typedef struct sol_update {
48 #ifndef SOL_NO_API_VERSION
49 #define SOL_UPDATE_API_VERSION (1)
50  uint16_t api_version;
51 #endif
52 
58  struct sol_update_handle * (*check)(
59  void (*cb)(void *data, int status, const struct sol_update_info *response),
60  const void *data);
61 
67  struct sol_update_handle * (*fetch)(
68  void (*cb)(void *data, int status),
69  const void *data, bool resume);
70 
76  bool (*cancel)(struct sol_update_handle *handle);
77 
83  int (*get_progress)(struct sol_update_handle *handle);
84 
90  struct sol_update_handle * (*install)(void (*cb)(void *data, int status),
91  const void *data);
92 
101  int (*init)(void);
102 
108  void (*shutdown)(void);
109 } sol_update;
110 
116 #ifdef SOL_UPDATE_MODULE_EXTERNAL
117 #define SOL_UPDATE_DECLARE(_NAME, decl ...) \
118  SOL_API const struct sol_update *SOL_UPDATE = \
119  &((const struct sol_update) { \
120  SOL_SET_API_VERSION(.api_version = SOL_UPDATE_API_VERSION, ) \
121  decl \
122  })
123 #else
124 #define SOL_UPDATE_DECLARE(_NAME, decl ...) \
125  SOL_API const struct sol_update SOL_UPDATE_ ## _NAME = { \
126  SOL_SET_API_VERSION(.api_version = SOL_UPDATE_API_VERSION, ) \
127  decl \
128  }
129 #endif
130 
134 #ifdef __cplusplus
135 }
136 #endif
void(* shutdown)(void)
Function called when module is unloaded.
Definition: sol-update-modules.h:108
struct sol_update sol_update
Structure containing function that need to be implemented by Soletta update modules.
Contains update info got via sol_update_check call.
Definition: sol-update.h:70
int(* get_progress)(struct sol_update_handle *handle)
Get update task progress.
Definition: sol-update-modules.h:83
bool(* cancel)(struct sol_update_handle *handle)
Cancel ongoing update tasks.
Definition: sol-update-modules.h:76
These are common Soletta macros.
int(* init)(void)
Function called when module is loaded.
Definition: sol-update-modules.h:101
Structure containing function that need to be implemented by Soletta update modules.
Definition: sol-update-modules.h:47
struct sol_update_handle sol_update_handle
Handle returned by some sol_update* calls, so they can be cancelled appropriately.
Definition: sol-update.h:63
uint16_t api_version
API version.
Definition: sol-update-modules.h:50
Routines to update a Soletta app.