mesh_access.c (2d4000d1850724e5e3baecd65f36d42e5d35f76f) mesh_access.c (e6a669a7e6dd4b9e292a6d2e49b0c3224f2cc99c)
1/*
2 * Copyright (C) 2019 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 104 unchanged lines hidden (view full) ---

113 return 3;
114}
115
116uint32_t mesh_access_acknowledged_message_timeout_ms(void){
117 return 30000;
118}
119
120#define MESH_ACCESS_OPCODE_INVALID 0xFFFFFFFFu
1/*
2 * Copyright (C) 2019 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 104 unchanged lines hidden (view full) ---

113 return 3;
114}
115
116uint32_t mesh_access_acknowledged_message_timeout_ms(void){
117 return 30000;
118}
119
120#define MESH_ACCESS_OPCODE_INVALID 0xFFFFFFFFu
121#define MESH_ACCESS_OPCODE_NOT_SET 0xFFFFFFFEu
121
122void mesh_access_send_unacknowledged_pdu(mesh_pdu_t * pdu){
122
123void mesh_access_send_unacknowledged_pdu(mesh_pdu_t * pdu){
123 pdu->ack_opcode = MESH_ACCESS_OPCODE_INVALID;;
124 pdu->ack_opcode = MESH_ACCESS_OPCODE_INVALID;
124 mesh_upper_transport_send_access_pdu(pdu);
125}
126
127void mesh_access_send_acknowledged_pdu(mesh_pdu_t * pdu, uint8_t retransmissions, uint32_t ack_opcode){
128 pdu->retransmit_count = retransmissions;
129 pdu->ack_opcode = ack_opcode;
130
131 mesh_upper_transport_send_access_pdu(pdu);

--- 481 unchanged lines hidden (view full) ---

613 return 3;
614}
615
616mesh_transport_pdu_t * mesh_access_transport_init(uint32_t opcode){
617 mesh_transport_pdu_t * pdu = mesh_transport_pdu_get();
618 if (!pdu) return NULL;
619
620 pdu->len = mesh_access_setup_opcode(pdu->data, opcode);
125 mesh_upper_transport_send_access_pdu(pdu);
126}
127
128void mesh_access_send_acknowledged_pdu(mesh_pdu_t * pdu, uint8_t retransmissions, uint32_t ack_opcode){
129 pdu->retransmit_count = retransmissions;
130 pdu->ack_opcode = ack_opcode;
131
132 mesh_upper_transport_send_access_pdu(pdu);

--- 481 unchanged lines hidden (view full) ---

614 return 3;
615}
616
617mesh_transport_pdu_t * mesh_access_transport_init(uint32_t opcode){
618 mesh_transport_pdu_t * pdu = mesh_transport_pdu_get();
619 if (!pdu) return NULL;
620
621 pdu->len = mesh_access_setup_opcode(pdu->data, opcode);
622 pdu->pdu_header.ack_opcode = MESH_ACCESS_OPCODE_NOT_SET;
621 return pdu;
622}
623
624void mesh_access_transport_add_uint8(mesh_transport_pdu_t * pdu, uint8_t value){
625 pdu->data[pdu->len++] = value;
626}
627
628void mesh_access_transport_add_uint16(mesh_transport_pdu_t * pdu, uint16_t value){

--- 18 unchanged lines hidden (view full) ---

647 }
648}
649
650mesh_network_pdu_t * mesh_access_network_init(uint32_t opcode){
651 mesh_network_pdu_t * pdu = mesh_network_pdu_get();
652 if (!pdu) return NULL;
653
654 pdu->len = mesh_access_setup_opcode(&pdu->data[10], opcode) + 10;
623 return pdu;
624}
625
626void mesh_access_transport_add_uint8(mesh_transport_pdu_t * pdu, uint8_t value){
627 pdu->data[pdu->len++] = value;
628}
629
630void mesh_access_transport_add_uint16(mesh_transport_pdu_t * pdu, uint16_t value){

--- 18 unchanged lines hidden (view full) ---

649 }
650}
651
652mesh_network_pdu_t * mesh_access_network_init(uint32_t opcode){
653 mesh_network_pdu_t * pdu = mesh_network_pdu_get();
654 if (!pdu) return NULL;
655
656 pdu->len = mesh_access_setup_opcode(&pdu->data[10], opcode) + 10;
657 pdu->pdu_header.ack_opcode = MESH_ACCESS_OPCODE_NOT_SET;
655 return pdu;
656}
657
658void mesh_access_network_add_uint8(mesh_network_pdu_t * pdu, uint8_t value){
659 pdu->data[pdu->len++] = value;
660}
661
662void mesh_access_network_add_uint16(mesh_network_pdu_t * pdu, uint16_t value){

--- 461 unchanged lines hidden ---
658 return pdu;
659}
660
661void mesh_access_network_add_uint8(mesh_network_pdu_t * pdu, uint8_t value){
662 pdu->data[pdu->len++] = value;
663}
664
665void mesh_access_network_add_uint16(mesh_network_pdu_t * pdu, uint16_t value){

--- 461 unchanged lines hidden ---