DPWS device host with WCF client

Edit: Sorry about the double post, browser timed out and i wasn’t sure if it posted or not… no way to delete… those with the mighty power please delete one of the two posts. thank you.

Hi MoonDragon.
i followed your steps and created the Projects, the verdict is:
********************** it WORKS ******************** !!! ;D

i had to modify few things, nothing big…



in the buttonValue_Click i had to change:

 ButtonValue bv = client.getButtonValue(new EmptyValue());

to 

 ButtonValueType bv = client.getButtonValue(new EmptyValueType());

my generated files had teh Type at the end of ButtonValue and EmptyValue.

The Second thing i would recommend is maybe including the following paths to your blog… it would make it easy to find the concerned utilities, or at least give a step in the right direction


Client side:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\SvcConfigEditor.exe
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\SvcUtil.exe

Host Side:


C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools\MFSvcUtil.exe

and one last thing you may want to change the wording of Pressing a Button to return value 1 to HOLDING DOWN the button to get value 1. at first i was pressing and releasing and expecting the button value to change but when i checked the code i realized that i should press and hold the button down…
other than that, very good write up and great work… :slight_smile:

Cheers…

Jay.

Oh yah and one more thing.

To those wanting to try this, Do not forget to add the Ethernet Module and do this in your ProgramStarted():


            ethernet.UseDHCP();
            InitializeDpwsStack();
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

@ Jay Jay

Thank you so much for taking the time to work it out. The name issue is: an issue. That was an oversight that I forgot to write up. I had an issue where my data was not recognized properly, so one of the things I tried was renaming the data types to resemble those generated by MFSvcUtil. And I forgot to write it up. Are you saying that it works if you change it back to ButtonValueType? That’s great. I’ll modify the code back.

I did write up the path of the utilities in the beginning of the first post (third paragraph), when I mentioned all the utilities that will be required. I just didn’t want to refer to the utilities in terms of their absolute paths, because people install stuff in different folders. For example, you used SDKs\Windows\v7.0A, while I used SDKs\Windows\v7.1.

Fair enough about the pressing button wording. Although, since this is an example that’s supposed to help people start with their own code, I’m glad you could quickly figure out the intended function. But I will change it. Because there is nothing worse than following a tutorial word for word, then pressing a button, and nothing happens.

Finally, the network thing was a 50/50 for me. I was wondering if I should write up the need of and what I did for network. But I figured if someone is doing DPWS coding, the networking should be a given. So for the sake of brevity I left that out. The example code though, has the network initialization in it. Hopefully I can upload that once the new website is rolled out.

–Edit–

FYI, I modified the Type issue and have slightly augmented the wording about button presses. Thanks again for your feedback.

Cool,
glad i could help…

I will be playing more with it and hopefully create a cool example.

thanks for sharing…

Did someone build a final example?