xref: /btstack/src/classic/obex_srm_client.h (revision 5fe900187d6325880f9c42e3d83d3ccf899c0906)
1*5fe90018SMatthias Ringwald /*
2*5fe90018SMatthias Ringwald  * Copyright (C) 2024 BlueKitchen GmbH
3*5fe90018SMatthias Ringwald  *
4*5fe90018SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*5fe90018SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*5fe90018SMatthias Ringwald  * are met:
7*5fe90018SMatthias Ringwald  *
8*5fe90018SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*5fe90018SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*5fe90018SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*5fe90018SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*5fe90018SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*5fe90018SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*5fe90018SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*5fe90018SMatthias Ringwald  *    from this software without specific prior written permission.
16*5fe90018SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*5fe90018SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*5fe90018SMatthias Ringwald  *    monetary gain.
19*5fe90018SMatthias Ringwald  *
20*5fe90018SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*5fe90018SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*5fe90018SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*5fe90018SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*5fe90018SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*5fe90018SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*5fe90018SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*5fe90018SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*5fe90018SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*5fe90018SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*5fe90018SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*5fe90018SMatthias Ringwald  * SUCH DAMAGE.
32*5fe90018SMatthias Ringwald  *
33*5fe90018SMatthias Ringwald  * Please inquire about commercial licensing options at
34*5fe90018SMatthias Ringwald  * [email protected]
35*5fe90018SMatthias Ringwald  *
36*5fe90018SMatthias Ringwald  */
37*5fe90018SMatthias Ringwald 
38*5fe90018SMatthias Ringwald #ifndef OBEX_SRM_CLIENT_H
39*5fe90018SMatthias Ringwald #define OBEX_SRM_CLIENT_H
40*5fe90018SMatthias Ringwald 
41*5fe90018SMatthias Ringwald #include <stdint.h>
42*5fe90018SMatthias Ringwald 
43*5fe90018SMatthias Ringwald #if defined __cplusplus
44*5fe90018SMatthias Ringwald extern "C" {
45*5fe90018SMatthias Ringwald #endif
46*5fe90018SMatthias Ringwald 
47*5fe90018SMatthias Ringwald typedef enum {
48*5fe90018SMatthias Ringwald     OBEX_SRM_CLIENT_STATE_DISABLED,
49*5fe90018SMatthias Ringwald     OBEX_SRM_CLIENT_STATE_W4_CONFIRM,
50*5fe90018SMatthias Ringwald     OBEX_SRM_CLIENT_STATE_ENABLED_BUT_WAITING,
51*5fe90018SMatthias Ringwald     OBEX_SRM_CLIENT_STATE_ENABLED
52*5fe90018SMatthias Ringwald } obex_srm_client_state_t;
53*5fe90018SMatthias Ringwald 
54*5fe90018SMatthias Ringwald typedef struct {
55*5fe90018SMatthias Ringwald     obex_srm_client_state_t srm_state;
56*5fe90018SMatthias Ringwald 
57*5fe90018SMatthias Ringwald     uint8_t srm_value;
58*5fe90018SMatthias Ringwald     uint8_t srmp_value;
59*5fe90018SMatthias Ringwald } obex_srm_client_t;
60*5fe90018SMatthias Ringwald 
61*5fe90018SMatthias Ringwald /**
62*5fe90018SMatthias Ringwald  * Init SRM state
63*5fe90018SMatthias Ringwald  * @param obex_srm
64*5fe90018SMatthias Ringwald  */
65*5fe90018SMatthias Ringwald void obex_srm_client_init(obex_srm_client_t * obex_srm);
66*5fe90018SMatthias Ringwald 
67*5fe90018SMatthias Ringwald /**
68*5fe90018SMatthias Ringwald  * Update SRM state based on SRM headers
69*5fe90018SMatthias Ringwald  * @param obex_srm
70*5fe90018SMatthias Ringwald  */
71*5fe90018SMatthias Ringwald void obex_srm_client_handle_headers(obex_srm_client_t *obex_srm);
72*5fe90018SMatthias Ringwald 
73*5fe90018SMatthias Ringwald /**
74*5fe90018SMatthias Ringwald  * Add SRM headers if
75*5fe90018SMatthias Ringwald  * @param obex_srm
76*5fe90018SMatthias Ringwald  * @param goep_cid
77*5fe90018SMatthias Ringwald  */
78*5fe90018SMatthias Ringwald void obex_srm_client_prepare_header(obex_srm_client_t *obex_srm, uint16_t goep_cid);
79*5fe90018SMatthias Ringwald 
80*5fe90018SMatthias Ringwald #if defined __cplusplus
81*5fe90018SMatthias Ringwald }
82*5fe90018SMatthias Ringwald #endif
83*5fe90018SMatthias Ringwald 
84*5fe90018SMatthias Ringwald #endif
85