merge changes from the 0.1 preparatio branch
[totalopenstation.git] / models / leica_tcr_1205.py
blob175e5bfbe9f7ef7efd857ddd2895adf22e31e9c7
1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # filename: leica_tcr_1205.py
4 # Copyright 2008 Luca Bianconi <luxetluc@yahoo.it>
5 # Copyright 2008 Stefano Costa <steko@iosa.it>
6 # Under the GNU GPL 3 License
8 from generic import *
11 class ModelConnector(Connector):
12 def __init__(self, port):
13 Connector.__init__(self, port=port, baudrate=19200)
16 class ModelParser(Parser):
18 def is_point(self,line):
20 tokens = line.split()
22 try:
23 float(tokens[1])
24 float(tokens[2])
25 float(tokens[3])
26 except (ValueError, IndexError):
27 is_point = False
28 else:
29 #di questo controllo che segue FORSE non gliene frega un beliscimu
30 if tokens[4]=="MEAS":
31 is_point = True
32 else:
33 is_point = False
35 return is_point
37 def get_point(self,line):
39 tokens = line.split()
41 if len(tokens)> 5:
42 text = str(tokens[5])
43 else:
44 text = ""
46 p = Point(str(tokens[0]), float(tokens[1]), float(tokens[2]), float(tokens[3]), text)
47 return p