예제 #1
0
def main():
    parser = argparse.ArgumentParser(description='FIX Gateway')
    parser.add_argument('--debug',
                        action='store_true',
                        help='Run in debug mode')
    parser.add_argument(
        '--host',
        '-H',
        default='localhost',
        help="IP address or hostname of the FIX-Gateway Server")
    parser.add_argument(
        '--port',
        '-P',
        type=int,
        default=3490,
        help="Port number to use for FIX-Gateway Server connection")
    parser.add_argument('--prompt',
                        '-p',
                        default='FIX: ',
                        help="Command line prompt")
    parser.add_argument('--file',
                        '-f',
                        nargs=1,
                        metavar='FILENAME',
                        help="Execute commands within file")
    parser.add_argument('--execute', '-x', nargs='+', help='Execute command')
    parser.add_argument('--interactive',
                        '-i',
                        action='store_true',
                        help='Keep running after commands are executed')
    args, unknown_args = parser.parse_known_args()
    log = logging.getLogger()
    if args.debug:
        log.level = logging.DEBUG

    c = netfix.Client(args.host, args.port)
    c.connect()

    cmd = Command(c)
    # If commands are beign redirected or piped we set the prompt to nothing
    if sys.stdin.isatty():
        cmd.prompt = args.prompt
    else:
        cmd.prompt = ""
    if args.execute:
        s = " ".join(args.execute)
        cmd.onecmd(s)
        if not args.interactive:
            exit(0)
    cmd.cmdloop()

    c.disconnect()
예제 #2
0
    def test_connect(self):

        c = netfix.Client('127.0.0.1', 3490)
        c.connect()

        t = np.arange(0, 5, .01)
        p = 10 * np.sin(2 * np.pi / 5 * t)
        t0 = time.time()
        n = 0
        while True:
            while t[n] > (time.time() - t0):
                time.sleep(.003)
            c.writeValue("PITCH", p[n])
            n += 1
            if n == len(p):
                break
예제 #3
0
 def __init__(self, playback_speed=1.0):
     self.client = netfix.Client('127.0.0.1', 3490)
     self.client.connect()
     self.t0 = time.time()
     self.playback_speed = playback_speed
     self.t0stream = None
예제 #4
0
import socket
import struct
import fixgw.netfix as netfix
import math
from gdl90 import decodeGDL90

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', 4000))

netfix_client = netfix.Client('127.0.0.1', 3490)
netfix_client.connect()

while True:
    msg, adr = s.recvfrom(8192)
    msg = decodeGDL90(msg)

    if len(msg) < 1:
        continue

    if msg[0] == 0x4c:
        roll = struct.unpack('>h', msg[4:6])[0] / 10.0
        pitch = struct.unpack('>h', msg[6:8])[0] / 10.0
        heading = struct.unpack('>h', msg[8:10])[0] / 10.0
        slipskid = struct.unpack('>h', msg[10:12])[0] / 10.0
        yawrate = struct.unpack('>h', msg[12:14])[0] / 10.0
        g = struct.unpack('>h', msg[14:16])[0] / 10.0
        ias = struct.unpack('>h', msg[16:18])[0] / 10.0
        alt = struct.unpack('>h', msg[18:20])[0] - 5000.5
        vs = struct.unpack('>h', msg[20:22])[0]

        netfix_client.writeValue("PITCH", pitch)
예제 #5
0
 def __init__(self):
     self.client = netfix.Client('127.0.0.1', 3490)
     self.client.connect()