Skip to content

augmented-human-lab/itiles-package-unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

itiles-package-unity

Enables communication between unity and iTiles hardware units

Installation

  • Open unity package manger
  • Press + button then Add package from git url
  • Copy this git repo url there.

Setup

  • Drag & drop BLEController prefab from ITiles/Prefabs

Use

  • All Methods are internally TX commands sent to itile server (master tile).
  • All Events are internally RX messages received from itile server (master tile).
  • Master tile is responsible for communicating with paired standard tiles.
  • Method call example bleController_instance.Method(params)
  • Subscribe to events from Unity Start method bleController_instance.Event += EventHandler
  • Unsubscribe events from Unity OnDestroy method bleController_instance.Event -= EventHandler

Import ITiles

using ITiles;

Methods (TX Messages to iTile Server)

// to initiate itile server scan
// Subscribe to `MasterTilesDiscovered` event to receive discovered itile server ids (mac addresses)
void StartScan()
// to cancel itile server scan. 
// This method will be internlly called after connecting to a itile server
void StopScan()
// to connect with already discovered itile server
void Connect(string deviceAddress);
// to initiate standard tile paring
// once initiated touch on standard tiles to complete pair with master
void PairTiles(byte[] masterTileMacAddress)
// initiate unparing one or all standard tiles from master
void UnpairTile(SELECT_ITILE tileID)
// to clear the array of tile mac address and deregister tiles from ESPNOW
void ClearMacList()
// to receive list of paired tile Ids 
// Subscribe to `PairedITileListReceived` event to receive paired itile id list
void QueryPairedTiles()
// to command each online tile to reply with it's status including battary percentage
// Subscribe to `OnlineITileStatusReceived` event to receive status of given tile (default value is ALL)
void QueryOnlineTiles(SELECT_ITILE tileID = SELECT_ITILE.ALL)
void TriggerLight (
  TILE_COLOR color | SIDE_COLORS sideColors, 
  TIMEOUT_DELAY offAfterSeconds, 
  LOG_REACTION_TIME logReactionTime, 
  TIMEOUT_RESPONSE timeoutResponse, 
  SELECT_ITILE tileId
)
void TriggerSound (
  SOUND_TRACK soundTrackID,
  REPEAT_COUNT repeatCount,
  LOG_REACTION_TIME logReactionTime,
  TIMEOUT_RESPONSE timeoutResponse,
  SELECT_ITILE tileId
)
void TriggerVibration(
  VIBRATION_PATTERN vibrationPatternID,
  REPEAT_COUNT repeatCount,
  LOG_REACTION_TIME logReactionTime,
  TIMEOUT_RESPONSE timeoutResponse,
  SELECT_ITILE tileId
)
void TriggerLightSoundVibration(
  TILE_COLOR tileColor | SIDE_COLORS sideColor,
  TIMEOUT_DELAY timeoutDelay,
  SOUND_TRACK soundTrackId,
  VIBRATION_PATTERN vibrationPattern,
  REPEAT_COUNT repeatCount,
  LOG_REACTION_TIME logReactionTime,
  TIMEOUT_RESPONSE timeoutResponse,
  SELECT_ITILE tileId
)
void TurnOffLight(SELECT_ITILE tileId)
void ToggleTouchSensor(TOGGLE_SENSOR toggle, SELECT_ITILE tileId) 
void ToggleShakeSensor(TOGGLE_SENSOR toggle, SELECT_ITILE tileId) 
void SetShakeThreshold(byte accelerationThreshold, SELECT_ITILE tileId) 
void ConfirmAssignement(SELECT_ITILE tileId) 
void GameInProgress(GAME_STATUS gameStatus, SELECT_ITILE tileId)
void AssignFeedback(FEEDBACK_STATUS feedbackStatus, TILE_COLOR color, SOUND_TRACK soundTrackId, VIBRATION_PATTERN vibrationPattern, TIMEOUT_DELAY timeoutDelay, SELECT_ITILE tileId)
void GetBattery(SELECT_ITILE tileId)

Events - Basic (RX Messages from iTile Server)

// raw message received from a itile
DataReceived(string data)
// mac addresses of any visible iTile server (master tile)
MasterTilesDiscovered(List<string> discovered_itiles)
// notifies the status of ble connection with iTile server (master tile)
ConnectionStateChanged(CONNECTION_STATE connectionState)
// requested paired itile list is received
PairedITileListReceived(PAIRED_TILES_RESPONSE pairedTilesResponse)
// requested online itile details are received from each tile
OnlineITileStatusReceived(ONLINE_TILES_RESPONSE onlineTilesResponse)
// requested battary status is received from specified tile
BattaryStatusReceived(ONLINE_TILES_RESPONSE onlineTilesResponse)

Events - Interactions (RX Messages from iTile Server)

// notifies a itile has been touched
ITileTouched(TOUCH_RESPONSE touchResponse)
// notifies a itile has been shaked
ITileShaked(SHAKE_RESPONSE shakeResponse)
// notifies someone has step on or off a itile
ITileStepChanged(STEP_CHANGE_RESPONSE stepChangeResponse)
// notifies a itile has been timed out
ITileTimedOut()
// notifies a itile side is paired with another
ITileSidePaired(SIDE_PAIR_RESPONSE sidePairResponse)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages