Skip to content

A library which provides support for setting the time and deployment ID of an AudioMoth using an acoustic tone.

License

Notifications You must be signed in to change notification settings

hwinter/AudioMoth-Chime

 
 

Repository files navigation

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", function () {

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

		var date = new Date();

		audioMothChimeConnector.playTime(function () {

			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.

About

A library which provides support for setting the time and deployment ID of an AudioMoth using an acoustic tone.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 37.8%
  • Kotlin 36.8%
  • JavaScript 25.4%