def pre_hook(val):
    key_pmt = es.event_field( val.msg, key_sym );   
    key = pmt.pmt_symbol_to_string( key_pmt );
    print key;
    if(key == "*"):
        key = "10";
    elif(key == "#"):
        key = "12";
    elif(key=="0"):
        ival = 11;
    ival = int(key);
    
    row = (ival - 1)/3;
    col = (ival - 1)%3;
    rowfreqs = [697.0, 770.0, 852.0, 941.0];
    colfreqs = [1209.0, 1336.0, 1477.0, 1633.0];
    assert(row < len(rowfreqs));
    assert(col < len(colfreqs));

    blocks = val.handler.pb2();
    blocks["src_L"].set_frequency(rowfreqs[row]);
    blocks["src_R"].set_frequency(colfreqs[col]);
    print "set freq %s"%( str((rowfreqs[row], colfreqs[col])) );
    r = es.es_hook_rval();
    return r;
Example #2
0
def pre_hook(val):
    key_pmt = es.event_field( val.msg, key_sym );   
    key = pmt.symbol_to_string( key_pmt );
    print key;
    if(key == "*"):
        key = "10";
    elif(key == "#"):
        key = "12";
    elif(key=="0"):
        ival = 11;
    ival = int(key);
    
    row = (ival - 1)/3;
    col = (ival - 1)%3;
    rowfreqs = [697.0, 770.0, 852.0, 941.0];
    colfreqs = [1209.0, 1336.0, 1477.0, 1633.0];
    assert(row < len(rowfreqs));
    assert(col < len(colfreqs));

    blocks = val.handler.pb2();
    blocks["src_L"].set_frequency(rowfreqs[row]);
    blocks["src_R"].set_frequency(colfreqs[col]);
    print "set freq %s"%( str((rowfreqs[row], colfreqs[col])) );
    r = es.es_hook_rval();
    return r;
Example #3
0
def pre_hook(val):
    payload = es.event_field(val.msg, key_sym)
    payload = pmt.symbol_to_string(payload)
    v = numpy.fromstring(payload, dtype=numpy.byte)
    blocks = val.handler.pb2()
    blocks["src"].set_data(es.StrVector([payload]), len(v))
    r = es.es_hook_rval()
    return r
Example #4
0
def pre_hook(val):
    payload = es.event_field( val.msg, key_sym );   
    payload = pmt.symbol_to_string( payload );
    v = numpy.fromstring( payload, dtype=numpy.byte );
    blocks = val.handler.pb2();
    blocks["src"].set_data( es.StrVector([payload]), len(v) );
    r = es.es_hook_rval();
    return r;