compile_gatt.py (d7ec1d24bc1e3be5bf8c482d95765d3ecaaa7bda) | compile_gatt.py (fd1be25d180b83fa8818fbefe35e2873a2c6906e) |
---|---|
1#!/usr/bin/env python 2# 3# BLE GATT configuration generator for use with BTstack, v0.1 4# Copyright 2011 Matthias Ringwald 5# 6# Format of input file: 7# PRIMARY_SERVICE, SERVICE_UUID 8# CHARACTERISTIC, ATTRIBUTE_TYPE_UUID, [READ | WRITE | DYNAMIC], VALUE 9 10import codecs 11import csv 12import io 13import os 14import re 15import string 16import sys 17 18header = ''' 19// {0} generated from {1} for BTstack | 1#!/usr/bin/env python 2# 3# BLE GATT configuration generator for use with BTstack, v0.1 4# Copyright 2011 Matthias Ringwald 5# 6# Format of input file: 7# PRIMARY_SERVICE, SERVICE_UUID 8# CHARACTERISTIC, ATTRIBUTE_TYPE_UUID, [READ | WRITE | DYNAMIC], VALUE 9 10import codecs 11import csv 12import io 13import os 14import re 15import string 16import sys 17 18header = ''' 19// {0} generated from {1} for BTstack |
20// att db format version 1 |
|
20 | 21 |
21// binary representation 22// attribute size in bytes (16), flags(16), handle (16), uuid (16/128), value(...) | 22// binary attribute representation: 23// - size in bytes (16), flags(16), handle (16), uuid (16/128), value(...) |
23 24#include <stdint.h> 25 26const uint8_t profile_data[] = 27''' 28 29usage = ''' 30Usage: ./compile_gatt.py profile.gatt profile.h --- 789 unchanged lines hidden (view full) --- 820 print("WARNING: unknown token: %s\n" % (parts[0])) 821 822def parse(fname_in, fin, fname_out, fout): 823 global handle 824 global total_size 825 826 fout.write(header.format(fname_out, fname_in)) 827 fout.write('{\n') | 24 25#include <stdint.h> 26 27const uint8_t profile_data[] = 28''' 29 30usage = ''' 31Usage: ./compile_gatt.py profile.gatt profile.h --- 789 unchanged lines hidden (view full) --- 821 print("WARNING: unknown token: %s\n" % (parts[0])) 822 823def parse(fname_in, fin, fname_out, fout): 824 global handle 825 global total_size 826 827 fout.write(header.format(fname_out, fname_in)) 828 fout.write('{\n') |
828 | 829 write_indent(fout) 830 fout.write('// ATT DB Version\n') 831 write_indent(fout) 832 fout.write('1,\n') 833 fout.write("\n") 834 |
829 parseLines(fname_in, fin, fout) 830 831 serviceDefinitionComplete(fout) 832 write_indent(fout) 833 fout.write("// END\n"); 834 write_indent(fout) 835 write_16(fout,0) 836 fout.write("\n") --- 43 unchanged lines hidden --- | 835 parseLines(fname_in, fin, fout) 836 837 serviceDefinitionComplete(fout) 838 write_indent(fout) 839 fout.write("// END\n"); 840 write_indent(fout) 841 write_16(fout,0) 842 fout.write("\n") --- 43 unchanged lines hidden --- |