Skip to content

Latest commit

 

History

History
105 lines (61 loc) · 2.6 KB

README.md

File metadata and controls

105 lines (61 loc) · 2.6 KB

AudioMoth Chime

The AudioMoth-Chime library provide support to set the time and the 8-byte deployment ID of an AudioMoth using an acoustic tone. These will automatically work with version 1.5.0 of the AudioMoth-Firmware-Basic and later.

Android

The Kotlin Android library contains two classes that must be included in the app. They define AudioMothChime and AudioMothChimeConnector objects. The latter exposes three public functions:

	fun playTone(duration: Int)

	fun playTime(calendar: Calendar)
	
	fun playTimeAndDeploymentID(calendar: Calendar, deploymentID: Array<Int>)

Below is an example of their use:

	val chimeButton: Button = findViewById(R.id.chimeButton)

	val audioMothConnector = AudioMothChimeConnector()

	chimeButton.setOnClickListener{

		val calendar = Calendar.getInstance()

		Thread {

			audioMothConnector.playTime(calendar)

		}.start()

	}

Javascript

The Javascript library contains two classes that must be included in the webpage. They define the global AudioMothChime and AudioMothChimeConnector objects. The latter exposes three public functions:

	playTone(duration, callback);

	playTime(date, callback);
	
	playTimeAndDeploymentID(date, deploymentID, callback);

Below is an example of their use:

	var audioMothChimeConnector = new AudioMothChimeConnector();

	document.getElementById("chime_button").addEventListener("click", () => {

		document.getElementById("chime_button").disabled = true;

		var date = new Date();

		audioMothChimeConnector.playTime(date, () => {

			document.getElementById("chime_button").disabled = false;

		});

	});

iOS

The Swift iOS library contains two classes that must be included in the app. They define AudioMothChime and AudioMothChimeConnector objects. The latter exposes three public functions:

	func playTone(duration: Int)

	func playTime(date: Date, timezone: TimeZone)
	
	func playTimeAndDeploymentID(date: Date, timezone: TimeZone, deploymentID: Array<Int>)

Below is an example of their use:

	Button(action: {
		
		let date: Date = Date()
		
		let timezone: TimeZone = TimeZone.current
		
		audioMothChimeConnector.playTime(date: date, timezone: timezone)

	}) {
		Text("Play Chime")
	}

Related Repositories

License

Copyright 2019 Open Acoustic Devices.

MIT license.