Is there a working example of exchanging data using datamaps?
I'm trying to get a simple test working, and have so far got a datamap on the phone added to the Wear network, and detected as changed on the watch.
But when I try to get the changed datamap on the watch (using the DataChanged event), it comes back as null. Not a surprise, because there are a few things I don't quite understand yet, like what the Tag parameter is used for.
It's made harder by not having a real debug system on the watch. (I am debugging using the Bridge for the phone, but on the watch side I'm just using occasional toast messages.) Is there a better way?
In case it's useful, here is the relevant part of the watch code:
Code:
Sub Globals
Private const PATH_MASTER As String = "/masterList"
Private WDL As WearableDataLayer
Private masterWDM As WearableDataMap
Private currentNode As Map 'Holds the last connected node so we can send to it
End Sub
Sub Activity_Create(FirstTime As Boolean)
WDL.Initialize("WDL")
masterWDM.Initialize
End Sub
Sub WDL_Connected
WDL.GetConnectedNodes 'Get Connected nodes to send a msg
End Sub
Sub WDL_NodeResults(Results As List)
For i = 0 To Results.Size - 1
currentNode = Results.Get(i)
Next
End Sub
Sub WDL_DataChanged(ChangedItems As Map, DeletedItems As Map)
WDL.GetDataMap2(currentNode.Get("ID"), PATH_MASTER, "/masterList") 'not sure what I should supply for the Tag string
End Sub
Sub WDL_DataMapResults(Success As Boolean, Results As Map)
' ToastMessageShow("WDL_DataMapResults: " & Success, False)
masterWDM = Results.Get(PATH_MASTER) 'returns null
etc.
End Sub