MomentoLive
Categories – Best thing since sliced bread.
Feb 21st
So here I was trying to make a Mac produce the little endian binary format that the Momento needs and so I thought I’d better extend NSMutableData to give it some LittleEndian “append” capability. So, I set up my class and the inheritance from but I kept getting an error that -length was only enabled for the abstract class. Then I discovered categories.
You can declare a new class as a category of an existing class (the convention is to name your files baseclass+category.{m,h}:
@interface NSMutableData (endian)
- (void)appendLittle16:(const uint16_t)value;
- (void)appendLittle32:(const uint32_t)value;
@end
As long as you import this header and link the implementation, your NSMutableData objects suddenly have this extra capability.
Instead of doing things with [super] as you normally do with an inherited class, you operate on [self].
@implementation NSMutableData (endian)
- (void)appendLittle16:(const uint16_t)value
{
uint16_t little16 = CFSwapInt16HostToLittle(value);
[self appendBytes:&little16 length:sizeof(little16)];
}
This makes the code to create packets for the Momento much simpler:
NSMutableData *data;
data=[[NSMutableData alloc] initWithCapacity:20];
[data appendLittle32:2];
[data appendBytes:&UUID length:sizeof(uuid_t)];
Sideshow becoming more than a sideline?
Feb 3rd
Trawling the interwebs is a hobby of mine and I love to hear about new tech. I recently discovered a company is trying to create something more useful for sideshow to do than tell you how many mails you have.
It seems they’re planning to put sideshow onto a range of devices and in a two-way full implementation so that you can use your smartphone as a remote for your computer.
I’m going to keep my eye on them. I’m not entirely sure about the “Golden-i” they mention… It’s bad enough with bluetooth earpieces. Threemote reminds me of the old Salling Clicker tool for the mac, but all widgety.
Ordinarily a toy for Windows would be about as useful to me as a chocolate teapot. I don’t actually own a physical windows box any more and I only recently booted Vista just to make my momento work. I wonder if I could do anything interesting with it on the mac? iPhone’s Remote app is great if you just want to do iTunes and there are other apps to control specific functions, and even apps to allow the phone to be a mouse/keyboard.
What if you could do several remote things in one app, and not just on the iPhone. That may be interesting to more people.
Somewhere between shell & perl…
Jan 31st
I’ve created a “Twitter” gadget. I have to make this easier to do, but at least it *works*
Here’re some examples of calling the Perl:
ep=`./momento Wall "Hello you" $ep`
./momento -d Wall
The first usage creates an application “Wall” on the frame. The UUID for the application is based on a unique string, so each time you update “Wall” it will update the same gadget on the frame.
It also outputs the endpoint on the frame for future reference. If the endpoint is present then it doesn’t delete previous instances of the app, or create a new one, it just updates the content.
The second usage deletes the application from the frame.
Obviously you can see now that interfacing bash to the frame now becomes trivial.
Now I want to make the frame appear as an instance of Growl.
This will involve broadcasting my existence via Bonjour. I haven’t played with that before.
Success! (mostly)
Jan 31st
I’ve managed to display a clock and the current time by sending the whole #1 command in a huge packet and sending the content after receiving a packet on 9k4. Only trouble is, neither my BMP or my (pushing my luck, successfully) PNG have a transparent background on the frame. It’s transparent in Preview though. There were some tense seconds when I thought it was still failing, but then the next time around, it showed!
Some investigation
Jan 31st
08:33:17.348887 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 9338
0×0000: 4500 05dc 04c3 2000 8011 8ceb c0a8 010b E……………
0×0010: c0a8 0107 232c 232b 2482 dc24 0100 0000 ….#,#+$..$….
This is all header until the last 8 bytes. That’s a little endian long.
0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
16 Bytes. Often used as UUID.
0×0030: 2a00 5700 6900 6e00 6400 6f00 7700 7300 *.W.i.n.d.o.w.s.
0×0040: 2000 4d00 6500 6400 6900 6100 2000 5000 ..M.e.d.i.a…P.
0×0050: 6c00 6100 7900 6500 7200 0000 3624 0000 l.a.y.e.r…6$..
The string “Windows Media Player” with an ending double null. I wonder if that’s necessary or just a quirk? Null marks the end of strings in C, if you’ve got the length up front, this is unnecessary. Usually.
Speaking of lengths, 0×2436 is 9270 and the packet is 9338 long.
0×0060: 424d 3624 0000 0000 0000 3600 0000 2800 BM6$……6…(.
0×0070: 0000 3000 0000 3000 0000 0100 2000 0000 ..0…0………
0×0080: 0000 0024 0000 0000 0000 0000 0000 0000 …$…………
Bitmap header by the looks of it. My current icon doesn’t start like this, perhaps that’s the problem.
08:33:19.040812 IP 192.168.1.7.cvc > broadcasthost.9004: UDP, length 56
0×0000: 4500 0054 0db4 0000 8011 6b36 c0a8 0107 E..T……k6….
0×0010: ffff ffff 05d7 232c 0040 8af7 a8fb 0750 ……#,.@…..P
0×0020: 13d3 9f43 bea2 a502 01d3 e9a8 2800 0000 …C……..(…
Ignoring headers, this is my Frame’s UUID, followed by 40L.
0×0030: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
cf: 0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
This is familiar, it’s what we just sent above.
0×0040: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
I’ve seen this in all the packets from the frame.
0×0050: 0000 0000 ….
Always seems to be null.
08:33:29.074954 IP 192.168.1.7.liberty-lm > broadcasthost.9004: UDP, length 56
0×0000: 4500 0054 0db5 0000 8011 6b35 c0a8 0107 E..T……k5….
0×0010: ffff ffff 05d8 232c 0040 1d88 a8fb 0750 ……#,.@…..P
0×0020: 13d3 9f43 bea2 a502 01d3 e9a8 2800 0000 …C……..(…
Same as before
0×0030: 0000 0000 0000 0000 0000 0000 0000 0000 …………….
Gone! Will this show what information is attached to this slide? Or is there some other meaning.
0×0040: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
0×0050: 0000 0000 ….
Same as before.
At this point, Vista resends the huge packet #1 again.
Followed by this:
08:33:41.861814 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 401
0×0000: 4500 01ad 04c7 0000 8011 b116 c0a8 010b E……………
0×0010: c0a8 0107 232c 232b 0199 0f40 0400 0000 ….#,#+…@….
#4 this time.
0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
Our chosen UUID
0×0030: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
The other UUID from the packet.
0×0040: 7017 0000 6501 0000 4749 4638 3961 1000 p…e…GIF89a..
0×1770, 0×165, Gif Header. (0×165 is the remaining bytes in the packet)
08:33:41.864910 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 1033
0×0000: 4500 0425 04c9 0000 8011 ae9c c0a8 010b E..%…………
0×0010: c0a8 0107 232c 232b 0411 ddca 0400 0000 ….#,#+……..
0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
0×0030: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
0×0040: 7217 0000 dd03 0000 4749 4638 3961 1000 r…….GIF89a..
Another GIF, same two IDs, 0×1772 differentiates them.
08:33:41.868012 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 399
0×0040: 7617 0000 6301 0000 4749 4638 3961 1000 v…c…GIF89a..
Another, 0×1776 this time… and several more like that all starting 0×17.
08:33:41.888890 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 285
0×0000: 4500 0139 04d2 0000 8011 b17f c0a8 010b E..9…………
0×0010: c0a8 0107 232c 232b 0125 80d5 0400 0000 ….#,#+.%……
Another #4
0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
0×0030: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
Same two IDs.
0×0040: 0100 0000 f100 0000 3c62 6f64 793e 3c6d ……..<m
#1 this time. A type identifier? This is ascii markup. I wonder if the images correspond to the actions? They don't get displayed anyway.
0×0040: 0900 0000 f300 0000 3c62 6f64 793e 3c6d ……..<m
#9 is more markup.
0×0040: 0800 0000 4d00 0000 3c62 6f64 793e 3c6d ….M…<m
So is #8
0×0040: 6600 0000 2e02 0000 3c62 6f64 793e 3c6d f…….<m
so is #0×66.
0×0040: 0700 0000 7a00 0000 3c62 6f64 793e 3c63 ….z… broadcasthost.9004: UDP, length 56
0×0000: 4500 0054 0dbd 0000 8011 6b2d c0a8 0107 E..T……k-….
0×0010: ffff ffff 05da 232c 0040 1d86 a8fb 0750 ……#,.@…..P
0×0020: 13d3 9f43 bea2 a502 01d3 e9a8 2800 0000 …C……..(…
0×0030: 0000 0000 0000 0000 0000 0000 0000 0000 …………….
0×0040: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
0×0050: 0000 0000 ….
08:33:44.872752 IP 192.168.1.7.fhc > broadcasthost.9004: UDP, length 56
0×0000: 4500 0054 0dbf 0000 8011 6b2b c0a8 0107 E..T……k+….
0×0010: ffff ffff 05db 232c 0040 8af3 a8fb 0750 ……#,.@…..P
0×0020: 13d3 9f43 bea2 a502 01d3 e9a8 2800 0000 …C……..(…
0×0030: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
0×0040: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
0×0050: 0000 0000 ….
And we repeat our content #0.
08:34:04.785784 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 74
0×0000: 4500 0066 0909 0000 8011 ae1b c0a8 010b E..f…………
0×0010: c0a8 0107 232c 232b 0052 bea2 0400 0000 ….#,#+.R……
0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
0×0030: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
0×0040: 0000 0000 1e00 0000 5b20 5374 6f70 7065 ……..[.Stoppe
0x0050: 6420 5d0a 4e6f 2073 656c 6563 7465 6420 d.].No.selected.
0×0060: 6d75 7369 6300 music.
Clicked remove:
08:34:57.014103 IP 192.168.1.11.9004 > 192.168.1.7.9003: UDP, length 20
0×0000: 4500 0030 09a2 0000 8011 adb8 c0a8 010b E..0…………
0×0010: c0a8 0107 232c 232b 001c a16a 0200 0000 ….#,#+…j….
0×0020: b948 1259 35ad c247 b2fa 2d7c 120a dc79 .H.Y5..G..-|…y
9k4?
Jan 30th
My Frame keeps chattering to noone in particular.
17:59:29.566914 IP 192.168.1.7.anynetgateway > broadcasthost.9004: UDP, length 56
0×0000: 4500 0054 26f8 0000 8011 51f2 c0a8 0107 E..T&…..Q…..
0×0010: ffff ffff 05d3 232c 0040 1d8d a8fb 0750 ……#,.@…..P
0×0020: 13d3 9f43 bea2 a502 01d3 e9a8 2800 0000 …C……..(…
0×0030: 0000 0000 0000 0000 0000 0000 0000 0000 …………….
0×0040: 3f35 a5a9 4b2d ce47 93ee 759f 3a7d da4f ?5..K-.G..u.:}.O
0×0050: 0000 0000 ….
It’s obviously trying to get the attention of something.
My replies seem to be going unnoticed
Oooh. Aah.
Jan 25th
Oooh: There’s a button to turn on expecting Sideshow stuff.
Aah: It still doesn’t like what I send it.
If I do get this working, I think I’ll make it interface with Growl. Growl is a popular notifier application for MacOS that developers have already written plugins for.
It may well be the strange 4k packets the mac is somehow sending. Bizarre. MTU is 1500bytes.
Side show no show.
Jan 24th
Neither this
0000000: 0100 0000 91ad e7a5 77a7 4d0f 9f74 9645 ……..w.M..t.E
0000010: a900 25b5 0500 436c 6f63 6bbe 2500 0000 ..%…Clock.%…
0000020: 0001 0001 0030 3000 0001 0020 00a8 2500 …..00…. ..%.
0000030: 0016 0000 0028 0000 0030 0000 0060 0000 …..(…0…`..
…
Nor this
0000000: 0000 0001 91ad e7a5 77a7 4d0f 9f74 9645 ……..w.M..t.E
0000010: a900 25b5 0005 436c 6f63 6b00 0025 be00 ..%…Clock..%..
0000020: 0001 0001 0030 3000 0001 0020 00a8 2500 …..00…. ..%.
0000030: 0016 0000 0028 0000 0030 0000 0060 0000 …..(…0…`..
…
Elicit a response from the frame. More work to be done.
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en1, link-type EN10MB (Ethernet), capture size 65535 bytes
23:01:19.151797 IP 192.168.1.4.52439 > 192.168.1.7.9003: UDP, length 4096
23:01:19.151861 IP 192.168.1.4.52439 > 192.168.1.7.9003: UDP, length 4096
23:01:19.151908 IP 192.168.1.4.52439 > 192.168.1.7.9003: UDP, length 1501
23:01:19.155348 IP 192.168.1.4.52439 > 192.168.1.7.9003: UDP, length 4096
23:01:19.156945 IP 192.168.1.4.52439 > 192.168.1.7.9003: UDP, length 4096
23:01:19.157718 IP 192.168.1.4.52439 > 192.168.1.7.9003: UDP, length 1501
Why is it sending >1500 byte packets from bash? Bizarre.
Back in business
Jan 24th
I’ve successfully configured DNS for momentolive.com on my MacMini Server, I’ve added the certificate & key I created to the server’s keychain. I’ve added an https server on 1066 and set it to point at my code.
Then I hit a brick wall. The momento refused to connect to my BT Home Hub. I struggled for hours, trying to make it first see the hub, then make a connection to it. I succeeded in the first, but didn’t manage to succeed in the latter until I changed to WEP. I guess I’m going to be a little less secure at home until I complete this. It used to connect to my old AP ok with WPA PSK but it keeps attempting “Open” authentication with the BT Home Hub.
I finally hooked it all up and the frame said it wasn’t registered.
I registered it against my software. It said all was well, but then I had a glitch where it kept calling GET frame.sync, it just wasn’t happy. I eventually satisfied it by sending it something which I only remember receiving by POST before:
object momento.synccommit, item momento.registered
Once I sent that to the frame, it became quiet, and then it was happy to receive pictures.
I have a picture on my frame.
Now, finally, I can play with the uPNP/Sideshow stuff.
And you’re back in the room.
Jan 21st
This weekend, I plan to work on the frame again. Code’s installed on the server again, fingers are sharpened, so are my wits. I’m ready.
Recent Comments