|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
//
// EMSerialPacket.h
// Emmoco
//
// Created by bob frankel on 8/18/11.
// Copyright 2011 Emmoco, Inc.. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "EMSchema.h"
#import "EMChecksum.h"
@class EMSchema;
#define EM_MAX_DATA_SIZE 240
#define EM_HEADER_SIZE 4
enum {
EMSerialPacket_NOP = 1 << 0,
EMSerialPacket_FETCH = 1 << 1,
EMSerialPacket_FETCH_DONE = 1 << 2,
EMSerialPacket_STORE = 1 << 3,
EMSerialPacket_STORE_DONE = 1 << 4,
EMSerialPacket_INDICATOR = 1 << 5
};
typedef NSUInteger EMSerialPacketKind;
typedef struct EMSerialPacketHeader {
int size;
EMSerialPacketKind kind;
int resourceId;
} EMSerialPacketHeader;
@interface EMSerialPacket : NSObject {
}
@property(readonly) uint8_t* buffer;
@property(readonly) int length;
- (void)addInteger:(long long)anInt forByteSize:(int)size;
- (void)alignTo:(int)align;
- (void)rewind;
- (long long)scanIntegerForByteSize:(int)size asUnsigned:(BOOL)isUnsigned;
@end
|