Example #1
0
//export NewExportYAML
func NewExportYAML(descYAML *C.char, address *C.char) (e C.int) {
	fmt.Println(C.GoString(address))
	desc := servicedescriptor.FromYaml(C.GoString(descYAML))
	cfg := config.Default(C.GoString(address))
	//	cfg.Logger() = os.Stdout
	return C.int(newExport(desc, cfg))
}
Example #2
0
func (d *Daemon) clientService(data eventual2go.Data) {
	m := data.(NewService)
	d.logger.Printf("new service %v", m)
	defer func() {
		if r := recover(); r != nil {
			d.logger.Println("insane descriptor, aborting", r)
			return
		}
	}()
	desc := servicedescriptor.FromYaml(m.Descriptor)
	d.logger.Printf("tagset is %v", desc.AsTagSet())
	cfg := config.DebugLocalhost()
	cfg.NetworkInterfaces = m.Addresses
	a := service.NewAnnouncer(m.UUID, m.ServiceType, desc, cfg, m.Ports)
	client := d.clients[m.UUID]
	a.ServiceArrived().Listen(serviceArrived(client))
	a.ServiceGone().Listen(serviceGone(client))
	a.Run()
	d.announcer[m.UUID] = a
}
Example #3
0
func main() {
	cfg := config.DebugLocalhost()
	i := aursir4go.NewImport(servicedescriptor.FromYaml(HELLOKEY), cfg)
	i.Run()
	log.Println("started")
	i.Connected().WaitUntilComplete()
	log.Println("connected")
	time.Sleep(1 * time.Second)
	for {
		start := time.Now()
		r := i.Call("SayHello", requestParams{"Hello From AurSir4Go"})
		//		r := i.Call("SetPosition", pos{55.3})
		r.WaitUntilComplete()
		log.Println("retrieved")
		var res resultParams
		r.GetResult().(*messages.Result).Decode(&res)
		log.Println(res)
		log.Println((r.GetResult().(*messages.Result).Parameter()))
		log.Println(time.Since(start))
		return
	}
	c := make(chan interface{})
	<-c
}
var testDesc1 *servicedescriptor.ServiceDescriptor = servicedescriptor.FromYaml(`functions:
  - name: GetNrOfSamples
    output:
      - name: NrOfSamples
        type: int
  - name: SetNrOfSamples
    input:
      - name: NrOfSamples
        type: int
    output:
      - name: NrOfSamples
        type: int
  - name: Acquire
    output:
      - name: DataId
        type: int
  - name: AcquireDark
    output:
      - name: DataId
        type: int
  - name: GetRawData
    input:
      - name: DataId
        type: int
    output:
      - name: Data
        type: bin
      - name: NrOfDetectors
        type: int
      - name: NrOfPixels
        type: bin
  - name: GetData
    input:
      - name: DataId
        type: int
    output:
      - name: Data
        type: '[][][]int'
  - name: GetAvg
    input:
      - name: DataId
        type: int
    output:
      - name: Data
        type: '[][]float'
  - name: GetDeviation
    input:
      - name: DataId
        type: int
    output:
      - name: Data
        type: '[][]float'
  - name: GetDiode
    input:
      - name: DataId
        type: int
      - name: DiodeNr
        type: int
    output:
      - name: Data
        type: '[]int'
  - name: GetDiodes
    input:
      - name: DataId
        type: int
    output:
      - name: Data
        type: '[][]int'
`)