Blame view

BT Vendor/CommunicationProtocol.h 1.72 KB
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
//
//  CommunicationProtocol.h
//  DUREX Vendor Control
//
//  Created by Imanol Barba on 5/23/14.
//  Copyright (c) 2014 Emmoco. All rights reserved.
//
Imanol-Mikel Barba Sabariego authored
9
10
@class CommunicationProtocol;
Imanol-Mikel Barba Sabariego authored
11
12
13
#import <Foundation/Foundation.h>
#import "EMFramework.h"
Imanol-Mikel Barba Sabariego authored
14
#define SLEEP_TIME              ((NSTimeInterval)1)
Imanol-Mikel Barba Sabariego authored
15
16
17
#define MAX_STRING_LENGTH       ((int)200)
#define MAX_RETRIES             ((int)3)
#define MAX_PRODUCT_NAME_LENGTH ((int)64)
Imanol-Mikel Barba Sabariego authored
18
#define MAX_CHANNELS            ((int)16)
Imanol-Mikel Barba Sabariego authored
19
20
21
#define MONEY_IN_NUM_UNITS      ((int)6)
#define MONEY_OUT_NUM_UNITS     ((int)3)
#define CHANGE_NUM_UNITS        ((int)2)
Imanol-Mikel Barba Sabariego authored
22
#define MAX_PRODUCTS            ((int)16)
Imanol-Mikel Barba Sabariego authored
23
#define SALE_STRING_LENGTH      ((int)36)
Imanol-Mikel Barba Sabariego authored
24
#define INCIDENT_STRING_LENGTH  ((int)20)
Imanol-Mikel Barba Sabariego authored
25
#define REPORT_SERVER_URL       @"http://seneca.upc.es:8090/machine"
Imanol-Mikel Barba Sabariego authored
26
Imanol-Mikel Barba Sabariego authored
27
28
@protocol CommunicationProtocolDelegate <NSObject>
- (void)processMessage:(CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) response;
Imanol-Mikel Barba Sabariego authored
29
- (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error;
Imanol-Mikel Barba Sabariego authored
30
31
@end
Imanol-Mikel Barba Sabariego authored
32
33
@interface CommunicationProtocol : NSObject
Imanol-Mikel Barba Sabariego authored
34
35
@property (nonatomic, strong) id <CommunicationProtocolDelegate> delegate;
Imanol-Mikel Barba Sabariego authored
36
37
-(void) writeMessage: (NSString*) message;
-(void) readMessage;
Imanol-Mikel Barba Sabariego authored
38
-(void) establishConnection;
Imanol-Mikel Barba Sabariego authored
39
-(void) disconnect;
Imanol-Mikel Barba Sabariego authored
40
41
42
43
44
-(void) updateTime: (NSDateComponents*) date;
-(void) updatePrice: (uint8_t) channel : (uint8_t) product : (uint8_t) eur : (uint8_t) cents;
-(void) updateProductName: (uint8_t) channel : (uint8_t) product : (NSString*) name;
-(void) readSensorData;
-(void) readSalesLog: (NSDateComponents*) start : (NSDateComponents*) end;
Imanol-Mikel Barba Sabariego authored
45
-(void) readIncidentLog: (NSDateComponents*) start : (NSDateComponents*) end;
Imanol-Mikel Barba Sabariego authored
46
//-(void) testA9 : (NSMutableString*) testString;
Imanol-Mikel Barba Sabariego authored
47
48
49
+(id) sharedProtocol;

@end