X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/blobdiff_plain/25870f587b45735699cc4479034cb864116b2f22..915b783358b0f140fe44d0aeb4295a071f4e0054:/hm.h diff --git a/hm.h b/hm.h index d0d7147..f80c58e 100644 --- a/hm.h +++ b/hm.h @@ -1,6 +1,6 @@ -/* HomeMatic defines +/* HomeMatic defines and functions * - * Copyright (c) 2014 Michael Gernoth + * Copyright (c) 2014-16 Michael Gernoth * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -34,3 +34,19 @@ #define SET_DST(buf, dst) do { buf[0x07] = (dst >> 16) & 0xff; buf[0x08] = (dst >> 8) & 0xff; buf[0x09] = dst & 0xff; } while(0) #define SET_LEN_FROM_PAYLOADLEN(buf, payloadlen) do { buf[0x00] = payloadlen + 0x09; } while(0) +#define PAYLOADLEN(buf) (buf[0x00] - 0x09) + +enum device_type { + DEVICE_TYPE_HMCFGUSB, + DEVICE_TYPE_CULFW, + DEVICE_TYPE_HMUARTLGW, +}; + +struct hm_dev { + int type; + struct hmcfgusb_dev *hmcfgusb; + struct culfw_dev *culfw; + struct hmuartlgw_dev *hmuartlgw; +}; + +uint8_t* hm_sign(uint8_t *key, uint8_t *challenge, uint8_t *m_frame, uint8_t *exp_auth, uint8_t *resp);