Open ju2pom opened 5 years ago
Hi @ju2pom
Which code base are you using? If you are receiving events from Plugin manager, you're almost there. I'm not sure what bad json files. But you can check jsonlint.com or jslint.com.
Basically, you need to send back serialized json string to same websocket object. Line #224 of https://github.com/Logitech/logi_craft_sdk/blob/master/samples/Objective-C/examples/Craft/Craft/LogiCraftClient.mm
Could you explain this here or extend the documentation ? If you have a particular question, it would be better to more detailed. Then it's more easy to get answer. But explaining everything again here may not work.
default.json file is used mainly in LogiOptions. tools.json file is used in overlay manager and more related to plugin side.
"tasks" are linked to built in functions in LogiOptions. "tools/name" is paired from tools_change message. "tool_options/names" are selected overlay from overlay manager.
Hi, Thanks for your answer, here are some more details about my issue:
Here is my tools.json file:
{
"GUID": "1CF0E277-919B-4DE4-B226-B41FEF915CFC",
"tools": [
{
"name": "ToolA",
"enabled": true,
"tool_options": [
{
"index": 0,
"name": "Tool A",
"image_file_path": "progressBar.png",
"enabled": true,
"ratchet_enabled": true
}
]
},
{
"name": "ToolB",
"enabled": true,
"tool_options": [
{
"index": 1,
"name": "Tool B",
"image_file_path": "numericUpDown.png",
"enabled": true,
"ratchet_enabled": false
}
]
}
]
}
Here is the code I call to change tool
public void ChangeTool(string toolName)
{
try
{
ToolChangeObject toolChangeObject = new ToolChangeObject();
toolChangeObject.message_type = "tool_change";
toolChangeObject.session_id = this.sessionId;
toolChangeObject.tool_id = toolName;
string serializedObject = JsonConvert.SerializeObject(toolChangeObject);
client.Send(serializedObject);
}
catch (Exception ex)
{
this.LastErrorMessage = ex.Message;
}
}
The sessionId
seems correct, I took it from the register_ack
message.
If I call the method with either "ToolA" or "ToolB" when I touch or turn the crown I don't see any overlay visible.
Do I miss anything ?
And by the way if custom profile can take advantage of it, I'd be glad to know the list of built in tasks, their meaning and how we can interact with them.
Before writing any software taking advantage of the Logitech Craft device I'd like to create a more generic and reusable SDK. It should be public (like you did, and thank you very much for this) so even more people can easily create nice plugins for this great device.
So even if it's not ready yet, I created a repo that contains the code I produced so far (you'll notice I borrowed a bit of yours). Now that this repo logicraftsdk.NET is set up it's even easier for you to track down what I did wrong (if you have some to time investigate, .
Note that the current code is in a very early stage, I only worked on it for a few hours ...
Hi @ju2pom ,
I have not checked sample code with latest LogiOptions recently. But I wonder following items:
1) Did you verify the sample code work with latest or LogiOptions before change?
2) "GUID": "1CF0E277-919B-4DE4-B226-B41FEF915CFC" I saw most of GUID used in SDK is all lower case, I wonder it might be issue. So I think it's better to change all lower case to try. It is also used folder name. It needs to be same.
3) "name": "Tool A", "name": "Tool B" I'm not sure if this part is allowed space. So I think it's better to try without space. These part and also "name": "ToolA" part are keyword. Actual display values needs to be defined at guid/Languages/en.json file. Ref) https://github.com/Logitech/logi_craft_sdk/blob/master/samples/WinFormsCrownSample/d510af8d-360f-4f3d-9216-20cd4f20f664/Languages/en.json
4) "index": 0 and "index": 1 This part is independent in each array. So for this case, I think it's better to be both "index": 0
Hi, I'm trying to build a plugin using this SDK but I miss some explanation on the tools.json and defaults.json files. I'm currently able to receive events from the Plugin manager (crown touched, turned ...) but I can't make the "change_tool" message to work. I mean I can't see any overlay displayed.
I guess it's related to bad json files that's why I'd like to know more (for example what's the role of tasks and what's the link with the code ?
Could you explain this here or extend the documentation ? Thanks.