<commit_before>package main

import (
	"flag"
	"fmt"
	"log"
	"time"

	"../../goble"
)

func main() {
	verbose := flag.Bool("verbose", false, "dump all events")
	dups := flag.Bool("allow-duplicates", false, "allow duplicates when scanning")
	flag.Parse()

	ble := goble.New()
	ble.SetVerbose(*verbose)

	if *verbose {
		ble.On(goble.ALL, func(ev goble.Event) {
			log.Println("event", ev)
		})
	}

	ble.On("stateChange", func(ev goble.Event) {
		if ev.State == "poweredOn" {
			ble.StartScanning(nil, *dups)
		} else {
			ble.StopScanning()
		}
	})

	ble.On("discover", func(ev goble.Event) {
		fmt.Println("peripheral discovered (", ev.DeviceUUID, "):")
		fmt.Println("\thello my local name is:")
		fmt.Println("\t\t", ev.Peripheral.Advertisement.LocalName)
		fmt.Println("\tcan I interest you in any of the following advertised services:")
		fmt.Println("\t\t", ev.Peripheral.Services)

                serviceData := ev.Peripheral.Advertisement.ServiceData
                if len(serviceData) > 0 {
                    fmt.Println("\there is my service data:")
                    for _, d := range serviceData {
	                fmt.Println("\t\t", d.Uuid, ":", d.Data)
	            }
	        }
	})

	/*
	   if (peripheral.advertisement.manufacturerData) {
	     console.log('\there is my manufacturer data:');
	     console.log('\t\t' + JSON.stringify(peripheral.advertisement.manufacturerData.toString('hex')));
	   }
	   if (peripheral.advertisement.txPowerLevel !== undefined) {
	     console.log('\tmy TX power level is:');
	     console.log('\t\t' + peripheral.advertisement.txPowerLevel);
	   }

	   console.log();
	*/

	if *verbose {
		log.Println("Init...")
	}

	ble.Init()

	time.Sleep(60 * time.Second)
	log.Println("Goodbye!")
}<commit_msg>fixed display of advertised services<commit_after>package main

import (
	"flag"
	"fmt"
	"log"

	"../../goble"
)

func main() {
	verbose := flag.Bool("verbose", false, "dump all events")
	dups := flag.Bool("allow-duplicates", false, "allow duplicates when scanning")
	flag.Parse()

	ble := goble.New()
	ble.SetVerbose(*verbose)

	if *verbose {
		ble.On(goble.ALL, func(ev goble.Event) {
			log.Println("Event", ev)
		})
	}

	ble.On("stateChange", func(ev goble.Event) {
		if ev.State == "poweredOn" {
			ble.StartScanning(nil, *dups)
		} else {
			ble.StopScanning()
		}
	})

	ble.On("discover", func(ev goble.Event) {
		fmt.Println()
		fmt.Println("peripheral discovered (", ev.DeviceUUID, "):")
		fmt.Println("\thello my local name is:")
		fmt.Println("\t\t", ev.Peripheral.Advertisement.LocalName)
		fmt.Println("\tcan I interest you in any of the following advertised services:")
		fmt.Println("\t\t", ev.Peripheral.Advertisement.ServiceUuids)

		serviceData := ev.Peripheral.Advertisement.ServiceData
		if len(serviceData) > 0 {
			fmt.Println("\there is my service data:")
			for _, d := range serviceData {
				fmt.Println("\t\t", d.Uuid, ":", d.Data)
			}
		}

		if len(ev.Peripheral.Advertisement.ManufacturerData) > 0 {
			fmt.Println("\there is my manufacturer data:")
			fmt.Println("\t\t", ev.Peripheral.Advertisement.ManufacturerData)
		}

		if ev.Peripheral.Advertisement.TxPowerLevel != 0 {
			fmt.Println("\tmy TX power level is:")
			fmt.Println("\t\t", ev.Peripheral.Advertisement.TxPowerLevel)
		}
	})

	if *verbose {
		log.Println("Init...")
	}

	ble.Init()

	var done chan bool
	<-done
}
{'fraction_non_alphanumeric': 0.16909361069836554, 'fraction_numerical': 0.0017830609212481426, 'mean_word_length': 3.191780821917808, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5486944', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1170, 'n_words': 234}