Skip to content

Commit 3d44e56

Browse files
authored
Bugfix cp ini fails (#6)
cp_ini failure bugfix
1 parent 9126e3c commit 3d44e56

4 files changed

Lines changed: 55 additions & 16 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ EOF bugin discover gc iam mstpstat rtn whois
9090
buggers bugout exit help mstpdbg read shell write
9191
```
9292

93+
(5) Apart from the bacnet client (bc) program, the other available programs from the misty package are the following. All of them use ini file supplied on the command line.
94+
95+
bs (bacnet server), WhoIsIAm, ReadWriteProperty, ReadPropertyMultipleServer, ReadPropertyMultiple, ReadProperty, CommandableMixin
96+
97+
9398
# Installation and Usage for Developers
9499

95100
This section talks about the installation for people who are interested in learning about misty and experiment with changes. This requires knowledge of Python Programming language and familiarity with Linux operating system as a user.

misty/samples/WhoIsIAm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def do_whois(self, args):
117117
if _debug: WhoIsIAmConsoleCmd._debug(" - iocb: %r", iocb)
118118

119119
# give it to the application
120-
this_application.request_io(iocb)
120+
this_application.request(request)
121121

122122
except Exception as err:
123123
WhoIsIAmConsoleCmd._exception("exception: %r", err)
@@ -144,7 +144,7 @@ def do_iam(self, args):
144144
if _debug: WhoIsIAmConsoleCmd._debug(" - iocb: %r", iocb)
145145

146146
# give it to the application
147-
this_application.request_io(iocb)
147+
this_application.request(request)
148148

149149
except Exception as err:
150150
WhoIsIAmConsoleCmd._exception("exception: %r", err)

misty/tools/cp_ini.py

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,42 @@
22

33
import sys
44
import os
5-
import shutil
65
import argparse
76

7+
bac_client_ini = """[BACpypes]
8+
objectName: BACClient
9+
address: 25
10+
interface:/var/tmp/ttyp0
11+
max_masters: 127
12+
baudrate: 38400
13+
maxinfo:1
14+
objectIdentifier: 599
15+
maxApduLengthAccepted: 1024
16+
segmentationSupported: segmentedBoth
17+
vendorIdentifier: 15
18+
foreignPort: 0
19+
foreignBBMD: 128.253.109.254
20+
foreignTTL: 30
21+
; enable this to see the mstp debug logs
22+
; mstpdbgfile:/home/riptide/abcd.log
23+
"""
24+
25+
bac_server_ini="""[BACpypes]
26+
objectName: BACServer
27+
address: 30
28+
interface:/var/tmp/ptyp0
29+
max_masters: 127
30+
baudrate: 38400
31+
maxinfo:1
32+
objectIdentifier: 699
33+
maxApduLengthAccepted: 1024
34+
segmentationSupported: segmentedBoth
35+
vendorIdentifier: 15
36+
foreignPort: 0
37+
foreignBBMD: 128.253.109.254
38+
foreignTTL: 30
39+
"""
40+
841

942
def handle_args():
1043
parser = argparse.ArgumentParser()
@@ -20,6 +53,17 @@ def handle_args():
2053

2154
return args.type, args.path
2255

56+
def write_file(fname, ini_type):
57+
with open(fname, "w") as fd:
58+
if ini_type == "server":
59+
content = bac_server_ini
60+
else:
61+
content = bac_client_ini
62+
63+
fd.write(content)
64+
65+
66+
2367

2468
def main():
2569

@@ -33,12 +77,11 @@ def main():
3377
dest = os.path.abspath(dest)
3478
fname = fname_dict[ini_type]
3579

36-
ini_file = os.path.join(sys.prefix, 'cfg', fname)
37-
shutil.copy(ini_file, dest)
38-
3980
if os.path.isdir(dest):
4081
dest = os.path.join(dest, fname)
4182

83+
write_file(dest, ini_type)
84+
4285
print("copied the ini file to '{}' ".format(dest))
4386

4487

setup.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def setup_packages():
3333

3434
meta_data = dict(
3535
name="misty",
36-
version='0.0.10',
36+
version='0.0.11',
3737
description='MSTP support for bacpypes',
3838
scripts=[
3939
'bin/CommandableMixin',
@@ -64,15 +64,6 @@ def setup_packages():
6464
]
6565
},
6666
packages=['misty', 'misty.mstplib'],
67-
data_files=[
68-
(
69-
(os.path.join(sys.prefix, 'cfg')),
70-
[
71-
'misty/samples/bac_server.ini',
72-
'misty/samples/bac_client.ini'
73-
]
74-
)
75-
],
7667
ext_modules=EmptyListWithLength(),
7768
install_requires=[
7869
"bacpypes>=0.18.0",

0 commit comments

Comments
 (0)