]> git.zerfleddert.de Git - hmcfgusb/blob - hm.h
Release version 0.100
[hmcfgusb] / hm.h
1 /* HomeMatic defines
2 *
3 * Copyright (c) 2014 Michael Gernoth <michael@gernoth.net>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #define LEN 0x00
25 #define MSGID 0x01
26 #define CTL 0x02
27 #define TYPE 0x03
28 #define PAYLOAD 0x0a
29
30 #define SRC(buf) (buf[0x06] | (buf[0x05] << 8) | (buf[0x04]) << 16)
31 #define DST(buf) (buf[0x09] | (buf[0x08] << 8) | (buf[0x07]) << 16)
32
33 #define SET_SRC(buf, src) do { buf[0x04] = (src >> 16) & 0xff; buf[0x05] = (src >> 8) & 0xff; buf[0x06] = src & 0xff; } while(0)
34 #define SET_DST(buf, dst) do { buf[0x07] = (dst >> 16) & 0xff; buf[0x08] = (dst >> 8) & 0xff; buf[0x09] = dst & 0xff; } while(0)
35
36 #define SET_LEN_FROM_PAYLOADLEN(buf, payloadlen) do { buf[0x00] = payloadlen + 0x09; } while(0)
Impressum, Datenschutz