aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/write-service.example.c
diff options
context:
space:
mode:
Diffstat (limited to 'docs/write-service.example.c')
-rw-r--r--docs/write-service.example.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/write-service.example.c b/docs/write-service.example.c
new file mode 100644
index 0000000..45283e1
--- /dev/null
+++ b/docs/write-service.example.c
@@ -0,0 +1,25 @@
+#include <libsparklepaw/service.h>
+
+void main() {
+ struct sprkl_tagval_pair pair = {
+ .tag = { .upper = 0xFFFFFFFFFFFFFFFF, .lower = 0 },
+ .valuesz = 8,
+ .value = "hello!!!"
+ };
+ struct sprkl_record record = {
+ .paircnt = 1,
+ .pairs = &pair
+ };
+ uint8_t signature[4] = { 0x12, 0x34, 0x56, 0x78 };
+ struct sprkl_service service = {
+ .sigsz = sizeof(signature),
+ .signature = signature,
+ .index = 0x6969,
+ .flags = 0,
+ .reccnt = 1,
+ .records = &record
+ };
+
+ int n = sprkl_service_write(&service, stdout);
+ fprintf(stderr, "\nWrote %d bytes\n", n);
+}