Logo Banner

Velleman K8000 - [K8000 Standalone Usage] - [K8000 Wireless Server]

Client Software

What is the client software?

The client software is the software that will establish a connection to the server. It will send the required requests, and analyze the responses. It should be written in a way so the user doesn't have to bother with network programming.

I wrote a sample client application in Visual Basic .NET 3.5. The application is engineered in such a way that all network programming is contained within a single software class (Remote_K8000).

Features of the client software

The sample application shows the possibilities of the K8000 server. You first need to specify the connection settings: the IP address and TCP/IP port of the server. You also need to specify a password. This password is hard coded into the server: bart!.

You can create a connection after filling in all required fields. Then the program will try to create a connection to the server. A message box with the status is shown.

You can start clicking the buttons once the connection has been made. The Remote_K8000 class will translate your actions into commands that are transmitted over the network. These commands must follow the protocol guidelines.

The Remote_K8000 class

The Remote_K8000 class handles all communications from and to the K8000 server on the FEZ. I wrote it in a way so the user doesn't have to bother with networking commands. You could reuse my Remote_K8000 class in a new project. Let's say you want to build your own application that creates a connection with the FEZ. Then it instructs the FEZ to set all I/O channels. Finally it terminates the network communications. This is the required source code to do all this:

    Dim server As New Remote_K8000()
    
    If server.connect("192.168.2.150", 23, "bart!") = True Then
    	server.setAllIO()
    	server.disconnect()
    End If 
    

Easy, no? Of course this is just an easy example where the program doesn't get feedback from the server. We can build a more complex example where all I/O channels are set and where the server response is checked for the "+OK" response. Last but not least: We will now verify if the channel 1 is really active. This can be done with the following code:

    Dim server As New Remote_K8000
    
      If server.connect("192.168.2.150", 23, "bart!") = True Then
        Dim io(0) As Boolean
        
        If server.setAllIO(io) Then
        	If io(1) = True Then
        		MsgBox("I/O 1 is really active now!")
        	End If
        Else
        	MsgBox("the server didn't respond with +OK")
      End If
      
      server.disconnect()
    End If
    

The Remote_K8000 class currently supports all protocol commands I've implemented in the FEZ Server program.

Download

Here you can download the source code for the client. It is written in Visual Studio 2010 but you can open it in the free Visual Basic .NET 2010 Express as well.


Copyright ©1998-2022 Vanderhaegen Bart - last modified: August 24, 2013