Skip to content

Commit 52abc71

Browse files
committed
API: Update osdp.hpp to be in sync with osdp.h
Related-to: #291 Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
1 parent 77ca576 commit 52abc71

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

include/osdp.hpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ class OSDP_EXPORT ControlPanel : public Common {
8282
}
8383
}
8484

85+
void teardown()
86+
{
87+
if (_ctx) {
88+
osdp_cp_teardown(_ctx);
89+
_ctx = nullptr;
90+
}
91+
}
92+
8593
bool setup(const struct osdp_channel *channel, int num_pd, osdp_pd_info_t *info)
8694
{
8795
_ctx = osdp_cp_setup(channel, num_pd, info);
@@ -114,6 +122,11 @@ class OSDP_EXPORT ControlPanel : public Common {
114122
return osdp_cp_submit_command(_ctx, pd, cmd);
115123
}
116124

125+
int flush_commands(int pd)
126+
{
127+
return osdp_cp_flush_commands(_ctx, pd);
128+
}
129+
117130
void set_event_callback(cp_event_callback_t cb, void *arg)
118131
{
119132
osdp_cp_set_event_callback(_ctx, cb, arg);
@@ -135,6 +148,26 @@ class OSDP_EXPORT ControlPanel : public Common {
135148
return osdp_cp_get_capability(_ctx, pd, cap);
136149
}
137150

151+
int modify_flag(int pd, uint32_t flags, bool do_set)
152+
{
153+
return osdp_cp_modify_flag(_ctx, pd, flags, do_set);
154+
}
155+
156+
int disable_pd(int pd)
157+
{
158+
return osdp_cp_disable_pd(_ctx, pd);
159+
}
160+
161+
int enable_pd(int pd)
162+
{
163+
return osdp_cp_enable_pd(_ctx, pd);
164+
}
165+
166+
bool is_pd_enabled(int pd)
167+
{
168+
return osdp_cp_is_pd_enabled(_ctx, pd);
169+
}
170+
138171
};
139172

140173
class OSDP_EXPORT PeripheralDevice : public Common {
@@ -148,6 +181,14 @@ class OSDP_EXPORT PeripheralDevice : public Common {
148181
}
149182
}
150183

184+
void teardown()
185+
{
186+
if (_ctx) {
187+
osdp_pd_teardown(_ctx);
188+
_ctx = nullptr;
189+
}
190+
}
191+
151192
bool setup(struct osdp_channel *channel, osdp_pd_info_t *info)
152193
{
153194
_ctx = osdp_pd_setup(channel, info);
@@ -159,6 +200,11 @@ class OSDP_EXPORT PeripheralDevice : public Common {
159200
osdp_pd_refresh(_ctx);
160201
}
161202

203+
void set_capabilities(const struct osdp_pd_cap *cap)
204+
{
205+
osdp_pd_set_capabilities(_ctx, cap);
206+
}
207+
162208
void set_command_callback(pd_command_callback_t cb, void* args)
163209
{
164210
osdp_pd_set_command_callback(_ctx, cb, args);

0 commit comments

Comments
 (0)