]>
git.zerfleddert.de Git - hmcfgusb/blob - hm.h
1 /* HomeMatic defines and functions
3 * Copyright (c) 2014-16 Michael Gernoth <michael@gernoth.net>
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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
30 #define SRC(buf) (buf[0x06] | (buf[0x05] << 8) | (buf[0x04]) << 16)
31 #define DST(buf) (buf[0x09] | (buf[0x08] << 8) | (buf[0x07]) << 16)
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)
36 #define SET_LEN_FROM_PAYLOADLEN(buf, payloadlen) do { buf[0x00] = payloadlen + 0x09; } while(0)
37 #define PAYLOADLEN(buf) (buf[0x00] - 0x09)
42 DEVICE_TYPE_HMUARTLGW
,
47 struct hmcfgusb_dev
*hmcfgusb
;
48 struct culfw_dev
*culfw
;
49 struct hmuartlgw_dev
*hmuartlgw
;
52 uint8_t* hm_sign(uint8_t *key
, uint8_t *challenge
, uint8_t *m_frame
, uint8_t *exp_auth
, uint8_t *resp
);