Wednesday, October 5, 2011

TxtMsg Web Application Setup

UPDATE: The source code has been posted at https://code.google.com/p/text-message-for-chumby/.

There are three different projects which makeup the TxtMsg widget. First, there is the widget itself, then there is the configuration widget, and lastly there is the web application. This post will deal with the setup and configuration of the web application piece.

Requirements

The web application was written using C# and runs on IIS. The code is short and simple so it should be very easy to port it over to PHP or Java and host it on Apache.

  • IIS Server
  • Ability to set folder permissions on the server

 

Overview

The web application uses file storage to store messages and Chumby device information. The data should be kept in a database however I wanted to through something together quickly and make it easy for people to understand. Feel free to modify the application to use a different storage method. This entry will address the implemented file storage solution.

Steps to install on IIS

  1. Download and unzip the source code.
  2. Copy the web_TextDB folder to a location you use for your web applications.
  3. In IIS, create an application and set the root directory to the wwwroot folder.
  4. Determine what account IIS is using for the anonymous user.
    1. IIS 6, this will be the identity of the Application Pool
    2. IIS 7, this will be the also be the identity of the Application Pool however if the user is ApplicationPoolIdentity then we need the IUSR group as the ApplicationPoolIdentity is a member of the IUSR group.
  5. Grant the user identified in the previous step full permission to the <wwwroot>\TextMsg_Files folder.
  6. Restart IIS
  7. Edit line 50 in the <wwwroot>\App_Code\ChumbyTextMessage.cs file so the path is correct.
    private const string CHUMBYDEVICEFILEPREFIX = "~/Chumby/TextMsg_Files/";
  8. Now you should be able to connect to the server application to generate the <wwwroot>\TextMsg_Files\DeviceList.txt” file by going to http://localhost/chumby/ChumbyServer.aspx?ChumbyName=Richard's%20Office&ChumbyID=93164D65-A1F1-1C2C-735F-099E2E5A0FF7&MaxMessages=99&MaxDays=99&UserName=&Password=&Paramaters=
    1. Change the URL to match your server
    2. Change the parameters
      1. ChumbyName: This is the name of the Chumby such as “Richard’s Office”.
      2. ChumbyID: This is a unique GUID which is generated for each device and I believe each widget.
      3. MaxMessages: This is the maximum number of messages to retrive.
      4. MaxDays: The maximum number of days to pull and display.
      5. UserName: Optional – Username to authenticate to the web application. (Not used in demo)
      6. Password: Optional – Password to authenticate to the web application. (Not used in demo)
      7. Paramaters: Additional parameters may be passed to the function. These are stored in an array and passed to the function.
  9. If successful, the TextMsg_Files folder will have the DeviceList.txt file. If you open the file in a text editor, you will observe the following information stored in it.

    ChumbyID    ChumbyName    Added    LastAccessed
    93164D65-A1F1-1C2C-735F-099E2E5A0FF7    Richard's Office    10/5/2011 7:05:40 AM    10/5/2011 7:05:40 AM



    1. ChumbyID: This is a unique GUID which is generated for each device and I believe each widget.
    2. ChumbyName: This is the name of the Chumby such as “Richard’s Office”.
    3. Added: Date & Time the chumby was added to the file. (GMT)
    4. LastAccessed: Date & Time the chumby contacted the server. (GMT)

  10. If successful, the resulting webpage will display the default message to display on the chumby device.
    10/05/2011 07:05:40	How to send a Text Message	<font color="#000080" size="16">Steps to send a message to this widget.</font><ul><li>Go to <font color="#0000ff"><a href="http://localhost/chumby/ChumbyAddMessage.aspx">http://localhost/chumby/ChumbyAddMessage.aspx</a></font></li><li>Select "Richard's Office" from the Chumby drop-down list</li><li>Enter your name and message</li><li>Click the "Submit" button</li></ul>



    1. Date (GMT)
    2. From
    3. Body

  11. If you want to add a message to display on the chumby, you may go to the “ChumbyAddMessage.aspx” page. On my test server this is http://localhost/chumby/ChumbyAddMessage.aspx.
  12. On this page, you will see the list of chumby devices which have contacted the server. If you just set this web application up and performed the previous seps, you will only have one chumby listed which in my case is “Richard’s Office”.
  13. Select the chumby from the list and enter a name in the “From” textbox and a message in the “Message” textbox and click the “Submit” button.
    SendMessage
  14. You will now observe a new text file in the <wwwroot>\TextMsg_Files folder with the chumby id for the file name. This is another text file which contains the information from the message.

1 comment:

  1. As of 10 August 2013, I shut down the server which hosted the Web Application for the Chumby Widget. The source Code is still available at the link provided at the top of this post. You may stand up a server and allow others to connect to it.

    I may bring the server back online in the future and will let you know if I do.

    ReplyDelete