Robert Szeleney's blog

4th, July 2007, Developer Meeting Summary

Submitted by Robert Szeleney on Thu, 2007-07-05 13:25.

A new user role system
We will extend the skyos.org website in such a way that users can sign up for a specific role to contribute to SkyOS. (e.g. Application developer, Translator, General tester, Specialized tester, Public Relations, etc..).

The website will show detailed information about every role, including:
- Responsibilities
- Preferred way of communication with other users/developers
- Role related To-Dos
- etc..



New Profiler

Submitted by Robert Szeleney on Mon, 2007-06-25 16:31.

SkyOS has got a new profiler.
The profiler itself consists of a very small kernel part which actually samples all running processes every 100 microseconds. (though the sample rate is configurable).

A server application (The ProfilerServer) collects all these sample date and builds a call graph, visualizing it in an application.
The call graph itself contains all functions down from _main to the deepest kernel function.

Features:
- Profiles the entire system, not just single applications
- User and kernel call graph
- No recompilation of application required to profile them
- Graphical call graphic visualizer

Image



Spell Checker Service

Submitted by Robert Szeleney on Mon, 2006-11-20 12:23.

A spell checker service has been implemented making it very easy to bring spell checking support to your application.

An application which wants to spell check just has to talk with the spell checking service, completely hiding the complex actual spell checking.

A short command line utility example to check a simple word and print suggestions if the word is not correct:

#include "libdcs/libdcs.h"

int main(int argc, char *argv[])

{
	sDCSInterface *pInterface;
	sDCSMessage   *pMessage;
	HRESULT hr;

	int iCorrect;
	int i;
	char str[255];

	char pWord[255];

	printf("Enter word to check: ");

	gets(pWord);

	DCS_RegisterInterface("Application.Spell.Source", &pInterface);

	DCS_AllocMessage(&pMessage, "Check");
	DCS_AddMessageString(pMessage, "Word", pWord);

	hr = DCS_SendMessage(pInterface, "Service.SpellChecker.Requests", pMessage);
	if (hr != S_OK)

	{
		printf("Spell checking service not running.\n");
		exit(1);

	}

	if (DCS_WaitForMessage(pInterface, NULL, &pMessage) == S_OK)

	{
		if (DCS_MessageGetInteger(pMessage, "Correct", &iCorrect) == S_OK)

		{
			if (iCorrect)
				printf("Word is correct.\n");

			else
			{
				printf("Word is not correct. Suggestions:\n");

				DCS_AllocMessage(&pMessage, "Suggestions");

				DCS_AddMessageString(pMessage, "Word", pWord);
				DCS_SendMessage(pInterface, "Service.SpellChecker.Requests", pMessage);

				if (DCS_WaitForMessage(pInterface, NULL, &pMessage) == S_OK)

				{
					i = 0;
					while (1)

					{
						sprintf(str, "Suggestion%d", i);
						if (DCS_MessageGetStringPtr(pMessage, str))

						{
							printf("%s\n", DCS_MessageGetStringPtr(pMessage, str));

							i++;
						}
						else
							break;
					}

				}
			}
		}
	}
}

This utility will output:

Enter word to check: heavn

Word is not correct. Suggestions:
heaven
heaving
Haven
haven
heave
heavy
Havana
having
heavens
Evan
Han
hen
Bevan
Devan
Kevan
heaver
Hahn
have
heaven's

As usual, you can easily disable/enable the service with System Manager.
This service will also be used by SkyOS GUI widgets, making it possible to auto-spell-check text in controls like edit fields and every text editor based on a text control.



A few words on desktop Communication Service

Submitted by Robert Szeleney on Tue, 2006-10-31 13:32.

Desktop Communication Service

The desktop communication service is a powerful interprocess communication system, used to communicate between applications, services, drivers and the kernel.

Internally, communication is based on messages which are based on DataCollections. Such a DataCollection Object is able to store an unlimited number of various datatypes like strings, values, etc.

Communication itself is done between interfaces, regardless where the interface exists. (kernel or user mode, application or driver, ...). This way it is very easy to, for instance,
send a message from a device driver to user applications.
Lets consider the USB stack and device attachement.
When the USB stack initialized a new just attached device it will send following message:

MessageType STRING "Attachement"
DeviceType STRING "Printer"
DevicePath STRING "/dev/usblp0"
Product STRING "Desktjet 5550C"
Manufacturer STRING "HP"
Status STRING "Ready"

to the interface Notify.Device.Attachement.*

The * in the interface name means: Send this message to all applications waiting for messages on interfaces starting with Notify.Device.Attachement.
For instance, on a fresh SkyOS installation, there are two applications waiting for messages on this interface. The notification panel - which informs you with a little message window at the bottom left side of the screen - waits for messages on Notify.Device.Attachement.Application.NotificationPanel. Additionally, the HardwareChangeService waits on Notify.Device.Attachement.Service.HardwareChange, immediately displaying the printer configuration dialog when you attached the printer.

Communication between applications is also done using the Desktop communication interface. For instance, sending this message:
MessageType STRING "Next Song"

to Notify.Media.Player.Control will cause all running mediaplayer applications to switch to the next song.

But sending the same message to

Notify.Media.Player.Control.MediaLibrary

will only tell MediaLibary to switch to the next song. Other media applications will continue playing the current song.

So, lets say you want to write an application displaying the current battery level. Thats quite easy:

#include "skyos/libskyos.h"
#include "libdcs/libdcs.h"
#include "skygi/skygi.h"

s_gi_msg m;

HRESULT Callback(HANDLE hInterface, sDCSMessage *pMessage,
char *pSource,
float fLevel)
{
printf("Battery level for '%s' is %f %%\n", pSource, fLevel);
return S_OK;
}

int main(void)
{
HANDLE hNode;

RemoteInterface_Create("Notify.Power.Battery.Change.MyApp", Callback, &hNode);
RemoteInterface_AddParameter(hNode, "Source", REMOTE_INTERFACE_PARAMETER_STRING,
"Level", REMOTE_INTERFACE_PARAMETER_FLOAT,
NULL);

RemoteInterface_Enable(hNode);

while (1)
GI_MessageWait(&m, NULL);
}

Thats all. When running this application, everytime the battery level changes you will see something like this:

Battery level for 'Primary battery' is 98%
Battery level for 'Primary battery' is 97%
Battery level for 'Primary battery' is 96%
....
....

Many similar things can be done with just this few lines of code, like :

  • reacting when the user made network interface changes or new proxy settings
  • new weather data arrived
  • new devices attached
  • devices removed
  • disks mounted/unmounted (e.g. Open viewer window or add desktop icon)
  • a song finished playing
  • new software has been installed
  • a gesture was drawn onto the screen
  • a failed login
  • an operation was not allowed because of security policy
  • etc.

Additionally you can perform actions by just sending such messages, for instance:

  • Power done, logout
  • Remote control applications (like mediaplayer, ...)
  • Soft-detach devices
  • etc.

To conclude, the Desktop Communication Service allows easy, fast, consistent and powerful communication between the kernel, drivers, services and applications.



Composing internals and an example

Submitted by Robert Szeleney on Tue, 2006-07-18 11:26.