ich versuche heute krampfhaft mit Hilfe von ctypes libnodave anzusprechen (der code ist auch online einsehbar, allerdings in einer älteren Version). Meine Vorkenntnisse im Umgang mit ctypes waren bis Gestern gleich null, und ich brauche mal ein paar Tipps.
Das ganze mache ich im Moment unter Ubuntu und Python 2.6
zuerst mal was ich bisher gemacht habe:
Code: Alles auswählen
import ctypes
import os
DLL_LOC = os.path.join('libnodave', 'libnodave.so')
class _daveOSserialType(ctypes.Structure):
_fields_ = [("rfd", ctypes.c_int),
("wfd", ctypes.c_int)]
def main():
dave = ctypes.cdll.LoadLibrary(DLL_LOC)
fds = _daveOSserialType()
fds.rfd = dave.setPort(ctypes.c_char_p('/dev/ttyUSB0'),
ctypes.c_char_p('9600'),
ctypes.c_char('e'))
di = dave.daveNewInterface(fds, ctypes.c_char_p('IF1'), 0, 20, 0)
if __name__ == '__main__':
main()